public async Task <Response <ExpressRouteLinkData> > GetAsync(string subscriptionId, string resourceGroupName, string expressRoutePortName, string linkName, CancellationToken cancellationToken = default) { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (expressRoutePortName == null) { throw new ArgumentNullException(nameof(expressRoutePortName)); } if (linkName == null) { throw new ArgumentNullException(nameof(linkName)); } using var message = CreateGetRequest(subscriptionId, resourceGroupName, expressRoutePortName, linkName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { ExpressRouteLinkData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = ExpressRouteLinkData.DeserializeExpressRouteLinkData(document.RootElement); return(Response.FromValue(value, message.Response)); }
internal ExpressRouteLink(ArmResource options, ExpressRouteLinkData resource) : base(options, new ResourceIdentifier(resource.Id)) { HasData = true; _data = resource; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _expressRouteLinksRestClient = new ExpressRouteLinksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); }
internal ExpressRouteLinkResource(ArmClient client, ExpressRouteLinkData data) : this(client, data.Id) { HasData = true; _data = data; }
internal static ExpressRoutePortData DeserializeExpressRoutePortData(JsonElement element) { Optional <string> etag = default; Optional <ManagedServiceIdentity> identity = default; Optional <string> id = default; Optional <string> name = default; Optional <string> type = default; Optional <string> location = default; Optional <IDictionary <string, string> > tags = default; Optional <string> peeringLocation = default; Optional <int> bandwidthInGbps = default; Optional <float> provisionedBandwidthInGbps = default; Optional <string> mtu = default; Optional <ExpressRoutePortsEncapsulation> encapsulation = default; Optional <string> etherType = default; Optional <string> allocationDate = default; Optional <IList <ExpressRouteLinkData> > links = default; Optional <IReadOnlyList <WritableSubResource> > circuits = default; Optional <ProvisioningState> provisioningState = default; Optional <string> resourceGuid = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag")) { etag = property.Value.GetString(); continue; } if (property.NameEquals("identity")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } identity = JsonSerializer.Deserialize <ManagedServiceIdentity>(property.Value.ToString()); 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("location")) { location = property.Value.GetString(); continue; } if (property.NameEquals("tags")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } 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("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("peeringLocation")) { peeringLocation = property0.Value.GetString(); continue; } if (property0.NameEquals("bandwidthInGbps")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } bandwidthInGbps = property0.Value.GetInt32(); continue; } if (property0.NameEquals("provisionedBandwidthInGbps")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } provisionedBandwidthInGbps = property0.Value.GetSingle(); continue; } if (property0.NameEquals("mtu")) { mtu = property0.Value.GetString(); continue; } if (property0.NameEquals("encapsulation")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } encapsulation = new ExpressRoutePortsEncapsulation(property0.Value.GetString()); continue; } if (property0.NameEquals("etherType")) { etherType = property0.Value.GetString(); continue; } if (property0.NameEquals("allocationDate")) { allocationDate = property0.Value.GetString(); continue; } if (property0.NameEquals("links")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <ExpressRouteLinkData> array = new List <ExpressRouteLinkData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(ExpressRouteLinkData.DeserializeExpressRouteLinkData(item)); } links = array; continue; } if (property0.NameEquals("circuits")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <WritableSubResource> array = new List <WritableSubResource>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(JsonSerializer.Deserialize <WritableSubResource>(item.ToString())); } circuits = array; continue; } if (property0.NameEquals("provisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } provisioningState = new ProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("resourceGuid")) { resourceGuid = property0.Value.GetString(); continue; } } continue; } } return(new ExpressRoutePortData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, identity, peeringLocation.Value, Optional.ToNullable(bandwidthInGbps), Optional.ToNullable(provisionedBandwidthInGbps), mtu.Value, Optional.ToNullable(encapsulation), etherType.Value, allocationDate.Value, Optional.ToList(links), Optional.ToList(circuits), Optional.ToNullable(provisioningState), resourceGuid.Value)); }
internal ExpressRouteLinkResource(ArmClient client, ExpressRouteLinkData data) : this(client, new ResourceIdentifier(data.Id)) { HasData = true; _data = data; }