コード例 #1
0
 ///GENMHASH:C6CC40946571810DF92A3D04D369CBCD:391ADF63D3B3B254E14435035F093D3D
 public StorageAccountImpl WithCustomDomain(CustomDomain customDomain)
 {
     if (IsInCreateMode)
     {
         createParameters.CustomDomain = customDomain;
     }
     else
     {
         updateParameters.CustomDomain = customDomain;
     }
     return(this);
 }
コード例 #2
0
        public ActionResult RemoveDomain(FormCollection _POST)
        {
            try
            {
                CustomDomain RemoveDomain = new CustomDomain()
                {
                    Organization  = _POST["organization"],
                    Domain        = _POST["domainname"],
                    RemoveasEmail = _POST["removeasemail"] == "on" ? true : false
                };

                model.Domain = RemoveDomain;

                CommonCAS.Log(string.Format("has run Organization/RemoveDomain() for organization {0} to Remove domain {1}", RemoveDomain.Organization, RemoveDomain.Domain));

                // execute powershell script and dispose powershell object
                using (MyPowerShell ps = new MyPowerShell())
                {
                    ps.RemoveDomain(RemoveDomain.Organization, RemoveDomain.Domain, RemoveDomain.RemoveasEmail);
                    var result = ps.Invoke();

                    if (result.Count() == 0)
                    {
                        model.OKMessage.Add(string.Format("'{0}' Removed for organization '{1}'.", model.Domain.Domain, model.Domain.Organization));
                    }
                    else
                    {
                        model.OKMessage.Add(string.Format("Domain {0} has been removed with following info:", RemoveDomain.Domain));

                        foreach (PSObject message in result)
                        {
                            model.OKMessage.Add(message.ToString());
                            CommonCAS.Log(string.Format("Domain {0} info: {1}", RemoveDomain.Domain, message.ToString()));
                        }
                    }
                }

                CommonCAS.Stats("Organization/RemoveDomain");

                return(View("RemoveDomain", model));
            }
            catch (Exception exc)
            {
                CommonCAS.Log("Exception: " + exc.Message);
                model.ActionFailed = true;
                model.Message      = exc.Message;
                return(View(model));
            }
        }
コード例 #3
0
 internal StorageAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, StorageSku sku, StorageKind?kind, ManagedServiceIdentity identity, ExtendedLocation extendedLocation, ProvisioningState?provisioningState, Endpoints primaryEndpoints, string primaryLocation, AccountStatus?statusOfPrimary, DateTimeOffset?lastGeoFailoverOn, string secondaryLocation, AccountStatus?statusOfSecondary, DateTimeOffset?creationOn, CustomDomain customDomain, SasPolicy sasPolicy, KeyPolicy keyPolicy, KeyCreationTime keyCreationTime, Endpoints secondaryEndpoints, Encryption encryption, AccessTier?accessTier, AzureFilesIdentityBasedAuthentication azureFilesIdentityBasedAuthentication, bool?enableHttpsTrafficOnly, NetworkRuleSet networkRuleSet, bool?isSftpEnabled, bool?isLocalUserEnabled, bool?isHnsEnabled, GeoReplicationStats geoReplicationStats, bool?failoverInProgress, LargeFileSharesState?largeFileSharesState, IReadOnlyList <StoragePrivateEndpointConnectionData> privateEndpointConnections, RoutingPreference routingPreference, BlobRestoreStatus blobRestoreStatus, bool?allowBlobPublicAccess, MinimumTlsVersion?minimumTlsVersion, bool?allowSharedKeyAccess, bool?enableNfsV3, bool?allowCrossTenantReplication, bool?defaultToOAuthAuthentication, PublicNetworkAccess?publicNetworkAccess, ImmutableStorageAccount immutableStorageWithVersioning, AllowedCopyScope?allowedCopyScope, StorageAccountSkuConversionStatus storageAccountSkuConversionStatus, DnsEndpointType?dnsEndpointType) : base(id, name, resourceType, systemData, tags, location)
 {
     Sku                = sku;
     Kind               = kind;
     Identity           = identity;
     ExtendedLocation   = extendedLocation;
     ProvisioningState  = provisioningState;
     PrimaryEndpoints   = primaryEndpoints;
     PrimaryLocation    = primaryLocation;
     StatusOfPrimary    = statusOfPrimary;
     LastGeoFailoverOn  = lastGeoFailoverOn;
     SecondaryLocation  = secondaryLocation;
     StatusOfSecondary  = statusOfSecondary;
     CreationOn         = creationOn;
     CustomDomain       = customDomain;
     SasPolicy          = sasPolicy;
     KeyPolicy          = keyPolicy;
     KeyCreationTime    = keyCreationTime;
     SecondaryEndpoints = secondaryEndpoints;
     Encryption         = encryption;
     AccessTier         = accessTier;
     AzureFilesIdentityBasedAuthentication = azureFilesIdentityBasedAuthentication;
     EnableHttpsTrafficOnly     = enableHttpsTrafficOnly;
     NetworkRuleSet             = networkRuleSet;
     IsSftpEnabled              = isSftpEnabled;
     IsLocalUserEnabled         = isLocalUserEnabled;
     IsHnsEnabled               = isHnsEnabled;
     GeoReplicationStats        = geoReplicationStats;
     FailoverInProgress         = failoverInProgress;
     LargeFileSharesState       = largeFileSharesState;
     PrivateEndpointConnections = privateEndpointConnections;
     RoutingPreference          = routingPreference;
     BlobRestoreStatus          = blobRestoreStatus;
     AllowBlobPublicAccess      = allowBlobPublicAccess;
     MinimumTlsVersion          = minimumTlsVersion;
     AllowSharedKeyAccess       = allowSharedKeyAccess;
     EnableNfsV3 = enableNfsV3;
     AllowCrossTenantReplication    = allowCrossTenantReplication;
     DefaultToOAuthAuthentication   = defaultToOAuthAuthentication;
     PublicNetworkAccess            = publicNetworkAccess;
     ImmutableStorageWithVersioning = immutableStorageWithVersioning;
     AllowedCopyScope = allowedCopyScope;
     StorageAccountSkuConversionStatus = storageAccountSkuConversionStatus;
     DnsEndpointType = dnsEndpointType;
 }
コード例 #4
0
 internal StorageAccountData(ResourceIdentifier id, string name, ResourceType type, IDictionary <string, string> tags, Location location, Models.Sku sku, Kind?kind, Identity identity, ExtendedLocation extendedLocation, ProvisioningState?provisioningState, Endpoints primaryEndpoints, string primaryLocation, AccountStatus?statusOfPrimary, DateTimeOffset?lastGeoFailoverTime, string secondaryLocation, AccountStatus?statusOfSecondary, DateTimeOffset?creationTime, CustomDomain customDomain, SasPolicy sasPolicy, KeyPolicy keyPolicy, KeyCreationTime keyCreationTime, Endpoints secondaryEndpoints, Encryption encryption, AccessTier?accessTier, AzureFilesIdentityBasedAuthentication azureFilesIdentityBasedAuthentication, bool?enableHttpsTrafficOnly, NetworkRuleSet networkRuleSet, bool?isHnsEnabled, GeoReplicationStats geoReplicationStats, bool?failoverInProgress, LargeFileSharesState?largeFileSharesState, IReadOnlyList <PrivateEndpointConnectionData> privateEndpointConnections, RoutingPreference routingPreference, BlobRestoreStatus blobRestoreStatus, bool?allowBlobPublicAccess, MinimumTlsVersion?minimumTlsVersion, bool?allowSharedKeyAccess, bool?enableNfsV3, bool?allowCrossTenantReplication) : base(id, name, type, tags, location)
 {
     Sku                 = sku;
     Kind                = kind;
     Identity            = identity;
     ExtendedLocation    = extendedLocation;
     ProvisioningState   = provisioningState;
     PrimaryEndpoints    = primaryEndpoints;
     PrimaryLocation     = primaryLocation;
     StatusOfPrimary     = statusOfPrimary;
     LastGeoFailoverTime = lastGeoFailoverTime;
     SecondaryLocation   = secondaryLocation;
     StatusOfSecondary   = statusOfSecondary;
     CreationTime        = creationTime;
     CustomDomain        = customDomain;
     SasPolicy           = sasPolicy;
     KeyPolicy           = keyPolicy;
     KeyCreationTime     = keyCreationTime;
     SecondaryEndpoints  = secondaryEndpoints;
     Encryption          = encryption;
     AccessTier          = accessTier;
     AzureFilesIdentityBasedAuthentication = azureFilesIdentityBasedAuthentication;
     EnableHttpsTrafficOnly     = enableHttpsTrafficOnly;
     NetworkRuleSet             = networkRuleSet;
     IsHnsEnabled               = isHnsEnabled;
     GeoReplicationStats        = geoReplicationStats;
     FailoverInProgress         = failoverInProgress;
     LargeFileSharesState       = largeFileSharesState;
     PrivateEndpointConnections = privateEndpointConnections;
     RoutingPreference          = routingPreference;
     BlobRestoreStatus          = blobRestoreStatus;
     AllowBlobPublicAccess      = allowBlobPublicAccess;
     MinimumTlsVersion          = minimumTlsVersion;
     AllowSharedKeyAccess       = allowSharedKeyAccess;
     EnableNfsV3 = enableNfsV3;
     AllowCrossTenantReplication = allowCrossTenantReplication;
 }
コード例 #5
0
 public PSCustomDomain(CustomDomain input)
 {
     this.Name         = input.Name;
     this.UseSubDomain = input.UseSubDomainName;
 }
コード例 #6
0
 /// <summary>
 /// Updates the account type or tags for a storage account. It can also be used
 /// to add a custom domain (note that custom domains cannot be added via the
 /// Create operation). Only one custom domain is supported per storage account.
 /// In order to replace a custom domain, the old value must be cleared before a
 /// new value may be set. To clear a custom domain, simply update the custom
 /// domain with empty string. Then call update again with the new cutsom domain
 /// name. The update API can only be used to update one of tags, accountType,
 /// or customDomain per call. To update multiple of these properties, call the
 /// API multiple times with one change per call. This call does not change the
 /// storage keys for the account. If you want to change storage account keys,
 /// use the RegenerateKey operation. The location and name of the storage
 /// account cannot be changed after creation.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group within the user's subscription.
 /// </param>
 /// <param name='accountName'>
 /// The name of the storage account within the specified resource group.
 /// Storage account names must be between 3 and 24 characters in length and use
 /// numbers and lower-case letters only.
 /// </param>
 /// <param name='tags'>
 /// Resource tags
 /// </param>
 /// <param name='accountType'>
 /// Gets or sets the account type. Note that StandardZRS and PremiumLRS
 /// accounts cannot be changed to other account types, and other account types
 /// cannot be changed to StandardZRS or PremiumLRS. Possible values include:
 /// 'Standard_LRS', 'Standard_ZRS', 'Standard_GRS', 'Standard_RAGRS',
 /// 'Premium_LRS'
 /// </param>
 /// <param name='customDomain'>
 /// User domain assigned to the storage account. Name is the CNAME source. Only
 /// one custom domain is supported per storage account at this time. To clear
 /// the existing custom domain, use an empty string for the custom domain name
 /// property.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <StorageAccount> UpdateAsync(this IStorageAccountsOperations operations, string resourceGroupName, string accountName, IDictionary <string, string> tags = default(IDictionary <string, string>), AccountType?accountType = default(AccountType?), CustomDomain customDomain = default(CustomDomain), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, accountName, tags, accountType, customDomain, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
