parameters: (src_obj_metadata, dst_obj_metadata, override=False)
docstring: Copies metadata from src_obj_metadata to dst_obj_metadata.
  
    Args:
      src_obj_metadata: Metadata from source object
      dst_obj_metadata: Initialized metadata for destination object
      override: If true, will overwrite metadata in destination object.
                If false, only writes metadata for values that don't already
                exist.
docstring_summary: Copies metadata from src_obj_metadata to dst_obj_metadata.
docstring_tokens: Copies metadata from src_obj_metadata to dst_obj_metadata .
function: def CopyObjectMetadata(src_obj_metadata, dst_obj_metadata, override=False):
    """Copies metadata from src_obj_metadata to dst_obj_metadata.
  
    Args:
      src_obj_metadata: Metadata from source object
      dst_obj_metadata: Initialized metadata for destination object
      override: If true, will overwrite metadata in destination object.
                If false, only writes metadata for values that don't already
                exist.
    """
    if override or not dst_obj_metadata.cacheControl:
      dst_obj_metadata.cacheControl = src_obj_metadata.cacheControl
    if override or not dst_obj_metadata.contentDisposition:
      dst_obj_metadata.contentDisposition = src_obj_metadata.contentDisposition
    if override or not dst_obj_metadata.contentEncoding:
      dst_obj_metadata.contentEncoding = src_obj_metadata.contentEncoding
    if override or not dst_obj_metadata.contentLanguage:
      dst_obj_metadata.contentLanguage = src_obj_metadata.contentLanguage
    if override or not dst_obj_metadata.contentType:
      dst_obj_metadata.contentType = src_obj_metadata.contentType
    if override or not dst_obj_metadata.md5Hash:
      dst_obj_metadata.md5Hash = src_obj_metadata.md5Hash
  
    # TODO: Apitools should ideally treat metadata like a real dictionary instead
    # of a list of key/value pairs (with an O(N^2) lookup).  In practice the
    # number of values is typically small enough not to matter.
    # Work around this by creating our own dictionary.
    if (src_obj_metadata.metadata and
        src_obj_metadata.metadata.additionalProperties):
      if not dst_obj_metadata.metadata:
        dst_obj_metadata.metadata = apitools_messages.Object.MetadataValue()
      if not dst_obj_metadata.metadata.additionalProperties:
        dst_obj_metadata.metadata.additionalProperties = []
      dst_metadata_dict = {}
      for dst_prop in dst_obj_metadata.metadata.additionalProperties:
        dst_metadata_dict[dst_prop.key] = dst_prop.value
      for src_prop in src_obj_metadata.metadata.additionalProperties:
        if src_prop.key in dst_metadata_dict:
          if override:
            # Metadata values of '' mean suppress/remove this header.
            if src_prop.value is not None and not src_prop.value:
              dst_metadata_dict[src_prop.key] = None
            else:
              dst_metadata_dict[src_prop.key] = src_prop.value
        else:
          dst_metadata_dict[src_prop.key] = src_prop.value
      # Rewrite the list with our updated dict.
      dst_obj_metadata.metadata.additionalProperties = []
      for k, v in dst_metadata_dict.iteritems():
        dst_obj_metadata.metadata.additionalProperties.append(
            apitools_messages.Object.MetadataValue.AdditionalProperty(key=k,
                                                                      value=v))
function_tokens: def CopyObjectMetadata ( src_obj_metadata , dst_obj_metadata , override = False ) : if override or not dst_obj_metadata . cacheControl : dst_obj_metadata . cacheControl = src_obj_metadata . cacheControl if override or not dst_obj_metadata . contentDisposition : dst_obj_metadata . contentDisposition = src_obj_metadata . contentDisposition if override or not dst_obj_metadata . contentEncoding : dst_obj_metadata . contentEncoding = src_obj_metadata . contentEncoding if override or not dst_obj_metadata . contentLanguage : dst_obj_metadata . contentLanguage = src_obj_metadata . contentLanguage if override or not dst_obj_metadata . contentType : dst_obj_metadata . contentType = src_obj_metadata . contentType if override or not dst_obj_metadata . md5Hash : dst_obj_metadata . md5Hash = src_obj_metadata . md5Hash # TODO: Apitools should ideally treat metadata like a real dictionary instead # of a list of key/value pairs (with an O(N^2) lookup).  In practice the # number of values is typically small enough not to matter. # Work around this by creating our own dictionary. if ( src_obj_metadata . metadata and src_obj_metadata . metadata . additionalProperties ) : if not dst_obj_metadata . metadata : dst_obj_metadata . metadata = apitools_messages . Object . MetadataValue ( ) if not dst_obj_metadata . metadata . additionalProperties : dst_obj_metadata . metadata . additionalProperties = [ ] dst_metadata_dict = { } for dst_prop in dst_obj_metadata . metadata . additionalProperties : dst_metadata_dict [ dst_prop . key ] = dst_prop . value for src_prop in src_obj_metadata . metadata . additionalProperties : if src_prop . key in dst_metadata_dict : if override : # Metadata values of '' mean suppress/remove this header. if src_prop . value is not None and not src_prop . value : dst_metadata_dict [ src_prop . key ] = None else : dst_metadata_dict [ src_prop . key ] = src_prop . value else : dst_metadata_dict [ src_prop . key ] = src_prop . value # Rewrite the list with our updated dict. dst_obj_metadata . metadata . additionalProperties = [ ] for k , v in dst_metadata_dict . iteritems ( ) : dst_obj_metadata . metadata . additionalProperties . append ( apitools_messages . Object . MetadataValue . AdditionalProperty ( key = k , value = v ) )