/// <summary> /// Initialize a new instance of the ObjectStorageFileInfo class for the specified ObjectStorage bucket and ObjectStorage object key. /// </summary> /// <param name="client"></param> /// <param name="namespaceName"></param> /// <param name="bucket"></param> /// <param name="key"></param> public ObjectStorageFileInfo(IObjectStorageClient client, string namespaceName, string bucket, string key) { this.client = client ?? throw new ArgumentNullException("client"); if (string.IsNullOrEmpty(namespaceName)) { throw new ArgumentNullException("namespaceName"); } if (string.IsNullOrEmpty(bucket)) { throw new ArgumentNullException("bucket"); } if (string.IsNullOrEmpty(key) || string.Equals(key, "\\")) { throw new ArgumentNullException("key"); } if (key.EndsWith("\\", StringComparison.Ordinal)) { throw new ArgumentException("key is a directory name"); } this.namespaceName = namespaceName; this.bucket = bucket; this.key = key; }
/// <summary> /// constructor /// </summary> /// <param name="client">client</param> /// <param name="namespaceName">namespace name</param> /// <param name="bucket">bucket name</param> /// <param name="key"></param> public ObjectStorageDirectoryInfo(IObjectStorageClient client, string namespaceName, string bucket, string key) { Client = client ?? throw new ArgumentNullException("client"); if (String.IsNullOrEmpty(bucket) && !String.IsNullOrEmpty(key)) { throw new ArgumentException("key cannot be specified if bucket isn't"); } NamespaceName = namespaceName ?? throw new ArgumentNullException("namespaceName"); BucketName = bucket ?? String.Empty; ObjectKey = key ?? String.Empty; if (string.IsNullOrEmpty(key)) { ObjectKey = string.Empty; } else { var searchKey = key; if (searchKey[0] == '/') { searchKey = searchKey.Remove(0, 1); } ObjectKey = searchKey; } }
/// <summary> /// クライアント作成 /// </summary> public void CreateClient() { ClientConfig = new ClientConfig { TenancyId = OciSetting.TenancyId, UserId = OciSetting.UserId, Fingerprint = OciSetting.Fingerprint, PrivateKey = OciSetting.KeyFilePath, PrivateKeyPassphrase = OciSetting.PassPhrase }; ThreadSafeSigner threadSafeSigner = new ThreadSafeSigner(new OciSigner(ClientConfig)); IdentityClient = new IdentityClient(ClientConfig); ObjectStorageClient = new ObjectStorageClient(ClientConfig, threadSafeSigner); }
public static void ClassInitialize(TestContext testContext) { ClientConfig clientConfig = new ClientConfig { TenancyId = TenantOCID, UserId = UserOCID, Fingerprint = Fingerprint, PrivateKey = KeyFilePath, Password = PassPhrase, PrivateKeyPassphrase = PassPhrase }; var signer = new ThreadSafeSigner(new OciSigner(clientConfig)); ObjectStorageClient objectStorageClient = new ObjectStorageClient(clientConfig, signer) { Region = Region }; ObjectStorageClient = objectStorageClient; NameSpaceName = ObjectStorageClient.GetNamespace(new GetNamespaceRequest()); }
public static void ClassInitialize(TestContext testContext) { foreach (var dir in TestFileInfos.Keys) { foreach (var fileName in TestFileInfos[dir]) { if (string.IsNullOrEmpty(dir)) { TestFileRemotePaths.Add(fileName); } else { TestFileRemotePaths.Add($"{dir}/{fileName}"); } } } ClientConfig clientConfig = new ClientConfig { TenancyId = TenantOCID, UserId = UserOCID, Fingerprint = Fingerprint, PrivateKey = KeyFilePath, Password = PassPhrase, PrivateKeyPassphrase = PassPhrase }; var signer = new ThreadSafeSigner(new OciSigner(clientConfig)); ObjectStorageClient objectStorageClient = new ObjectStorageClient(clientConfig, signer) { Region = Region }; ObjectStorageClient = objectStorageClient; NameSpaceName = ObjectStorageClient.GetNamespace(new GetNamespaceRequest()); }
/// <summary> /// Constructer /// </summary> public GeneralElemenClient(ClientConfigStream config, OciSigner ociSigner) : base(config, ociSigner) { IdentityClient = new IdentityClient(config, ociSigner); ObjectStorageClient = new ObjectStorageClient(config, ociSigner); }
/// <summary> /// Constructer /// </summary> public GeneralElemenClient(ClientConfigStream config) : base(config) { IdentityClient = new IdentityClient(config); ObjectStorageClient = new ObjectStorageClient(config); }
/// <summary> /// constructor /// </summary> /// <param name="clinet">client</param> /// <param name="namespaceName">namespace name</param> /// <param name="bucket">bucket name</param> public ObjectStorageDirectoryInfo(IObjectStorageClient clinet, string namespaceName, string bucket) : this(clinet, namespaceName, bucket, null) { }
public static void ClassInitialize(TestContext testContext) { ClientConfig clientConfig = new ClientConfig { TenancyId = TenantOCID, UserId = UserOCID, Fingerprint = Fingerprint, PrivateKey = KeyFilePath, Password = PassPhrase, PrivateKeyPassphrase = PassPhrase }; GeneralElemenClient = new GeneralElemenClient(clientConfig); ObjectStorageClient = new ObjectStorageClient(clientConfig) { Region = Regions.US_ASHBURN_1 }; NameSpaceName = ObjectStorageClient.GetNamespace(new GetNamespaceRequest()); // テスト用バケットの作成 // Ashburnのみ CreateBucketRequest createBucketRequest = new CreateBucketRequest { NamespaceName = NameSpaceName, CreateBucketDetails = new OCISDK.ObjectStorage.Model.CreateBucketDetails { Name = TestBucketNameA, CompartmentId = TargetCompartmentOCID, } }; try { ObjectStorageClient.CreateBucket(createBucketRequest); } catch { Trace.WriteLine("create failed test bucket"); } // Tokyo, Osaka複数作成 createBucketRequest.CreateBucketDetails.Name = TestBucketNameB; ObjectStorageClient.SetRegion(Regions.AP_TOKYO_1); try { ObjectStorageClient.CreateBucket(createBucketRequest); } catch { Trace.WriteLine("create failed test bucket. region=ap-tokyo-1"); } ObjectStorageClient.SetRegion(Regions.AP_OSAKA_1); try { ObjectStorageClient.CreateBucket(createBucketRequest); } catch { Trace.WriteLine("create failed test bucket. region=ap-osaka-1"); } }
public ObjectStorageClientTest() { var secrets = new SecretsProvider().Get(); client = new ObjectStorageClient(secrets.AccessKeyId, secrets.AccessKey); }