def Run(self, args): project = properties.VALUES.core.project.Get(required=True) input_url_ref = resources.REGISTRY.Parse( args.input_url, collection='storage.objects') response = admin_api.Import( project, 'gs://{}/{}'.format(input_url_ref.bucket, input_url_ref.object), kinds=args.kinds, namespaces=args.namespaces, labels=args.operation_labels) if not args.async: operations.WaitForOperation(response) return response
def Run(self, args): project = properties.VALUES.core.project.Get(required=True) destination = self._ParseGCSObjectPrefix(args.output_url_prefix) response = admin_api.Export( project, # use join and filter to avoid trailing '/'. 'gs://{}'.format('/'.join( [part for part in destination if part is not None])), kinds=args.kinds, namespaces=args.namespaces, labels=args.operation_labels) if not args. async: operations.WaitForOperation(response) return response