コード例 #7
0
        /// <summary>
        /// The Get Create Operation Status operation returns the status of the
        /// specified create operation. After calling the asynchronous Begin
        /// Create operation, you can call Get Create Operation Status to
        /// determine whether the operation has succeeded, failed, or is still
        /// in progress.
        /// </summary>
        /// <param name='operationStatusLink'>
        /// Required. The URL where the status of the long-running create
        /// operation can be checked.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        /// <returns>
        /// The Create storage account operation response.
        /// </returns>
        public async Task <StorageAccountCreateResponse> GetCreateOperationStatusAsync(string operationStatusLink, CancellationToken cancellationToken)
        {
            // Validate
            if (operationStatusLink == null)
            {
                throw new ArgumentNullException("operationStatusLink");
            }

            // Tracing
            bool   shouldTrace  = TracingAdapter.IsEnabled;
            string invocationId = null;

            if (shouldTrace)
            {
                invocationId = TracingAdapter.NextInvocationId.ToString();
                Dictionary <string, object> tracingParameters = new Dictionary <string, object>();
                tracingParameters.Add("operationStatusLink", operationStatusLink);
                TracingAdapter.Enter(invocationId, this, "GetCreateOperationStatusAsync", tracingParameters);
            }

            // Construct URL
            string url = "";

            url = url + operationStatusLink;
            url = url.Replace(" ", "%20");

            // Create HTTP transport objects
            HttpRequestMessage httpRequest = null;

            try
            {
                httpRequest            = new HttpRequestMessage();
                httpRequest.Method     = HttpMethod.Get;
                httpRequest.RequestUri = new Uri(url);

                // Set Headers
                httpRequest.Headers.Add("x-ms-client-request-id", Guid.NewGuid().ToString());

                // Set Credentials
                cancellationToken.ThrowIfCancellationRequested();
                await this.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);

                // Send Request
                HttpResponseMessage httpResponse = null;
                try
                {
                    if (shouldTrace)
                    {
                        TracingAdapter.SendRequest(invocationId, httpRequest);
                    }
                    cancellationToken.ThrowIfCancellationRequested();
                    httpResponse = await this.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);

                    if (shouldTrace)
                    {
                        TracingAdapter.ReceiveResponse(invocationId, httpResponse);
                    }
                    HttpStatusCode statusCode = httpResponse.StatusCode;
                    if (statusCode != HttpStatusCode.OK && statusCode != HttpStatusCode.Accepted && statusCode != HttpStatusCode.InternalServerError)
                    {
                        cancellationToken.ThrowIfCancellationRequested();
                        CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
                        if (shouldTrace)
                        {
                            TracingAdapter.Error(invocationId, ex);
                        }
                        throw ex;
                    }

                    // Create Result
                    StorageAccountCreateResponse result = null;
                    // Deserialize Response
                    if (statusCode == HttpStatusCode.OK || statusCode == HttpStatusCode.Accepted || statusCode == HttpStatusCode.InternalServerError)
                    {
                        cancellationToken.ThrowIfCancellationRequested();
                        string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);

                        result = new StorageAccountCreateResponse();
                        JToken responseDoc = null;
                        if (string.IsNullOrEmpty(responseContent) == false)
                        {
                            responseDoc = JToken.Parse(responseContent);
                        }

                        if (responseDoc != null && responseDoc.Type != JTokenType.Null)
                        {
                            StorageAccount storageAccountInstance = new StorageAccount();
                            result.StorageAccount = storageAccountInstance;

                            JToken idValue = responseDoc["id"];
                            if (idValue != null && idValue.Type != JTokenType.Null)
                            {
                                string idInstance = ((string)idValue);
                                storageAccountInstance.Id = idInstance;
                            }

                            JToken nameValue = responseDoc["name"];
                            if (nameValue != null && nameValue.Type != JTokenType.Null)
                            {
                                string nameInstance = ((string)nameValue);
                                storageAccountInstance.Name = nameInstance;
                            }

                            JToken typeValue = responseDoc["type"];
                            if (typeValue != null && typeValue.Type != JTokenType.Null)
                            {
                                string typeInstance = ((string)typeValue);
                                storageAccountInstance.Type = typeInstance;
                            }

                            JToken locationValue = responseDoc["location"];
                            if (locationValue != null && locationValue.Type != JTokenType.Null)
                            {
                                string locationInstance = ((string)locationValue);
                                storageAccountInstance.Location = locationInstance;
                            }

                            JToken tagsSequenceElement = ((JToken)responseDoc["tags"]);
                            if (tagsSequenceElement != null && tagsSequenceElement.Type != JTokenType.Null)
                            {
                                foreach (JProperty property in tagsSequenceElement)
                                {
                                    string tagsKey   = ((string)property.Name);
                                    string tagsValue = ((string)property.Value);
                                    storageAccountInstance.Tags.Add(tagsKey, tagsValue);
                                }
                            }

                            JToken propertiesValue = responseDoc["properties"];
                            if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
                            {
                                JToken provisioningStateValue = propertiesValue["provisioningState"];
                                if (provisioningStateValue != null && provisioningStateValue.Type != JTokenType.Null)
                                {
                                    ProvisioningState provisioningStateInstance = ((ProvisioningState)Enum.Parse(typeof(ProvisioningState), ((string)provisioningStateValue), true));
                                    storageAccountInstance.ProvisioningState = provisioningStateInstance;
                                }

                                JToken accountTypeValue = propertiesValue["accountType"];
                                if (accountTypeValue != null && accountTypeValue.Type != JTokenType.Null)
                                {
                                    AccountType accountTypeInstance = StorageManagementClient.ParseAccountType(((string)accountTypeValue));
                                    storageAccountInstance.AccountType = accountTypeInstance;
                                }

                                JToken primaryEndpointsValue = propertiesValue["primaryEndpoints"];
                                if (primaryEndpointsValue != null && primaryEndpointsValue.Type != JTokenType.Null)
                                {
                                    Endpoints primaryEndpointsInstance = new Endpoints();
                                    storageAccountInstance.PrimaryEndpoints = primaryEndpointsInstance;

                                    JToken blobValue = primaryEndpointsValue["blob"];
                                    if (blobValue != null && blobValue.Type != JTokenType.Null)
                                    {
                                        Uri blobInstance = TypeConversion.TryParseUri(((string)blobValue));
                                        primaryEndpointsInstance.Blob = blobInstance;
                                    }

                                    JToken queueValue = primaryEndpointsValue["queue"];
                                    if (queueValue != null && queueValue.Type != JTokenType.Null)
                                    {
                                        Uri queueInstance = TypeConversion.TryParseUri(((string)queueValue));
                                        primaryEndpointsInstance.Queue = queueInstance;
                                    }

                                    JToken tableValue = primaryEndpointsValue["table"];
                                    if (tableValue != null && tableValue.Type != JTokenType.Null)
                                    {
                                        Uri tableInstance = TypeConversion.TryParseUri(((string)tableValue));
                                        primaryEndpointsInstance.Table = tableInstance;
                                    }
                                }

                                JToken primaryLocationValue = propertiesValue["primaryLocation"];
                                if (primaryLocationValue != null && primaryLocationValue.Type != JTokenType.Null)
                                {
                                    string primaryLocationInstance = ((string)primaryLocationValue);
                                    storageAccountInstance.PrimaryLocation = primaryLocationInstance;
                                }

                                JToken statusOfPrimaryValue = propertiesValue["statusOfPrimary"];
                                if (statusOfPrimaryValue != null && statusOfPrimaryValue.Type != JTokenType.Null)
                                {
                                    AccountStatus statusOfPrimaryInstance = ((AccountStatus)Enum.Parse(typeof(AccountStatus), ((string)statusOfPrimaryValue), true));
                                    storageAccountInstance.StatusOfPrimary = statusOfPrimaryInstance;
                                }

                                JToken lastGeoFailoverTimeValue = propertiesValue["lastGeoFailoverTime"];
                                if (lastGeoFailoverTimeValue != null && lastGeoFailoverTimeValue.Type != JTokenType.Null)
                                {
                                    DateTime lastGeoFailoverTimeInstance = ((DateTime)lastGeoFailoverTimeValue);
                                    storageAccountInstance.LastGeoFailoverTime = lastGeoFailoverTimeInstance;
                                }

                                JToken secondaryLocationValue = propertiesValue["secondaryLocation"];
                                if (secondaryLocationValue != null && secondaryLocationValue.Type != JTokenType.Null)
                                {
                                    string secondaryLocationInstance = ((string)secondaryLocationValue);
                                    storageAccountInstance.SecondaryLocation = secondaryLocationInstance;
                                }

                                JToken statusOfSecondaryValue = propertiesValue["statusOfSecondary"];
                                if (statusOfSecondaryValue != null && statusOfSecondaryValue.Type != JTokenType.Null)
                                {
                                    AccountStatus statusOfSecondaryInstance = ((AccountStatus)Enum.Parse(typeof(AccountStatus), ((string)statusOfSecondaryValue), true));
                                    storageAccountInstance.StatusOfSecondary = statusOfSecondaryInstance;
                                }

                                JToken creationTimeValue = propertiesValue["creationTime"];
                                if (creationTimeValue != null && creationTimeValue.Type != JTokenType.Null)
                                {
                                    DateTime creationTimeInstance = ((DateTime)creationTimeValue);
                                    storageAccountInstance.CreationTime = creationTimeInstance;
                                }

                                JToken customDomainValue = propertiesValue["customDomain"];
                                if (customDomainValue != null && customDomainValue.Type != JTokenType.Null)
                                {
                                    CustomDomain customDomainInstance = new CustomDomain();
                                    storageAccountInstance.CustomDomain = customDomainInstance;

                                    JToken nameValue2 = customDomainValue["name"];
                                    if (nameValue2 != null && nameValue2.Type != JTokenType.Null)
                                    {
                                        string nameInstance2 = ((string)nameValue2);
                                        customDomainInstance.Name = nameInstance2;
                                    }

                                    JToken useSubDomainValue = customDomainValue["useSubDomain"];
                                    if (useSubDomainValue != null && useSubDomainValue.Type != JTokenType.Null)
                                    {
                                        bool useSubDomainInstance = ((bool)useSubDomainValue);
                                        customDomainInstance.UseSubDomain = useSubDomainInstance;
                                    }
                                }

                                JToken secondaryEndpointsValue = propertiesValue["secondaryEndpoints"];
                                if (secondaryEndpointsValue != null && secondaryEndpointsValue.Type != JTokenType.Null)
                                {
                                    Endpoints secondaryEndpointsInstance = new Endpoints();
                                    storageAccountInstance.SecondaryEndpoints = secondaryEndpointsInstance;

                                    JToken blobValue2 = secondaryEndpointsValue["blob"];
                                    if (blobValue2 != null && blobValue2.Type != JTokenType.Null)
                                    {
                                        Uri blobInstance2 = TypeConversion.TryParseUri(((string)blobValue2));
                                        secondaryEndpointsInstance.Blob = blobInstance2;
                                    }

                                    JToken queueValue2 = secondaryEndpointsValue["queue"];
                                    if (queueValue2 != null && queueValue2.Type != JTokenType.Null)
                                    {
                                        Uri queueInstance2 = TypeConversion.TryParseUri(((string)queueValue2));
                                        secondaryEndpointsInstance.Queue = queueInstance2;
                                    }

                                    JToken tableValue2 = secondaryEndpointsValue["table"];
                                    if (tableValue2 != null && tableValue2.Type != JTokenType.Null)
                                    {
                                        Uri tableInstance2 = TypeConversion.TryParseUri(((string)tableValue2));
                                        secondaryEndpointsInstance.Table = tableInstance2;
                                    }
                                }
                            }
                        }
                    }
                    result.StatusCode = statusCode;
                    if (httpResponse.Headers.Contains("RetryAfter"))
                    {
                        result.RetryAfter = int.Parse(httpResponse.Headers.GetValues("RetryAfter").FirstOrDefault(), CultureInfo.InvariantCulture);
                    }
                    if (httpResponse.Headers.Contains("x-ms-request-id"))
                    {
                        result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
                    }
                    if (statusCode == HttpStatusCode.Conflict)
                    {
                        result.Status = OperationStatus.Failed;
                    }
                    if (statusCode == HttpStatusCode.InternalServerError)
                    {
                        result.Status = OperationStatus.InProgress;
                    }
                    if (statusCode == HttpStatusCode.Accepted)
                    {
                        result.Status = OperationStatus.InProgress;
                    }
                    if (statusCode == HttpStatusCode.OK)
                    {
                        result.Status = OperationStatus.Succeeded;
                    }

                    if (shouldTrace)
                    {
                        TracingAdapter.Exit(invocationId, result);
                    }
                    return(result);
                }
                finally
                {
                    if (httpResponse != null)
                    {
                        httpResponse.Dispose();
                    }
                }
            }
            finally
            {
                if (httpRequest != null)
                {
                    httpRequest.Dispose();
                }
            }
        }
