Пример #1
0
    def __init__(self, cloud=None):
        if cloud is None:
            self.cloud = "google"
        else:
            self.cloud = cloud

        config = Config()
        self.gcs_client = storage.Client.from_service_account_json(
            config.credentials('google_cloud')
            ['GOOGLE_CLOUD_CREDENTIALS_JSON'])
        localprovider = LocalProvider()
        self.dir = LocalProvider.create(localprovider, str(os.getcwd()),
                                        self.cloud + 'dump')
Пример #2
0
 def __init__(self, cloud):
     if cloud is None:
         self.cloud = "aws"
     else:
         self.cloud = cloud
     config = Config()
     credentials = config.credentials(cloud)
     self.session = boto3.Session(
         aws_access_key_id=credentials['S3_ACCESS_ID'],
         aws_secret_access_key=credentials['S3_SECRET_KEY'])
     self.s3 = self.session.resource('s3')
     localprovider = LocalProvider()
     self.dir = LocalProvider.create(localprovider, str(os.getcwd()),
                                     self.cloud + 'dump')
from google.cloud import storage
import os
import yaml
import logging

from cloudmesh_data.data.Config import Config

logging.basicConfig(filename='debug.log', level=logging.DEBUG)

with open('cloudmesh-data.yaml', 'r') as f:
    dataMap = yaml.safe_load(f)

#os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = dataMap['cloud']['data'['google_cloud']['credentials']['GOOGLE_CLOUD_CREDENTIALS_JSON']
config = Config()
gcs_client = storage.Client.from_service_account_json(
    config.credentials('google_cloud')['GOOGLE_CLOUD_CREDENTIALS_JSON'])
#storage_client = storage.Client()
# The name for the bucket

# print(bucket_name)