def CommonArgs(parser): # Flags specific to managed CR managed_group = flags.GetManagedArgGroup(parser) flags.AddAllowUnauthenticatedFlag(managed_group) flags.AddServiceAccountFlag(managed_group) flags.AddCloudSQLFlags(managed_group) flags.AddRevisionSuffixArg(managed_group) # Flags specific to connecting to a cluster cluster_group = flags.GetClusterArgGroup(parser) flags.AddEndpointVisibilityEnum(cluster_group) # Flags not specific to any platform service_presentation = presentation_specs.ResourcePresentationSpec( 'SERVICE', resource_args.GetServiceResourceSpec(prompt=True), 'Service to deploy to.', required=True, prefixes=False) flags.AddImageArg(parser) flags.AddFunctionArg(parser) flags.AddMutexEnvVarsFlags(parser) flags.AddMemoryFlag(parser) flags.AddConcurrencyFlag(parser) flags.AddTimeoutFlag(parser) flags.AddAsyncFlag(parser) flags.AddLabelsFlags(parser) flags.AddMaxInstancesFlag(parser) flags.AddCommandFlag(parser) flags.AddArgsFlag(parser) flags.AddPortFlag(parser) flags.AddCpuFlag(parser) concept_parsers.ConceptParser([service_presentation ]).AddToParser(parser)
def CommonArgs(parser): # Flags specific to managed CR managed_group = flags.GetManagedArgGroup(parser) flags.AddRegionArg(managed_group) flags.AddAllowUnauthenticatedFlag(managed_group) flags.AddRevisionSuffixArg(managed_group) flags.AddServiceAccountFlag(managed_group) flags.AddCloudSQLFlags(managed_group) # Flags specific to CRoGKE gke_group = flags.GetGkeArgGroup(parser) concept_parsers.ConceptParser([resource_args.CLUSTER_PRESENTATION ]).AddToParser(gke_group) # Flags not specific to any platform service_presentation = presentation_specs.ResourcePresentationSpec( 'SERVICE', resource_args.GetServiceResourceSpec(prompt=True), 'Service to deploy to.', required=True, prefixes=False) flags.AddSourceRefFlags(parser) flags.AddFunctionArg(parser) flags.AddMutexEnvVarsFlags(parser) flags.AddMemoryFlag(parser) flags.AddConcurrencyFlag(parser) flags.AddTimeoutFlag(parser) flags.AddAsyncFlag(parser) concept_parsers.ConceptParser([service_presentation ]).AddToParser(parser)
def CommonArgs(parser): # Flags specific to managed CR managed_group = flags.GetManagedArgGroup(parser) flags.AddRegionArg(managed_group) flags.AddServiceAccountFlag(managed_group) flags.AddCloudSQLFlags(managed_group) # Flags specific to CRoGKE gke_group = flags.GetGkeArgGroup(parser) concept_parsers.ConceptParser([resource_args.CLUSTER_PRESENTATION ]).AddToParser(gke_group) # Flags specific to connecting to a Kubernetes cluster (kubeconfig) kubernetes_group = flags.GetKubernetesArgGroup(parser) flags.AddKubeconfigFlags(kubernetes_group) # Flags specific to connecting to a cluster cluster_group = flags.GetClusterArgGroup(parser) flags.AddEndpointVisibilityEnum(cluster_group) flags.AddCpuFlag(cluster_group) # Flags not specific to any platform service_presentation = presentation_specs.ResourcePresentationSpec( 'SERVICE', resource_args.GetServiceResourceSpec(prompt=True), 'Service to update the configuration of.', required=True, prefixes=False) flags.AddPlatformArg(parser) flags.AddMutexEnvVarsFlags(parser) flags.AddMemoryFlag(parser) flags.AddConcurrencyFlag(parser) flags.AddTimeoutFlag(parser) flags.AddAsyncFlag(parser) flags.AddLabelsFlags(parser, add_create=False) flags.AddMaxInstancesFlag(parser) concept_parsers.ConceptParser([service_presentation ]).AddToParser(parser)
def CommonArgs(parser): # Flags specific to managed CR managed_group = flags.GetManagedArgGroup(parser) flags.AddRegionArg(managed_group) flags.AddServiceAccountFlag(managed_group) flags.AddCloudSQLFlags(managed_group) # Flags specific to CRoGKE gke_group = flags.GetGkeArgGroup(parser) concept_parsers.ConceptParser([resource_args.CLUSTER_PRESENTATION ]).AddToParser(gke_group) # Flags not specific to any platform service_presentation = presentation_specs.ResourcePresentationSpec( 'SERVICE', resource_args.GetServiceResourceSpec(prompt=True), 'Service to update the configuration of.', required=True, prefixes=False) flags.AddMutexEnvVarsFlags(parser) flags.AddMemoryFlag(parser) flags.AddConcurrencyFlag(parser) flags.AddTimeoutFlag(parser) flags.AddAsyncFlag(parser) flags.AddLabelsFlags(parser, add_create=False) concept_parsers.ConceptParser([service_presentation ]).AddToParser(parser)
def Args(parser): # Flags specific to managed CR managed_group = flags.GetManagedArgGroup(parser) flags.AddRegionArg(managed_group) flags.AddServiceAccountFlag(managed_group) # Flags specific to CRoGKE gke_group = flags.GetGkeArgGroup(parser) concept_parsers.ConceptParser([resource_args.CLUSTER_PRESENTATION ]).AddToParser(gke_group) # Flags specific to connecting to a Kubernetes cluster (kubeconfig) kubernetes_group = flags.GetKubernetesArgGroup(parser) flags.AddKubeconfigFlags(kubernetes_group) # Flags not specific to any platform service_presentation = presentation_specs.ResourcePresentationSpec( '--service', resource_args.GetServiceResourceSpec(prompt=True), 'Service to update the configuration of.', required=True, prefixes=False) flags.AddAlphaPlatformArg(parser) flags.AddMutexEnvVarsFlags(parser) flags.AddMemoryFlag(parser) flags.AddConcurrencyFlag(parser) flags.AddTimeoutFlag(parser) flags.AddAsyncFlag(parser) concept_parsers.ConceptParser([service_presentation]).AddToParser(parser)
def testVerifyOnePlatformFlagsTimeout(self): parser = argparse.ArgumentParser() flags.AddTimeoutFlag(parser) args = parser.parse_args(['--timeout', '1h'], parser_extensions.Namespace(timeout=None)) with self.assertRaises(exceptions.ConfigurationError): flags.VerifyOnePlatformFlags(args, self.track, flags.Product.RUN)
def Args(parser): service_presentation = presentation_specs.ResourcePresentationSpec( 'SERVICE', resource_args.GetServiceResourceSpec(prompt=True), 'Service to deploy to.', required=True, prefixes=False) flags.AddSourceRefFlags(parser) flags.AddRegionArg(parser) flags.AddPlatformArg(parser) flags.AddKubeconfigFlags(parser) flags.AddFunctionArg(parser) flags.AddMutexEnvVarsFlags(parser) flags.AddCpuFlag(parser) flags.AddMemoryFlag(parser) flags.AddConcurrencyFlag(parser) flags.AddTimeoutFlag(parser) flags.AddAsyncFlag(parser) flags.AddEndpointVisibilityEnum(parser) flags.AddCloudSQLFlags(parser) flags.AddAllowUnauthenticatedFlag(parser) flags.AddServiceAccountFlag(parser) concept_parsers.ConceptParser( [resource_args.CLUSTER_PRESENTATION, service_presentation]).AddToParser(parser)
def testValidTimeoutNumber(self, timeout): parser = _TestArgumentParser() flags.AddTimeoutFlag(parser) parser.parse_args(['--timeout', timeout], self.args) self._GetAndApplyChanges() self.assertEqual(len(self.changes), 1) self.assertEqual(self.service.template.timeout, int(timeout))
def testValidTimeoutDuration(self, timeout, expect_seconds): parser = _TestArgumentParser() flags.AddTimeoutFlag(parser) parser.parse_args(['--timeout', timeout], self.args) self._GetAndApplyChanges() self.assertEqual(len(self.changes), 1) self.assertEqual(self.service.template.timeout, expect_seconds)
def testVerifyOnePlatformFlagsTimeoutGAOk(self): parser = argparse.ArgumentParser() flags.AddTimeoutFlag(parser) args = parser.parse_args(['--timeout', '15m'], parser_extensions.Namespace(timeout=None)) flags.VerifyOnePlatformFlags(args, calliope_base.ReleaseTrack.GA, flags.Product.RUN)
def CommonArgs(parser): # Flags specific to managed CR managed_group = flags.GetManagedArgGroup(parser) flags.AddAllowUnauthenticatedFlag(managed_group) flags.AddBinAuthzPolicyFlags(managed_group) flags.AddBinAuthzBreakglassFlag(managed_group) flags.AddCloudSQLFlags(managed_group) flags.AddCpuThrottlingFlag(managed_group) flags.AddRevisionSuffixArg(managed_group) flags.AddVpcConnectorArgs(managed_group) flags.AddEgressSettingsFlag(managed_group) flags.AddCmekKeyFlag(managed_group) flags.AddCmekKeyRevocationActionTypeFlag(managed_group) # Flags specific to connecting to a cluster cluster_group = flags.GetClusterArgGroup(parser) flags.AddEndpointVisibilityEnum(cluster_group) flags.AddConfigMapsFlags(cluster_group) # Flags not specific to any platform service_presentation = presentation_specs.ResourcePresentationSpec( 'SERVICE', resource_args.GetServiceResourceSpec(prompt=True), 'Service to deploy to.', required=True, prefixes=False) flags.AddPlatformAndLocationFlags(parser) flags.AddFunctionArg(parser) flags.AddMutexEnvVarsFlags(parser) flags.AddMemoryFlag(parser) flags.AddConcurrencyFlag(parser) flags.AddTimeoutFlag(parser) flags.AddAsyncFlag(parser) flags.AddLabelsFlags(parser) flags.AddGeneralAnnotationFlags(parser) flags.AddMinInstancesFlag(parser) flags.AddMaxInstancesFlag(parser) flags.AddCommandFlag(parser) flags.AddArgsFlag(parser) flags.AddPortFlag(parser) flags.AddCpuFlag(parser) flags.AddNoTrafficFlag(parser) flags.AddDeployTagFlag(parser) flags.AddServiceAccountFlag(parser) flags.AddClientNameAndVersionFlags(parser) flags.AddIngressFlag(parser) flags.AddHttp2Flag(parser) flags.AddSourceAndImageFlags(parser) flags.AddSecretsFlags(parser) concept_parsers.ConceptParser([service_presentation ]).AddToParser(parser) # No output by default, can be overridden by --format parser.display_info.AddFormat('none')
def Args(parser): service_presentation = presentation_specs.ResourcePresentationSpec( 'SERVICE', resource_args.GetServiceResourceSpec(prompt=True), 'Service to update the configuration of.', required=True, prefixes=False) flags.AddRegionArg(parser) flags.AddMutexEnvVarsFlags(parser) flags.AddMemoryFlag(parser) flags.AddConcurrencyFlag(parser) flags.AddTimeoutFlag(parser) flags.AddAsyncFlag(parser) concept_parsers.ConceptParser( [resource_args.CLUSTER_PRESENTATION, service_presentation]).AddToParser(parser)
def CommonArgs(parser): # Flags specific to managed CR managed_group = flags.GetManagedArgGroup(parser) flags.AddAllowUnauthenticatedFlag(managed_group) flags.AddCloudSQLFlags(managed_group) flags.AddRevisionSuffixArg(managed_group) flags.AddVpcConnectorArg(managed_group) # Flags specific to connecting to a cluster cluster_group = flags.GetClusterArgGroup(parser) flags.AddSecretsFlags(cluster_group) flags.AddConfigMapsFlags(cluster_group) flags.AddHttp2Flag(cluster_group) # Flags not specific to any platform service_presentation = presentation_specs.ResourcePresentationSpec( 'SERVICE', resource_args.GetServiceResourceSpec(prompt=True), 'Service to deploy to.', required=True, prefixes=False) flags.AddFunctionArg(parser) flags.AddMutexEnvVarsFlags(parser) flags.AddMemoryFlag(parser) flags.AddConcurrencyFlag(parser) flags.AddTimeoutFlag(parser) flags.AddAsyncFlag(parser) flags.AddLabelsFlags(parser) flags.AddMaxInstancesFlag(parser) flags.AddCommandFlag(parser) flags.AddArgsFlag(parser) flags.AddPortFlag(parser) flags.AddCpuFlag(parser) flags.AddNoTrafficFlag(parser) flags.AddServiceAccountFlag(parser) concept_parsers.ConceptParser([service_presentation ]).AddToParser(parser) # No output by default, can be overridden by --format parser.display_info.AddFormat('none')
def testVerifyOnePlatformFlagsTimeout(self): parser = argparse.ArgumentParser() flags.AddTimeoutFlag(parser) args = parser.parse_args(['--timeout', '1h'], parser_extensions.Namespace(timeout=None)) flags.VerifyOnePlatformFlags(args, self.track, flags.Product.RUN)
def testInvalidTimeoutArgError(self, timeout): parser = _TestArgumentParser() flags.AddTimeoutFlag(parser) with self.assertRaises(flags.ArgumentError): parser.parse_args(['--timeout', timeout], self.args) self._GetAndApplyChanges()