(name=None,
                 image_uri=None,
                 commands=None,
                 entrypoint=None,
                 environment=None,
                 pid_namespace=None,
                 port_mappings=None,
                 mounts=None,
                 labels=None,
                 always_run=None,
                 enable_fuse=None,
                 run_in_background=None,
                 block_external_network=None)
return action
Build an Action object for a Pipeline request.

  Args:
    name (str): An optional name for the container.
    image_uri (str): The URI to pull the container image from.
    commands (List[str]): commands and arguments to run inside the container.
    entrypoint (str): overrides the ENTRYPOINT specified in the container.
    environment (dict[str,str]): The environment to pass into the container.
    pid_namespace (str): The PID namespace to run the action inside.
    port_mappings (dict[int, int]): A map of container to host port mappings for
      this container.
    mounts (List): A list of mounts to make available to the action.
    labels (dict[str]): Labels to associate with the action.
    always_run (bool): Action must run even if pipeline has already failed.
    enable_fuse (bool): Enable access to the FUSE device for this action.
    run_in_background (bool): Allow the action to run in the background.
    block_external_network (bool): Prevents the container from accessing the
      external network.

  Returns:
    An object representing an Action resource.
Build an Action object for a Pipeline request.
Build an Action object for a Pipeline request .
def build_action(name=None,
                 image_uri=None,
                 commands=None,
                 entrypoint=None,
                 environment=None,
                 pid_namespace=None,
                 port_mappings=None,
                 mounts=None,
                 labels=None,
                 always_run=None,
                 enable_fuse=None,
                 run_in_background=None,
                 block_external_network=None):
  """Build an Action object for a Pipeline request.

  Args:
    name (str): An optional name for the container.
    image_uri (str): The URI to pull the container image from.
    commands (List[str]): commands and arguments to run inside the container.
    entrypoint (str): overrides the ENTRYPOINT specified in the container.
    environment (dict[str,str]): The environment to pass into the container.
    pid_namespace (str): The PID namespace to run the action inside.
    port_mappings (dict[int, int]): A map of container to host port mappings for
      this container.
    mounts (List): A list of mounts to make available to the action.
    labels (dict[str]): Labels to associate with the action.
    always_run (bool): Action must run even if pipeline has already failed.
    enable_fuse (bool): Enable access to the FUSE device for this action.
    run_in_background (bool): Allow the action to run in the background.
    block_external_network (bool): Prevents the container from accessing the
      external network.

  Returns:
    An object representing an Action resource.
  """

  action = {
      'imageUri': image_uri,
      'commands': commands,
      'entrypoint': entrypoint,
      'environment': environment,
      'pidNamespace': pid_namespace,
      'portMappings': port_mappings,
      'mounts': mounts,
      'labels': labels,
  }

  if _API_VERSION == google_v2_versions.V2ALPHA1:
    action['name'] = name

    # In v2alpha1, the flags are passed as a list of strings
    flags = []
    if always_run:
      flags.append('ALWAYS_RUN')
    if enable_fuse:
      flags.append('ENABLE_FUSE')
    if run_in_background:
      flags.append('RUN_IN_BACKGROUND')
    if block_external_network:
      flags.append('BLOCK_EXTERNAL_NETWORK')

    if flags:
      action['flags'] = flags

  elif _API_VERSION == google_v2_versions.V2BETA:
    action['containerName'] = name

    # In v2beta, the flags are direct members of the action
    action['alwaysRun'] = always_run
    action['enableFuse'] = enable_fuse
    action['runInBackground'] = run_in_background
    action['blockExternalNetwork'] = block_external_network

  else:
    assert False, 'Unexpected version: {}'.format(_API_VERSION)

  return action
def build_action ( name = None , image_uri = None , commands = None , entrypoint = None , environment = None , pid_namespace = None , port_mappings = None , mounts = None , labels = None , always_run = None , enable_fuse = None , run_in_background = None , block_external_network = None ) : action = { 'imageUri' : image_uri , 'commands' : commands , 'entrypoint' : entrypoint , 'environment' : environment , 'pidNamespace' : pid_namespace , 'portMappings' : port_mappings , 'mounts' : mounts , 'labels' : labels , } if _API_VERSION == google_v2_versions . V2ALPHA1 : action [ 'name' ] = name # In v2alpha1, the flags are passed as a list of strings flags = [ ] if always_run : flags . append ( 'ALWAYS_RUN' ) if enable_fuse : flags . append ( 'ENABLE_FUSE' ) if run_in_background : flags . append ( 'RUN_IN_BACKGROUND' ) if block_external_network : flags . append ( 'BLOCK_EXTERNAL_NETWORK' ) if flags : action [ 'flags' ] = flags elif _API_VERSION == google_v2_versions . V2BETA : action [ 'containerName' ] = name # In v2beta, the flags are direct members of the action action [ 'alwaysRun' ] = always_run action [ 'enableFuse' ] = enable_fuse action [ 'runInBackground' ] = run_in_background action [ 'blockExternalNetwork' ] = block_external_network else : assert False , 'Unexpected version: {}' . format ( _API_VERSION ) return action