VirtualNetworkTap IOperationSource <VirtualNetworkTap> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = VirtualNetworkTapData.DeserializeVirtualNetworkTapData(document.RootElement); return(new VirtualNetworkTap(_client, data)); }
public async Task <Response <VirtualNetworkTapData> > GetAsync(string subscriptionId, string resourceGroupName, string tapName, CancellationToken cancellationToken = default) { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (tapName == null) { throw new ArgumentNullException(nameof(tapName)); } using var message = CreateGetRequest(subscriptionId, resourceGroupName, tapName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { VirtualNetworkTapData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = VirtualNetworkTapData.DeserializeVirtualNetworkTapData(document.RootElement); return(Response.FromValue(value, message.Response)); }
internal VirtualNetworkTap(ArmResource options, VirtualNetworkTapData resource) : base(options, resource.Id) { HasData = true; _data = resource; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _restClient = new VirtualNetworkTapsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); }
internal VirtualNetworkTap(ArmResource options, VirtualNetworkTapData resource) : base(options, new ResourceIdentifier(resource.Id)) { HasData = true; _data = resource; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _virtualNetworkTapsRestClient = new VirtualNetworkTapsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); }
internal NetworkInterfaceTapConfigurationData(string id, string name, string etag, string type, VirtualNetworkTapData virtualNetworkTap, ProvisioningState?provisioningState) : base(id) { Name = name; Etag = etag; Type = type; VirtualNetworkTap = virtualNetworkTap; ProvisioningState = provisioningState; }
internal VirtualNetworkTap(ArmClient client, VirtualNetworkTapData data) : this(client, new ResourceIdentifier(data.Id)) { HasData = true; _data = data; }
public async virtual Task <ArmOperation <VirtualNetworkTap> > CreateOrUpdateAsync(bool waitForCompletion, string tapName, VirtualNetworkTapData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(tapName, nameof(tapName)); Argument.AssertNotNull(parameters, nameof(parameters)); using var scope = _virtualNetworkTapClientDiagnostics.CreateScope("VirtualNetworkTapCollection.CreateOrUpdate"); scope.Start(); try { var response = await _virtualNetworkTapRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, tapName, parameters, cancellationToken).ConfigureAwait(false); var operation = new NetworkArmOperation <VirtualNetworkTap>(new VirtualNetworkTapOperationSource(Client), _virtualNetworkTapClientDiagnostics, Pipeline, _virtualNetworkTapRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, tapName, parameters).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual VirtualNetworkTapCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string tapName, VirtualNetworkTapData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(tapName, nameof(tapName)); if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _virtualNetworkTapClientDiagnostics.CreateScope("VirtualNetworkTapCollection.CreateOrUpdate"); scope.Start(); try { var response = _virtualNetworkTapRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, tapName, parameters, cancellationToken); var operation = new VirtualNetworkTapCreateOrUpdateOperation(ArmClient, _virtualNetworkTapClientDiagnostics, Pipeline, _virtualNetworkTapRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, tapName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
internal static NetworkInterfaceTapConfigurationData DeserializeNetworkInterfaceTapConfigurationData(JsonElement element) { Optional <string> name = default; Optional <string> etag = default; Optional <string> type = default; Optional <string> id = default; Optional <VirtualNetworkTapData> virtualNetworkTap = default; Optional <ProvisioningState> provisioningState = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("etag")) { etag = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("id")) { id = 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("virtualNetworkTap")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } virtualNetworkTap = VirtualNetworkTapData.DeserializeVirtualNetworkTapData(property0.Value); continue; } if (property0.NameEquals("provisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } provisioningState = new ProvisioningState(property0.Value.GetString()); continue; } } continue; } } return(new NetworkInterfaceTapConfigurationData(id.Value, name.Value, etag.Value, type.Value, virtualNetworkTap.Value, Optional.ToNullable(provisioningState))); }
internal static NetworkInterfaceIPConfigurationData DeserializeNetworkInterfaceIPConfigurationData(JsonElement element) { Optional <ETag> etag = default; Optional <ResourceIdentifier> id = default; Optional <string> name = default; Optional <ResourceType> type = default; Optional <WritableSubResource> gatewayLoadBalancer = default; Optional <IList <VirtualNetworkTapData> > virtualNetworkTaps = default; Optional <IList <ApplicationGatewayBackendAddressPool> > applicationGatewayBackendAddressPools = default; Optional <IList <BackendAddressPoolData> > loadBalancerBackendAddressPools = default; Optional <IList <InboundNatRuleData> > loadBalancerInboundNatRules = default; Optional <string> privateIPAddress = default; Optional <IPAllocationMethod> privateIPAllocationMethod = default; Optional <IPVersion> privateIPAddressVersion = default; Optional <SubnetData> subnet = default; Optional <bool> primary = default; Optional <PublicIPAddressData> publicIPAddress = default; Optional <IList <ApplicationSecurityGroupData> > applicationSecurityGroups = default; Optional <NetworkProvisioningState> provisioningState = default; Optional <NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties> privateLinkConnectionProperties = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } etag = new ETag(property.Value.GetString()); continue; } if (property.NameEquals("id")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } type = new ResourceType(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("gatewayLoadBalancer")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } gatewayLoadBalancer = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString()); continue; } if (property0.NameEquals("virtualNetworkTaps")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <VirtualNetworkTapData> array = new List <VirtualNetworkTapData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(VirtualNetworkTapData.DeserializeVirtualNetworkTapData(item)); } virtualNetworkTaps = array; continue; } if (property0.NameEquals("applicationGatewayBackendAddressPools")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <ApplicationGatewayBackendAddressPool> array = new List <ApplicationGatewayBackendAddressPool>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(ApplicationGatewayBackendAddressPool.DeserializeApplicationGatewayBackendAddressPool(item)); } applicationGatewayBackendAddressPools = array; continue; } if (property0.NameEquals("loadBalancerBackendAddressPools")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <BackendAddressPoolData> array = new List <BackendAddressPoolData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(BackendAddressPoolData.DeserializeBackendAddressPoolData(item)); } loadBalancerBackendAddressPools = array; continue; } if (property0.NameEquals("loadBalancerInboundNatRules")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <InboundNatRuleData> array = new List <InboundNatRuleData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(InboundNatRuleData.DeserializeInboundNatRuleData(item)); } loadBalancerInboundNatRules = array; continue; } if (property0.NameEquals("privateIPAddress")) { privateIPAddress = property0.Value.GetString(); continue; } if (property0.NameEquals("privateIPAllocationMethod")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } privateIPAllocationMethod = new IPAllocationMethod(property0.Value.GetString()); continue; } if (property0.NameEquals("privateIPAddressVersion")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } privateIPAddressVersion = new IPVersion(property0.Value.GetString()); continue; } if (property0.NameEquals("subnet")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } subnet = SubnetData.DeserializeSubnetData(property0.Value); continue; } if (property0.NameEquals("primary")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } primary = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("publicIPAddress")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } publicIPAddress = PublicIPAddressData.DeserializePublicIPAddressData(property0.Value); continue; } if (property0.NameEquals("applicationSecurityGroups")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <ApplicationSecurityGroupData> array = new List <ApplicationSecurityGroupData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(ApplicationSecurityGroupData.DeserializeApplicationSecurityGroupData(item)); } applicationSecurityGroups = array; continue; } if (property0.NameEquals("provisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } provisioningState = new NetworkProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("privateLinkConnectionProperties")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } privateLinkConnectionProperties = NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties.DeserializeNetworkInterfaceIPConfigurationPrivateLinkConnectionProperties(property0.Value); continue; } } continue; } } return(new NetworkInterfaceIPConfigurationData(id.Value, name.Value, Optional.ToNullable(type), Optional.ToNullable(etag), gatewayLoadBalancer, Optional.ToList(virtualNetworkTaps), Optional.ToList(applicationGatewayBackendAddressPools), Optional.ToList(loadBalancerBackendAddressPools), Optional.ToList(loadBalancerInboundNatRules), privateIPAddress.Value, Optional.ToNullable(privateIPAllocationMethod), Optional.ToNullable(privateIPAddressVersion), subnet.Value, Optional.ToNullable(primary), publicIPAddress.Value, Optional.ToList(applicationSecurityGroups), Optional.ToNullable(provisioningState), privateLinkConnectionProperties.Value)); }
public virtual ArmOperation <VirtualNetworkTapResource> CreateOrUpdate(WaitUntil waitUntil, string tapName, VirtualNetworkTapData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(tapName, nameof(tapName)); Argument.AssertNotNull(data, nameof(data)); using var scope = _virtualNetworkTapClientDiagnostics.CreateScope("VirtualNetworkTapCollection.CreateOrUpdate"); scope.Start(); try { var response = _virtualNetworkTapRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, tapName, data, cancellationToken); var operation = new NetworkArmOperation <VirtualNetworkTapResource>(new VirtualNetworkTapOperationSource(Client), _virtualNetworkTapClientDiagnostics, Pipeline, _virtualNetworkTapRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, tapName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
internal VirtualNetworkTapResource(ArmClient client, VirtualNetworkTapData data) : this(client, data.Id) { HasData = true; _data = data; }
internal NetworkInterfaceTapConfigurationData(ResourceIdentifier id, string name, ResourceType?resourceType, ETag?etag, VirtualNetworkTapData virtualNetworkTap, NetworkProvisioningState?provisioningState) : base(id, name, resourceType) { Etag = etag; VirtualNetworkTap = virtualNetworkTap; ProvisioningState = provisioningState; }
public async virtual Task <VirtualNetworkTapCreateOrUpdateOperation> CreateOrUpdateAsync(string tapName, VirtualNetworkTapData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (tapName == null) { throw new ArgumentNullException(nameof(tapName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("VirtualNetworkTapCollection.CreateOrUpdate"); scope.Start(); try { var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, tapName, parameters, cancellationToken).ConfigureAwait(false); var operation = new VirtualNetworkTapCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, tapName, parameters).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }