class_docstr: Contains static methods for uploading directories or files to S3.
class_docstr_tok: ["Contains","static","methods","for","uploading","directories","or","files","to","S3","."]
docstr: Static method that uploads a given file or directory to S3.
  
  Args:
      local_path (str): Path (absolute or relative) of local file or directory to upload.
      desired_s3_uri (str): The desired S3 location to upload to. It is the prefix to
          which the local filename will be added.
      kms_key (str): The KMS key to use to encrypt the files.
      sagemaker_session (sagemaker.session.Session): Session object which
          manages interactions with Amazon SageMaker APIs and any other
          AWS services needed. If not specified, one is created
          using the default AWS configuration chain.
  
  Returns:
      The S3 uri of the uploaded file(s).
docstr_tok: ["Static","method","that","uploads","a","given","file","or","directory","to","S3",".","Args",":","local_path","(","str",")",":","Path","(","absolute","or","relative",")","of","local","file","or","directory","to","upload",".","desired_s3_uri","(","str",")",":","The","desired","S3","location","to","upload","to",".","It","is","the","prefix","to","which","the","local","filename","will","be","added",".","kms_key","(","str",")",":","The","KMS","key","to","use","to","encrypt","the","files",".","sagemaker_session","(","sagemaker.session.Session",")",":","Session","object","which","manages","interactions","with","Amazon","SageMaker","APIs","and","any","other","AWS","services","needed",".","If","not","specified",",","one","is","created","using","the","default","AWS","configuration","chain",".","Returns",":","The","S3","uri","of","the","uploaded","file","(","s",")","."]
code: def upload(
      local_path,
      desired_s3_uri,
      kms_key=None,
      sagemaker_session=None,
      callback=None,
  ):
      """Static method that uploads a given file or directory to S3.
  
      Args:
          local_path (str): Path (absolute or relative) of local file or directory to upload.
          desired_s3_uri (str): The desired S3 location to upload to. It is the prefix to
              which the local filename will be added.
          kms_key (str): The KMS key to use to encrypt the files.
          sagemaker_session (sagemaker.session.Session): Session object which
              manages interactions with Amazon SageMaker APIs and any other
              AWS services needed. If not specified, one is created
              using the default AWS configuration chain.
  
      Returns:
          The S3 uri of the uploaded file(s).
  
      """
      sagemaker_session = sagemaker_session or Session()
      bucket, key_prefix = parse_s3_url(url=desired_s3_uri)
      if kms_key is not None:
          extra_args = {
              "SSEKMSKeyId": kms_key,
              "ServerSideEncryption": "aws:kms",
          }
  
      else:
          extra_args = None
  
      return sagemaker_session.upload_data(
          path=local_path,
          bucket=bucket,
          key_prefix=key_prefix,
          callback=callback,
          extra_args=extra_args,
      )
  
file_path: sagemaker-python-sdk/src/sagemaker/s3.py
imports: from __future__ import print_function, absolute_import
  import logging
  import io
  from typing import Union
  from sagemaker.session import Session
  from sagemaker.s3_utils import parse_s3_url, s3_path_join, determine_bucket_and_prefix
label_desc: Use image node_id 1 for calling the S3Uploader obj's underlying member method code with example usage: obj.upload(local_path, desired_s3_uri, kms_key, sagemaker_session, callback) and returns: sagemaker_session