IotCentralPrivateEndpointConnectionResource IOperationSource <IotCentralPrivateEndpointConnectionResource> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = IotCentralPrivateEndpointConnectionData.DeserializeIotCentralPrivateEndpointConnectionData(document.RootElement); return(new IotCentralPrivateEndpointConnectionResource(_client, data)); }
public async Task <Response <IotCentralPrivateEndpointConnectionData> > GetAsync(string subscriptionId, string resourceGroupName, string resourceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, privateEndpointConnectionName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { IotCentralPrivateEndpointConnectionData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = IotCentralPrivateEndpointConnectionData.DeserializeIotCentralPrivateEndpointConnectionData(document.RootElement); return(Response.FromValue(value, message.Response)); }
internal static IotCentralAppData DeserializeIotCentralAppData(JsonElement element) { AppSkuInfo sku = default; Optional <SystemAssignedServiceIdentity> identity = 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 <string> applicationId = default; Optional <string> displayName = default; Optional <string> subdomain = default; Optional <string> template = default; Optional <AppState> state = default; Optional <PublicNetworkAccess> publicNetworkAccess = default; Optional <NetworkRuleSets> networkRuleSets = default; Optional <IReadOnlyList <IotCentralPrivateEndpointConnectionData> > privateEndpointConnections = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku")) { sku = AppSkuInfo.DeserializeAppSkuInfo(property.Value); continue; } if (property.NameEquals("identity")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } identity = JsonSerializer.Deserialize <SystemAssignedServiceIdentity>(property.Value.ToString()); 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 = new ProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("applicationId")) { applicationId = property0.Value.GetString(); continue; } if (property0.NameEquals("displayName")) { displayName = property0.Value.GetString(); continue; } if (property0.NameEquals("subdomain")) { subdomain = property0.Value.GetString(); continue; } if (property0.NameEquals("template")) { template = property0.Value.GetString(); continue; } if (property0.NameEquals("state")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } state = new AppState(property0.Value.GetString()); continue; } if (property0.NameEquals("publicNetworkAccess")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString()); continue; } if (property0.NameEquals("networkRuleSets")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } networkRuleSets = NetworkRuleSets.DeserializeNetworkRuleSets(property0.Value); continue; } if (property0.NameEquals("privateEndpointConnections")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <IotCentralPrivateEndpointConnectionData> array = new List <IotCentralPrivateEndpointConnectionData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(IotCentralPrivateEndpointConnectionData.DeserializeIotCentralPrivateEndpointConnectionData(item)); } privateEndpointConnections = array; continue; } } continue; } } return(new IotCentralAppData(id, name, type, systemData, tags, location, sku, identity, Optional.ToNullable(provisioningState), applicationId.Value, displayName.Value, subdomain.Value, template.Value, Optional.ToNullable(state), Optional.ToNullable(publicNetworkAccess), networkRuleSets.Value, Optional.ToList(privateEndpointConnections))); }