コード例 #8
0
 /// <summary>
 /// Specifies the user domain assigned to the storage account.
 /// </summary>
 /// <param name="customDomain">The user domain assigned to the storage account.</param>
 /// <return>The next stage of storage account definition.</return>
 StorageAccount.Definition.IWithCreate StorageAccount.Definition.IWithCustomDomain.WithCustomDomain(CustomDomain customDomain)
 {
     return(this.WithCustomDomain(customDomain));
 }
コード例 #9
0
 /// <summary>
 /// Specifies the user domain assigned to the storage account.
 /// </summary>
 /// <param name="customDomain">The user domain assigned to the storage account.</param>
 /// <return>The next stage of storage account update.</return>
 StorageAccount.Update.IUpdate StorageAccount.Update.IWithCustomDomain.WithCustomDomain(CustomDomain customDomain)
 {
     return(this.WithCustomDomain(customDomain));
 }
コード例 #10
0
        internal static StorageAccountData DeserializeStorageAccountData(JsonElement element)
        {
            Optional <Sku>               sku              = default;
            Optional <Kind>              kind             = default;
            Optional <Identity>          identity         = default;
            Optional <ExtendedLocation>  extendedLocation = default;
            IDictionary <string, string> tags             = default;
            Location                     location         = default;
            ResourceIdentifier           id   = default;
            string                       name = default;
            ResourceType                 type = default;
            Optional <ProvisioningState> provisioningState   = default;
            Optional <Endpoints>         primaryEndpoints    = default;
            Optional <string>            primaryLocation     = default;
            Optional <AccountStatus>     statusOfPrimary     = default;
            Optional <DateTimeOffset>    lastGeoFailoverTime = default;
            Optional <string>            secondaryLocation   = default;
            Optional <AccountStatus>     statusOfSecondary   = default;
            Optional <DateTimeOffset>    creationTime        = default;
            Optional <CustomDomain>      customDomain        = default;
            Optional <SasPolicy>         sasPolicy           = default;
            Optional <KeyPolicy>         keyPolicy           = default;
            Optional <KeyCreationTime>   keyCreationTime     = default;
            Optional <Endpoints>         secondaryEndpoints  = default;
            Optional <Encryption>        encryption          = default;
            Optional <AccessTier>        accessTier          = default;
            Optional <AzureFilesIdentityBasedAuthentication> azureFilesIdentityBasedAuthentication = default;
            Optional <bool>                 supportsHttpsTrafficOnly = default;
            Optional <NetworkRuleSet>       networkAcls          = default;
            Optional <bool>                 isHnsEnabled         = default;
            Optional <GeoReplicationStats>  geoReplicationStats  = default;
            Optional <bool>                 failoverInProgress   = default;
            Optional <LargeFileSharesState> largeFileSharesState = default;
            Optional <IReadOnlyList <PrivateEndpointConnectionData> > privateEndpointConnections = default;
            Optional <RoutingPreference> routingPreference = default;
            Optional <BlobRestoreStatus> blobRestoreStatus = default;
            Optional <bool> allowBlobPublicAccess          = default;
            Optional <MinimumTlsVersion> minimumTlsVersion = default;
            Optional <bool> allowSharedKeyAccess           = default;
            Optional <bool> isNfsV3Enabled = default;
            Optional <bool> allowCrossTenantReplication = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sku = Sku.DeserializeSku(property.Value);
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    kind = new Kind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("identity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    identity = Identity.DeserializeIdentity(property.Value);
                    continue;
                }
                if (property.NameEquals("extendedLocation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value);
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = property0.Value.GetString().ToProvisioningState();
                            continue;
                        }
                        if (property0.NameEquals("primaryEndpoints"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            primaryEndpoints = Endpoints.DeserializeEndpoints(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("primaryLocation"))
                        {
                            primaryLocation = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("statusOfPrimary"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            statusOfPrimary = property0.Value.GetString().ToAccountStatus();
                            continue;
                        }
                        if (property0.NameEquals("lastGeoFailoverTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            lastGeoFailoverTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("secondaryLocation"))
                        {
                            secondaryLocation = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("statusOfSecondary"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            statusOfSecondary = property0.Value.GetString().ToAccountStatus();
                            continue;
                        }
                        if (property0.NameEquals("creationTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            creationTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("customDomain"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            customDomain = CustomDomain.DeserializeCustomDomain(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("sasPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            sasPolicy = SasPolicy.DeserializeSasPolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("keyPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            keyPolicy = KeyPolicy.DeserializeKeyPolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("keyCreationTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            keyCreationTime = KeyCreationTime.DeserializeKeyCreationTime(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("secondaryEndpoints"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            secondaryEndpoints = Endpoints.DeserializeEndpoints(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("encryption"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            encryption = Encryption.DeserializeEncryption(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("accessTier"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            accessTier = property0.Value.GetString().ToAccessTier();
                            continue;
                        }
                        if (property0.NameEquals("azureFilesIdentityBasedAuthentication"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            azureFilesIdentityBasedAuthentication = AzureFilesIdentityBasedAuthentication.DeserializeAzureFilesIdentityBasedAuthentication(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("supportsHttpsTrafficOnly"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            supportsHttpsTrafficOnly = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("networkAcls"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            networkAcls = NetworkRuleSet.DeserializeNetworkRuleSet(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("isHnsEnabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isHnsEnabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("geoReplicationStats"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            geoReplicationStats = GeoReplicationStats.DeserializeGeoReplicationStats(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("failoverInProgress"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            failoverInProgress = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("largeFileSharesState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            largeFileSharesState = new LargeFileSharesState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("privateEndpointConnections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <PrivateEndpointConnectionData> array = new List <PrivateEndpointConnectionData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(PrivateEndpointConnectionData.DeserializePrivateEndpointConnectionData(item));
                            }
                            privateEndpointConnections = array;
                            continue;
                        }
                        if (property0.NameEquals("routingPreference"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            routingPreference = RoutingPreference.DeserializeRoutingPreference(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("blobRestoreStatus"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            blobRestoreStatus = BlobRestoreStatus.DeserializeBlobRestoreStatus(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("allowBlobPublicAccess"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            allowBlobPublicAccess = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("minimumTlsVersion"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            minimumTlsVersion = new MinimumTlsVersion(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("allowSharedKeyAccess"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            allowSharedKeyAccess = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("isNfsV3Enabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isNfsV3Enabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("allowCrossTenantReplication"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            allowCrossTenantReplication = property0.Value.GetBoolean();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new StorageAccountData(id, name, type, tags, location, sku.Value, Optional.ToNullable(kind), identity.Value, extendedLocation.Value, Optional.ToNullable(provisioningState), primaryEndpoints.Value, primaryLocation.Value, Optional.ToNullable(statusOfPrimary), Optional.ToNullable(lastGeoFailoverTime), secondaryLocation.Value, Optional.ToNullable(statusOfSecondary), Optional.ToNullable(creationTime), customDomain.Value, sasPolicy.Value, keyPolicy.Value, keyCreationTime.Value, secondaryEndpoints.Value, encryption.Value, Optional.ToNullable(accessTier), azureFilesIdentityBasedAuthentication.Value, Optional.ToNullable(supportsHttpsTrafficOnly), networkAcls.Value, Optional.ToNullable(isHnsEnabled), geoReplicationStats.Value, Optional.ToNullable(failoverInProgress), Optional.ToNullable(largeFileSharesState), Optional.ToList(privateEndpointConnections), routingPreference.Value, blobRestoreStatus.Value, Optional.ToNullable(allowBlobPublicAccess), Optional.ToNullable(minimumTlsVersion), Optional.ToNullable(allowSharedKeyAccess), Optional.ToNullable(isNfsV3Enabled), Optional.ToNullable(allowCrossTenantReplication)));
        }