コード例 #1
0
ファイル: create.py プロジェクト: piotradamczyk5/gcloud_cli
    def Args(cls, parser, support_l7_internal_load_balancer, support_failover,
             support_logging, support_multinic, support_client_only,
             support_grpc_protocol, support_all_protocol, support_subsetting,
             support_flexible_cache_step_one):
        """Add flags to create a backend service to the parser."""

        parser.display_info.AddFormat(flags.DEFAULT_LIST_FORMAT)
        flags.GLOBAL_REGIONAL_BACKEND_SERVICE_ARG.AddArgument(
            parser, operation_type='create')
        flags.AddDescription(parser)
        cls.HEALTH_CHECK_ARG = flags.HealthCheckArgument(
            support_regional_health_check=support_l7_internal_load_balancer)
        cls.HEALTH_CHECK_ARG.AddArgument(parser, cust_metavar='HEALTH_CHECK')
        cls.HTTP_HEALTH_CHECK_ARG = flags.HttpHealthCheckArgument()
        cls.HTTP_HEALTH_CHECK_ARG.AddArgument(parser,
                                              cust_metavar='HTTP_HEALTH_CHECK')
        cls.HTTPS_HEALTH_CHECK_ARG = flags.HttpsHealthCheckArgument()
        cls.HTTPS_HEALTH_CHECK_ARG.AddArgument(
            parser, cust_metavar='HTTPS_HEALTH_CHECK')
        flags.AddTimeout(parser)
        flags.AddPortName(parser)
        flags.AddProtocol(parser,
                          default=None,
                          support_grpc_protocol=support_grpc_protocol,
                          support_all_protocol=support_all_protocol)
        flags.AddEnableCdn(parser)
        flags.AddSessionAffinity(parser,
                                 support_client_only=support_client_only)
        flags.AddAffinityCookieTtl(parser)
        flags.AddConnectionDrainingTimeout(parser)
        flags.AddLoadBalancingScheme(
            parser, include_l7_ilb=support_l7_internal_load_balancer)
        flags.AddCustomRequestHeaders(parser, remove_all_flag=False)
        flags.AddCacheKeyIncludeProtocol(parser, default=True)
        flags.AddCacheKeyIncludeHost(parser, default=True)
        flags.AddCacheKeyIncludeQueryString(parser, default=True)
        flags.AddCacheKeyQueryStringList(parser)
        AddIapFlag(parser)
        parser.display_info.AddCacheUpdater(flags.BackendServicesCompleter)
        signed_url_flags.AddSignedUrlCacheMaxAge(parser, required=False)

        if support_subsetting:
            flags.AddSubsettingPolicy(parser)

        if support_failover:
            flags.AddConnectionDrainOnFailover(parser, default=None)
            flags.AddDropTrafficIfUnhealthy(parser, default=None)
            flags.AddFailoverRatio(parser)

        if support_logging:
            flags.AddEnableLogging(parser)
            flags.AddLoggingSampleRate(parser)

        if support_multinic:
            flags.AddNetwork(parser)

        if support_flexible_cache_step_one:
            cdn_flags.AddFlexibleCacheStepOne(parser, 'backend service')
コード例 #2
0
ファイル: update.py プロジェクト: saranraju90/multik8s
    def Args(cls, parser, support_l7_internal_load_balancer, support_failover,
             support_logging, support_client_only, support_grpc_protocol,
             support_subsetting, support_all_protocol,
             support_flexible_cache_step_one, support_flexible_cache_step_two,
             support_negative_cache, support_edge_policies):
        """Add all arguments for updating a backend service."""

        flags.GLOBAL_REGIONAL_BACKEND_SERVICE_ARG.AddArgument(
            parser, operation_type='update')
        flags.AddDescription(parser)
        cls.HEALTH_CHECK_ARG = flags.HealthCheckArgument(
            support_regional_health_check=support_l7_internal_load_balancer)
        cls.HEALTH_CHECK_ARG.AddArgument(parser, cust_metavar='HEALTH_CHECK')
        cls.HTTP_HEALTH_CHECK_ARG = flags.HttpHealthCheckArgument()
        cls.HTTP_HEALTH_CHECK_ARG.AddArgument(parser,
                                              cust_metavar='HTTP_HEALTH_CHECK')
        cls.HTTPS_HEALTH_CHECK_ARG = flags.HttpsHealthCheckArgument()
        cls.HTTPS_HEALTH_CHECK_ARG.AddArgument(
            parser, cust_metavar='HTTPS_HEALTH_CHECK')
        flags.AddNoHealthChecks(parser)
        cls.SECURITY_POLICY_ARG = (
            security_policy_flags.SecurityPolicyArgumentForTargetResource(
                resource='backend service'))
        cls.SECURITY_POLICY_ARG.AddArgument(parser)
        if support_edge_policies:
            cls.EDGE_SECURITY_POLICY_ARG = (
                security_policy_flags.
                EdgeSecurityPolicyArgumentForTargetResource(
                    resource='backend service'))
            cls.EDGE_SECURITY_POLICY_ARG.AddArgument(parser)
        flags.AddTimeout(parser, default=None)
        flags.AddPortName(parser)
        flags.AddProtocol(parser,
                          default=None,
                          support_grpc_protocol=support_grpc_protocol,
                          support_all_protocol=support_all_protocol)

        flags.AddConnectionDrainingTimeout(parser)
        flags.AddEnableCdn(parser)
        flags.AddCacheKeyIncludeProtocol(parser, default=None)
        flags.AddCacheKeyIncludeHost(parser, default=None)
        flags.AddCacheKeyIncludeQueryString(parser, default=None)
        flags.AddCacheKeyQueryStringList(parser)
        flags.AddSessionAffinity(parser,
                                 support_client_only=support_client_only)
        flags.AddAffinityCookieTtl(parser)
        signed_url_flags.AddSignedUrlCacheMaxAge(parser,
                                                 required=False,
                                                 unspecified_help='')
        if support_subsetting:
            flags.AddSubsettingPolicy(parser)

        if support_failover:
            flags.AddConnectionDrainOnFailover(parser, default=None)
            flags.AddDropTrafficIfUnhealthy(parser, default=None)
            flags.AddFailoverRatio(parser)

        if support_logging:
            flags.AddEnableLogging(parser)
            flags.AddLoggingSampleRate(parser)

        AddIapFlag(parser)
        flags.AddCustomRequestHeaders(parser,
                                      remove_all_flag=True,
                                      default=None)
        if support_flexible_cache_step_one:
            cdn_flags.AddFlexibleCacheStepOne(parser,
                                              'backend service',
                                              update_command=True)
        if support_flexible_cache_step_two:
            cdn_flags.AddFlexibleCacheStepTwo(parser,
                                              'backend service',
                                              update_command=True)
        if support_negative_cache:
            cdn_flags.AddNegativeCache(parser,
                                       'backend service',
                                       update_command=True)
