| | | 1 | | // Copyright (c) Microsoft and contributors. All rights reserved. |
| | | 2 | | // |
| | | 3 | | // Licensed under the Apache License, Version 2.0 (the "License"); |
| | | 4 | | // you may not use this file except in compliance with the License. |
| | | 5 | | // You may obtain a copy of the License at |
| | | 6 | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | 7 | | // |
| | | 8 | | // Unless required by applicable law or agreed to in writing, software |
| | | 9 | | // distributed under the License is distributed on an "AS IS" BASIS, |
| | | 10 | | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | 11 | | // |
| | | 12 | | // See the License for the specific language governing permissions and |
| | | 13 | | // limitations under the License. |
| | | 14 | | |
| | | 15 | | using System; |
| | | 16 | | using System.Collections.Generic; |
| | | 17 | | using System.Linq; |
| | | 18 | | using System.Text; |
| | | 19 | | using System.Threading.Tasks; |
| | | 20 | | |
| | | 21 | | namespace Microsoft.Azure.Batch.FileStaging |
| | | 22 | | { |
| | | 23 | | /// <summary> |
| | | 24 | | /// Holds storage account information. |
| | | 25 | | /// </summary> |
| | | 26 | | public class StagingStorageAccount |
| | | 27 | | { |
| | | 28 | | /// <summary> |
| | | 29 | | /// Specifies the storage account to be used. |
| | | 30 | | /// </summary> |
| | | 31 | | public string StorageAccount |
| | | 32 | | { |
| | 3 | 33 | | get; |
| | 3 | 34 | | internal set; |
| | | 35 | | } |
| | | 36 | | |
| | | 37 | | /// <summary> |
| | | 38 | | /// Specifies the storage account key to be used. |
| | | 39 | | /// </summary> |
| | | 40 | | public string StorageAccountKey |
| | | 41 | | { |
| | 2 | 42 | | get; |
| | 3 | 43 | | internal set; |
| | | 44 | | } |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// The serviced endpoint for blob storage. |
| | | 48 | | /// </summary> |
| | | 49 | | public string BlobEndpoint |
| | | 50 | | { |
| | 0 | 51 | | get; |
| | 0 | 52 | | internal set; |
| | | 53 | | } |
| | | 54 | | |
| | | 55 | | // Constructed here to give immediate validation/failure experience. |
| | | 56 | | internal Uri BlobUri |
| | | 57 | | { |
| | 0 | 58 | | get; |
| | 0 | 59 | | set; |
| | | 60 | | } |
| | | 61 | | |
| | 0 | 62 | | private StagingStorageAccount() |
| | | 63 | | { |
| | 0 | 64 | | } |
| | | 65 | | |
| | | 66 | | /// <summary> |
| | | 67 | | /// Initializes a new instance of the StagingStorageAccount class using the specified credentials and service en |
| | | 68 | | /// </summary> |
| | | 69 | | /// <param name="storageAccount">A string specifying the storage account to be used.</param> |
| | | 70 | | /// <param name="storageAccountKey">A string specifying the storage account key to be used.</param> |
| | | 71 | | /// <param name="blobEndpoint">A string specifying the primary Blob service endpoint.</param> |
| | 3 | 72 | | public StagingStorageAccount(string storageAccount, string storageAccountKey, string blobEndpoint) |
| | | 73 | | { |
| | 3 | 74 | | this.StorageAccount = storageAccount; |
| | 3 | 75 | | this.StorageAccountKey = storageAccountKey; |
| | | 76 | | |
| | 3 | 77 | | if (string.IsNullOrWhiteSpace(this.StorageAccount)) |
| | | 78 | | { |
| | 1 | 79 | | throw new ArgumentOutOfRangeException("storageAccount"); |
| | | 80 | | } |
| | | 81 | | |
| | 2 | 82 | | if (string.IsNullOrWhiteSpace(this.StorageAccountKey)) |
| | | 83 | | { |
| | 1 | 84 | | throw new ArgumentOutOfRangeException("storageAccountKey"); |
| | | 85 | | } |
| | | 86 | | |
| | 1 | 87 | | if (string.IsNullOrWhiteSpace(blobEndpoint)) |
| | | 88 | | { |
| | 1 | 89 | | throw new ArgumentOutOfRangeException("blobEndpoint"); |
| | | 90 | | } |
| | | 91 | | |
| | | 92 | | // Constructed here to give immediate validation/failure experience. |
| | 0 | 93 | | this.BlobUri = new Uri(blobEndpoint); |
| | 0 | 94 | | } |
| | | 95 | | } |
| | | 96 | | } |