def _upload_single_part(storage, connection, src, bucket, object_name): _ = connection.upload_object(str(src), container=bucket, object_name=object_name) # Returning object from upload doesn't have md5_hash property # That's why we need to retrieve it again. blob = AzCli(storage).get_blob(object_name) return blob
def check_dependencies(self): az_cli_path = AzCli.find_az_cli() try: subprocess.check_call([az_cli_path, "help"], stdout=PIPE, stderr=PIPE) except Exception: raise RuntimeError( "Azure cli doesn't seem to be installed on this system and is a " + "required dependency for the Azure backend. " + "Please check https://docs.microsoft.com/en-us/cli/azure/install-azure-cli for guidelines." )
def _download_multi_part(storage, connection, src, bucket, blob_dest): with AzCli(storage) as azcli: azcli.cp_download(src=src, bucket_name=bucket.name, dest=blob_dest)
def _upload_multi_part(storage, connection, src, bucket, object_name): with AzCli(storage) as azcli: objects = azcli.cp_upload(srcs=[src], bucket_name=bucket.name, dest=object_name) return objects[0]