Пример #1
0
def ParseComplexTypeConfigFile(ref, args, req):
    """Reads the json with complex type configuration and set the content in the request."""
    del ref
    complex_type_dict = []
    if args.complex_type_config_file:
        complex_type_dict = json.loads(args.complex_type_config_file)
        messages = utils.GetApiMessage(utils.GetApiVersionFromArgs(args))
        ct = encoding.DictToMessage(complex_type_dict, messages.ComplexType)
        utils.ValidateMediaAssetMessage(ct)
        req.complexType = ct
    if 'update' in args.command_path:
        ValidateUpdateMask(args, complex_type_dict)
    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)