コード例 #3
0
    def Args(cls, parser, support_l7_internal_load_balancer, support_failover,
             support_logging, support_tcp_ssl_logging, support_client_only,
             support_grpc_protocol, support_subsetting,
             support_subsetting_subset_size, support_unspecified_protocol,
             support_strong_session_affinity, support_advanced_load_balancing,
             support_dynamic_compression, support_weighted_lb):
        """Add all arguments for updating a backend service."""

        flags.GLOBAL_REGIONAL_BACKEND_SERVICE_ARG.AddArgument(
            parser, operation_type='update')
        flags.AddDescription(parser)
        cls.HEALTH_CHECK_ARG = flags.HealthCheckArgument(
            support_regional_health_check=support_l7_internal_load_balancer)
        cls.HEALTH_CHECK_ARG.AddArgument(parser, cust_metavar='HEALTH_CHECK')
        cls.HTTP_HEALTH_CHECK_ARG = flags.HttpHealthCheckArgument()
        cls.HTTP_HEALTH_CHECK_ARG.AddArgument(parser,
                                              cust_metavar='HTTP_HEALTH_CHECK')
        cls.HTTPS_HEALTH_CHECK_ARG = flags.HttpsHealthCheckArgument()
        cls.HTTPS_HEALTH_CHECK_ARG.AddArgument(
            parser, cust_metavar='HTTPS_HEALTH_CHECK')
        flags.AddNoHealthChecks(parser)
        cls.SECURITY_POLICY_ARG = (
            security_policy_flags.SecurityPolicyArgumentForTargetResource(
                resource='backend service'))
        cls.SECURITY_POLICY_ARG.AddArgument(parser)
        cls.EDGE_SECURITY_POLICY_ARG = (
            security_policy_flags.EdgeSecurityPolicyArgumentForTargetResource(
                resource='backend service'))
        cls.EDGE_SECURITY_POLICY_ARG.AddArgument(parser)
        flags.AddTimeout(parser, default=None)
        flags.AddPortName(parser)
        flags.AddProtocol(
            parser,
            default=None,
            support_grpc_protocol=support_grpc_protocol,
            support_unspecified_protocol=support_unspecified_protocol)

        flags.AddConnectionDrainingTimeout(parser)
        flags.AddEnableCdn(parser)
        flags.AddCacheKeyIncludeProtocol(parser, default=None)
        flags.AddCacheKeyIncludeHost(parser, default=None)
        flags.AddCacheKeyIncludeQueryString(parser, default=None)
        flags.AddCacheKeyQueryStringList(parser)
        flags.AddCacheKeyExtendedCachingArgs(parser)
        flags.AddSessionAffinity(parser,
                                 support_client_only=support_client_only)
        flags.AddAffinityCookieTtl(parser)
        signed_url_flags.AddSignedUrlCacheMaxAge(parser,
                                                 required=False,
                                                 unspecified_help='')
        if support_subsetting:
            flags.AddSubsettingPolicy(parser)
            if support_subsetting_subset_size:
                flags.AddSubsettingSubsetSize(parser)

        if support_failover:
            flags.AddConnectionDrainOnFailover(parser, default=None)
            flags.AddDropTrafficIfUnhealthy(parser, default=None)
            flags.AddFailoverRatio(parser)

        if support_logging:
            if support_tcp_ssl_logging:
                flags.AddEnableLoggingProtocols(parser)
                flags.AddLoggingSampleRateProtocols(parser)
            else:
                flags.AddEnableLogging(parser)
                flags.AddLoggingSampleRate(parser)

        AddIapFlag(parser)
        flags.AddCustomRequestHeaders(parser,
                                      remove_all_flag=True,
                                      default=None)

        cdn_flags.AddCdnPolicyArgs(parser,
                                   'backend service',
                                   update_command=True)

        flags.AddConnectionTrackingPolicy(parser)

        if support_strong_session_affinity:
            flags.AddStrongSessionAffinity(parser)

        if support_dynamic_compression:
            flags.AddCompressionMode(parser)

        if support_advanced_load_balancing:
            flags.AddServiceLoadBalancingPolicy(parser,
                                                required=False,
                                                is_update=True)

        flags.AddServiceBindings(parser, required=False, is_update=True)

        if support_weighted_lb:
            flags.AddLocalityLbPolicy(parser)