def Args(parser): """Register flags for this command.""" flags.AddSnapshotSchedulePolicyArgToParser(parser, positional=True) flags.AddSnapshotScheduleArgListToParser(parser, required=False) labels_util.AddUpdateLabelsFlags(parser) parser.add_argument('--description', help='Textual description of the policy.')
def Args(parser): resource_args.AddCertificateResourceArg(parser, 'to update') labels_util.AddUpdateLabelsFlags(parser) flags.AddDescriptionFlagToParser(parser, 'certificate') flags.AddSelfManagedCertificateDataFlagsToParser(parser, is_required=False) flags.AddAsyncFlagToParser(parser)
def Args(parser): parser.add_argument('id', metavar='JOB_ID', help='The ID of the job to describe.') changes = parser.add_argument_group(required=True) # Allow the user to specify new labels as well as update/remove existing labels_util.AddUpdateLabelsFlags(changes)
def Args(parser): flags.AddCryptoKeyArgument(parser, 'to update') flags.AddRotationPeriodFlag(parser) flags.AddNextRotationTimeFlag(parser) flags.AddRemoveRotationScheduleFlag(parser) flags.AddCryptoKeyPrimaryVersionFlag(parser, 'to make primary') labels_util.AddUpdateLabelsFlags(parser)
def Args(parser): """Register flags for this command.""" # Add args for function properties flags.AddFunctionNameArg(parser) flags.AddFunctionMemoryFlag(parser) flags.AddFunctionTimeoutFlag(parser) flags.AddFunctionRetryFlag(parser) args_labels_util.AddUpdateLabelsFlags( parser, extra_update_message=' ' + labels_util.NO_LABELS_STARTING_WITH_DEPLOY_MESSAGE, extra_remove_message=' ' + labels_util.NO_LABELS_STARTING_WITH_DEPLOY_MESSAGE) # Add args for specifying the function source code flags.AddSourceFlag(parser) flags.AddStageBucketFlag(parser) flags.AddEntryPointFlag(parser) # Add args for specifying the function trigger flags.AddTriggerFlagGroup(parser) flags.AddRegionFlag( parser, help_text='The region in which the function will run.', )
def testAddUpdateLabelsFlags(self): parser = argparse.ArgumentParser() labels_util.AddUpdateLabelsFlags(parser) args = parser.parse_args([ '--update-labels=key1=value1,key2=value2', '--remove-labels=key3,key4', ]) self.assertFalse(hasattr(args, 'labels')) self.assertTrue(hasattr(args, 'update_labels')) self.assertTrue(hasattr(args, 'remove_labels')) expected_update = { 'key1': 'value1', 'key2': 'value2', } actual_update = labels_util.GetUpdateLabelsDictFromArgs(args) self.assertEqual(expected_update, actual_update) expected_remove = [ 'key3', 'key4', ] actual_remove = labels_util.GetRemoveLabelsListFromArgs(args) self.assertEqual(expected_remove, actual_remove)
def _CommonArgs(parser, messages): flags.GetZoneResourceArg( 'The name of the managed-zone to be updated.').AddToParser(parser) flags.AddCommonManagedZonesDnssecArgs(parser, messages) flags.GetManagedZonesDescriptionArg().AddToParser(parser) labels_util.AddUpdateLabelsFlags(parser) flags.GetManagedZoneNetworksArg().AddToParser(parser)
def Args(cls, parser): resource_args.AddSubscriptionResourceArg(parser, 'to update.') flags.AddSubscriptionSettingsFlags(parser, cls.ReleaseTrack(), is_update=True) labels_util.AddUpdateLabelsFlags(parser)
def testClearAndRemoveLabelsNotAllowed(self): parser = argparse.ArgumentParser() labels_util.AddUpdateLabelsFlags(parser, enable_clear=True) with self.assertRaises(SystemExit): parser.parse_args('--remove-labels foo --clear-labels'.split()) with self.assertRaises(ValueError): labels_util.Diff(subtractions=['foo'], clear=True)
def Args(cls, parser): resource_args.AddSubscriptionResourceArg(parser, 'to update.') flags.AddSubscriptionSettingsFlags(parser, is_update=True, support_filtering=True, support_retry_policy=True) labels_util.AddUpdateLabelsFlags(parser)
def Args(parser): flags.GetDnsZoneArg( 'The name of the managed-zone to be updated..').AddToParser(parser) messages = apis.GetMessagesModule('dns', 'v1beta2') flags.AddCommonManagedZonesDnssecArgs(parser, messages) flags.GetManagedZonesDescriptionArg().AddToParser(parser) labels_util.AddUpdateLabelsFlags(parser)
def Args(parser): base.ASYNC_FLAG.AddToParser(parser) common_flags.AddDisplayNameArg(parser) labels_util.AddUpdateLabelsFlags(parser) resource_args.AddApiConfigResourceArg(parser, 'updated', positional=True)
def Args(parser): """Register flags for this command.""" flags.AddFunctionResourceArg(parser, 'to deploy') # Add args for function properties flags.AddFunctionMemoryFlag(parser) flags.AddFunctionTimeoutFlag(parser) flags.AddFunctionRetryFlag(parser) args_labels_util.AddUpdateLabelsFlags( parser, extra_update_message=labels_util. NO_LABELS_STARTING_WITH_DEPLOY_MESSAGE, extra_remove_message=labels_util. NO_LABELS_STARTING_WITH_DEPLOY_MESSAGE) flags.AddServiceAccountFlag(parser) # Add args for specifying the function source code flags.AddSourceFlag(parser) flags.AddStageBucketFlag(parser) flags.AddEntryPointFlag(parser) # Add args for specifying the function trigger flags.AddTriggerFlagGroup(parser) flags.AddRuntimeFlag(parser) # Add args for specifying environment variables env_vars_util.AddUpdateEnvVarsFlags(parser)
def Args(parser): """Registers flags for this command.""" resource_args.AddTopicResourceArg(parser, 'to update.') labels_util.AddUpdateLabelsFlags(parser) resource_args.AddResourceArgs(parser, [ kms_resource_args.GetKmsKeyPresentationSpec( 'topic', flag_overrides=_KMS_FLAG_OVERRIDES, permission_info=_KMS_PERMISSION_INFO) ]) flags.AddTopicMessageRetentionFlags(parser, is_update=True) msp_group = parser.add_group(mutex=True, help='Message storage policy options.') msp_group.add_argument( '--recompute-message-storage-policy', action='store_true', help= 'If given, Cloud Pub/Sub will recompute the regions where messages' ' can be stored at rest, based on your organization\'s "Resource ' ' Location Restriction" policy.') msp_group.add_argument( '--message-storage-policy-allowed-regions', metavar='REGION', type=arg_parsers.ArgList(), help= 'A list of one or more Cloud regions where messages are allowed to' ' be stored at rest.')
def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed. """ parser.add_argument( 'config', metavar='INSTANCE_CONFIG', completer=flags.InstanceConfigCompleter, help= 'Cloud Spanner instance config. The `custom-` prefix is required ' 'to avoid name conflicts with Google managed configurations.') parser.add_argument( '--display-name', help='The name of this instance configuration as it appears in UIs.' ) parser.add_argument('--etag', help='Used for optimistic concurrency control.') labels_util.AddUpdateLabelsFlags(parser) parser.add_argument( '--validate-only', action='store_true', default=False, help='Validate the update action, but don\'t actually perform it.')
def Args(parser): resource_args.AddCertificateAuthorityPositionalResourceArg( parser, 'to update') flags.AddPublishCrlFlag(parser, use_update_help_text=True) flags.AddPublishCaCertFlag(parser, use_update_help_text=True) flags.AddCertificateAuthorityIssuancePolicyFlag(parser) labels_util.AddUpdateLabelsFlags(parser)
def _CommonArgs(parser): """Register flags common to all tracks.""" base.ASYNC_FLAG.AddToParser(parser) # Allow the user to specify new labels as well as update/remove existing labels_util.AddUpdateLabelsFlags(parser) # Updates can take hours if a lot of data needs to be moved on HDFS flags.AddTimeoutFlag(parser, default='3h') parser.add_argument('name', help='The name of the cluster to update.') parser.add_argument('--num-workers', type=int, help='The new number of worker nodes in the cluster.') parser.add_argument( '--num-preemptible-workers', type=int, help='The new number of preemptible worker nodes in the cluster.') parser.add_argument('--graceful-decommission-timeout', type=arg_parsers.Duration(lower_bound='0s', upper_bound='1d'), help=""" The graceful decommission timeout for decommissioning Node Managers in the cluster, used when removing nodes. Graceful decommissioning allows removing nodes from the cluster without interrupting jobs in progress. Timeout specifies how long to wait for jobs in progress to finish before forcefully removing nodes (and potentially interrupting jobs). Timeout defaults to 0 if not set (for forceful decommission), and the maximum allowed timeout is 1 day. See $ gcloud topic datetimes for information on duration formats. """)
def Args(cls, parser): """Adds arguments to the supplied parser. Args: parser: The argparse parser to add arguments to. """ _EXTERNAL_VPN_GATEWAY_ARG.AddArgument(parser, operation_type='update') labels_util.AddUpdateLabelsFlags(parser)
def Args(cls, parser): cls.INTERCONNECT_ATTACHMENT_ARG = ( attachment_flags.InterconnectAttachmentArgument()) cls.INTERCONNECT_ATTACHMENT_ARG.AddArgument(parser, operation_type='patch') attachment_flags.AddDescription(parser) attachment_flags.AddAdminEnabled(parser, update=True) labels_util.AddUpdateLabelsFlags(parser)
def _AddArgs(parser): flags.AddEndpointResourceArg(parser, 'to update', prompt_func=region_util.PromptForOpRegion) flags.GetDisplayNameArg('endpoint', required=False).AddToParser(parser) flags.GetDescriptionArg('endpoint').AddToParser(parser) flags.AddTrafficSplitGroupArgs(parser) labels_util.AddUpdateLabelsFlags(parser)
def Args(parser): resource_args.AddKmsKeyResourceArgForKMS(parser, True, 'key') flags.AddRotationPeriodFlag(parser) flags.AddNextRotationTimeFlag(parser) flags.AddRemoveRotationScheduleFlag(parser) flags.AddCryptoKeyPrimaryVersionFlag(parser, 'to make primary') labels_util.AddUpdateLabelsFlags(parser) flags.AddDefaultAlgorithmFlag(parser)
def Args(parser): flags.GetProjectIDNumberFlag('update').AddToParser(parser) update_flags = parser.add_group(required=True) update_flags.add_argument('--name', help='New name for the project.') labels_group = update_flags.add_group('Labels Flags') labels_util.AddUpdateLabelsFlags(labels_group) parser.display_info.AddFormat(command_lib_util.LIST_FORMAT)
def AddInstanceUpdateArgs(parser): """Add args for updating an instance.""" concept_parsers.ConceptParser([flags.GetInstancePresentationSpec( 'The instance to update.')]).AddToParser(parser) AddDescriptionArg(parser) AddAsyncFlag(parser, 'update') labels_util.AddUpdateLabelsFlags(parser) AddFileShareArg(parser, required=False)
def Args(cls, parser): cls.INTERCONNECT_ATTACHMENT_ARG = ( attachment_flags.InterconnectAttachmentArgument()) cls.INTERCONNECT_ATTACHMENT_ARG.AddArgument(parser, operation_type='patch') attachment_flags.AddBandwidth(parser, required=False) attachment_flags.AddPartnerMetadata(parser, required=False) attachment_flags.AddDescription(parser) labels_util.AddUpdateLabelsFlags(parser)
def AddLabelsUpdateFlagsToGroup(update_type_group): """Adds flags related to updating environment labels. Args: update_type_group: argument group, the group to which flags should be added. """ labels_update_group = update_type_group.add_argument_group( LABELS_FLAG_GROUP_DESCRIPTION) labels_util.AddUpdateLabelsFlags(labels_update_group)
def Args(parser): """Registers flags for this command.""" resource_args.AddTopicResourceArg(parser, 'to update.') labels_util.AddUpdateLabelsFlags(parser) parser.add_argument( '--recompute-message-storage-policy', action='store_true', help='If given, Cloud Pub/Sub will recompute the regions where messages' " can be stored at rest based on your organization's policies.")
def Args(parser): secrets_args.AddSecret(parser, purpose='to update', positional=True, required=True) secrets_args.AddDataFile(parser) secrets_args.AddCreateIfMissing(parser, resource='secret') secrets_args.AddLocations(parser, resource='secret') labels_util.AddUpdateLabelsFlags(parser)
def Args(cls, parser): """Adds arguments to the supplied parser. Args: parser: The argparse parser to add arguments to. """ cls.VPN_TUNNEL_ARG = (vpn_tunnel_flags.VpnTunnelArgument()) cls.VPN_TUNNEL_ARG.AddArgument(parser) labels_util.AddUpdateLabelsFlags(parser)
def Args(parser): flags.INSTANCE_ARG.AddArgument(parser, operation_type='update') labels_util.AddUpdateLabelsFlags(parser) flags.AddMinCpuPlatformArgs(parser, UpdateAlpha.ReleaseTrack()) flags.AddDeletionProtectionFlag(parser, use_default_value=False) flags.AddShieldedVMConfigArgs(parser, use_default_value=False, for_update=True) flags.AddShieldedVMIntegrityPolicyArgs(parser)
def Args(cls, parser): """Adds arguments to the supplied parser. Args: parser: The argparse parser to add arguments to. """ cls.TARGET_VPN_GATEWAY_ARG = ( target_vpn_gateway_flags.TargetVpnGatewayArgument()) cls.TARGET_VPN_GATEWAY_ARG.AddArgument(parser) labels_util.AddUpdateLabelsFlags(parser)