Example #1
0
def AddDefaultParentInfoToAssetTypeRequests(ref, args, req):
  """Python hook for yaml commands to wildcard the location in asset type requests."""
  del ref  # Unused
  project = utils.GetProject()
  location = utils.GetLocation(args)
  req.parent = utils.GetParentTemplate(project, location)
  return req
def AddParentInfoToAssetRequests(ref, args, req):
    """Python hook for yaml commands to wildcard the parent parameter in asset requests."""
    del ref  # Unused
    project = utils.GetProject()
    location = utils.GetLocation(args)
    req.parent = utils.GetAssetTypeParentTemplate(project, location,
                                                  args.asset_type)
    return req
def ProcessOutput(response, args):
  """Wait for operations to finish and return the resource."""
  api_version = utils.GetApiVersionFromArgs(args)
  utils.WaitForOperation(response, api_version)

  project = utils.GetProject()
  location = utils.GetLocation(args)
  resource_ref = resources.REGISTRY.Create(
      'mediaasset.projects.locations.transformers',
      projectsId=project,
      locationsId=location,
      transformersId=args.transformer)

  if 'delete' in args.command_path:
    # No need to send another get request to check for the deleted complex type.
    return response
  request_message = utils.GetApiMessage(
      api_version).MediaassetProjectsLocationsTransformersGetRequest(
          name=resource_ref.RelativeName())

  return GetExistingResource(api_version, request_message)