def AddInstanceCreateArgs(parser, api_version): """Add args for creating an instance.""" concept_parsers.ConceptParser([flags.GetInstancePresentationSpec( 'The instance to create.')]).AddToParser(parser) AddDescriptionArg(parser) messages = filestore_client.GetMessages(version=api_version) GetTierArg(messages).choice_arg.AddToParser(parser) AddAsyncFlag(parser, 'create') AddFileShareArg(parser) AddNetworkArg(parser) labels_util.AddCreateLabelsFlags(parser)
def GetUpdatedLabels(args, req, feature_name): """Return updated resource labels.""" labels_diff = labels_util.Diff.FromUpdateArgs(args) if labels_diff.MayHaveUpdates(): req = AddFieldToUpdateMask('labels', req) api_version = util.GetApiVersionFromArgs(args) messages = filestore_client.GetMessages(api_version) if feature_name == snapshot_feature_name: return labels_diff.Apply(messages.Snapshot.LabelsValue, req.snapshot.labels).GetOrNone() if feature_name == backup_feature_name: return labels_diff.Apply(messages.Backup.LabelsValue, req.backup.labels).GetOrNone() return None
def AddInstanceCreateArgs(parser, api_version): """Add args for creating an instance.""" concept_parsers.ConceptParser([flags.GetInstancePresentationSpec( 'The instance to create.')]).AddToParser(parser) AddDescriptionArg(parser) AddLocationArg(parser) messages = filestore_client.GetMessages(version=api_version) GetTierArg(messages).choice_arg.AddToParser(parser) AddAsyncFlag(parser) AddFileShareArg( parser, include_snapshot_flags=( api_version == filestore_client.ALPHA_API_VERSION), include_backup_flags=(api_version == filestore_client.ALPHA_API_VERSION)) AddNetworkArg(parser) labels_util.AddCreateLabelsFlags(parser)
def GetMessagesForResource(resource_ref): api_version = resource_ref.GetCollectionInfo().api_version messages = filestore_client.GetMessages(api_version) return messages
def GetTestCloudFilestoreInstance(): messages = filestore_client.GetMessages(filestore_client.ALPHA_API_VERSION) return messages.Instance(name='My Cloud Filestore Instance')
def GetTestCloudFilestoreInstancesList(): messages = filestore_client.GetMessages(filestore_client.ALPHA_API_VERSION) return [ messages.Instance(name='Instance1'), messages.Instance(name='Instance2'), ]