internal static StorageAccountData DeserializeStorageAccountData(JsonElement element) { Optional <StorageSku> sku = default; Optional <StorageKind> kind = default; Optional <ManagedServiceIdentity> identity = default; Optional <ExtendedLocation> extendedLocation = default; IDictionary <string, string> tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = 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> isSftpEnabled = default; Optional <bool> isLocalUserEnabled = default; Optional <bool> isHnsEnabled = default; Optional <GeoReplicationStats> geoReplicationStats = default; Optional <bool> failoverInProgress = default; Optional <LargeFileSharesState> largeFileSharesState = default; Optional <IReadOnlyList <StoragePrivateEndpointConnectionData> > 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; Optional <bool> defaultToOAuthAuthentication = default; Optional <PublicNetworkAccess> publicNetworkAccess = default; Optional <ImmutableStorageAccount> immutableStorageWithVersioning = default; Optional <AllowedCopyScope> allowedCopyScope = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } sku = StorageSku.DeserializeStorageSku(property.Value); continue; } if (property.NameEquals("kind")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } kind = new StorageKind(property.Value.GetString()); continue; } if (property.NameEquals("identity")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; identity = JsonSerializer.Deserialize <ManagedServiceIdentity>(property.Value.ToString(), serializeOptions); 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 = new ResourceIdentifier(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("systemData")) { systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString()); 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("isSftpEnabled")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } isSftpEnabled = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("isLocalUserEnabled")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } isLocalUserEnabled = property0.Value.GetBoolean(); 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 <StoragePrivateEndpointConnectionData> array = new List <StoragePrivateEndpointConnectionData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(StoragePrivateEndpointConnectionData.DeserializeStoragePrivateEndpointConnectionData(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; } if (property0.NameEquals("defaultToOAuthAuthentication")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } defaultToOAuthAuthentication = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("publicNetworkAccess")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString()); continue; } if (property0.NameEquals("immutableStorageWithVersioning")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } immutableStorageWithVersioning = ImmutableStorageAccount.DeserializeImmutableStorageAccount(property0.Value); continue; } if (property0.NameEquals("allowedCopyScope")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } allowedCopyScope = new AllowedCopyScope(property0.Value.GetString()); continue; } } continue; } } return(new StorageAccountData(id, name, type, systemData, tags, location, sku.Value, Optional.ToNullable(kind), identity, 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(isSftpEnabled), Optional.ToNullable(isLocalUserEnabled), 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), Optional.ToNullable(defaultToOAuthAuthentication), Optional.ToNullable(publicNetworkAccess), immutableStorageWithVersioning.Value, Optional.ToNullable(allowedCopyScope))); }
public virtual async Task <ArmOperation <StoragePrivateEndpointConnectionResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string privateEndpointConnectionName, StoragePrivateEndpointConnectionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); Argument.AssertNotNull(data, nameof(data)); using var scope = _storagePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("StoragePrivateEndpointConnectionCollection.CreateOrUpdate"); scope.Start(); try { var response = await _storagePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.PutAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken).ConfigureAwait(false); var operation = new StorageArmOperation <StoragePrivateEndpointConnectionResource>(Response.FromValue(new StoragePrivateEndpointConnectionResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }