public async Task <Response <NetworkInterfaceTapConfigurationData> > GetAsync(string subscriptionId, string resourceGroupName, string networkInterfaceName, string tapConfigurationName, CancellationToken cancellationToken = default) { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (networkInterfaceName == null) { throw new ArgumentNullException(nameof(networkInterfaceName)); } if (tapConfigurationName == null) { throw new ArgumentNullException(nameof(tapConfigurationName)); } using var message = CreateGetRequest(subscriptionId, resourceGroupName, networkInterfaceName, tapConfigurationName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { NetworkInterfaceTapConfigurationData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = NetworkInterfaceTapConfigurationData.DeserializeNetworkInterfaceTapConfigurationData(document.RootElement); return(Response.FromValue(value, message.Response)); }
NetworkInterfaceTapConfigurationResource IOperationSource <NetworkInterfaceTapConfigurationResource> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = NetworkInterfaceTapConfigurationData.DeserializeNetworkInterfaceTapConfigurationData(document.RootElement); return(new NetworkInterfaceTapConfigurationResource(_client, data)); }
internal NetworkInterfaceTapConfiguration(ArmResource options, NetworkInterfaceTapConfigurationData resource) : base(options, new ResourceIdentifier(resource.Id)) { HasData = true; _data = resource; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _networkInterfaceTapConfigurationsRestClient = new NetworkInterfaceTapConfigurationsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); }
internal NetworkInterfaceTapConfiguration(ArmResource options, NetworkInterfaceTapConfigurationData resource) : base(options, resource.Id) { HasData = true; _data = resource; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _restClient = new NetworkInterfaceTapConfigurationsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); }
internal static NetworkInterfaceData DeserializeNetworkInterfaceData(JsonElement element) { Optional <Models.ExtendedLocation> extendedLocation = default; Optional <ETag> etag = default; Optional <ResourceIdentifier> id = default; Optional <string> name = default; Optional <ResourceType> type = default; Optional <AzureLocation> location = default; Optional <IDictionary <string, string> > tags = default; Optional <WritableSubResource> virtualMachine = default; Optional <NetworkSecurityGroupData> networkSecurityGroup = default; Optional <PrivateEndpointData> privateEndpoint = default; Optional <IList <NetworkInterfaceIPConfigurationData> > ipConfigurations = default; Optional <IReadOnlyList <NetworkInterfaceTapConfigurationData> > tapConfigurations = default; Optional <NetworkInterfaceDnsSettings> dnsSettings = default; Optional <string> macAddress = default; Optional <bool> primary = default; Optional <bool> enableAcceleratedNetworking = default; Optional <bool> enableIPForwarding = default; Optional <IReadOnlyList <string> > hostedWorkloads = default; Optional <WritableSubResource> dscpConfiguration = default; Optional <Guid> resourceGuid = default; Optional <NetworkProvisioningState> provisioningState = default; Optional <string> workloadType = default; Optional <NetworkInterfaceNicType> nicType = default; Optional <PrivateLinkServiceData> privateLinkService = default; Optional <NetworkInterfaceMigrationPhase> migrationPhase = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } extendedLocation = Models.ExtendedLocation.DeserializeExtendedLocation(property.Value); continue; } 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("location")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } location = new AzureLocation(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("virtualMachine")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } virtualMachine = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString()); continue; } if (property0.NameEquals("networkSecurityGroup")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } networkSecurityGroup = NetworkSecurityGroupData.DeserializeNetworkSecurityGroupData(property0.Value); continue; } if (property0.NameEquals("privateEndpoint")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } privateEndpoint = PrivateEndpointData.DeserializePrivateEndpointData(property0.Value); continue; } if (property0.NameEquals("ipConfigurations")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <NetworkInterfaceIPConfigurationData> array = new List <NetworkInterfaceIPConfigurationData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(NetworkInterfaceIPConfigurationData.DeserializeNetworkInterfaceIPConfigurationData(item)); } ipConfigurations = array; continue; } if (property0.NameEquals("tapConfigurations")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <NetworkInterfaceTapConfigurationData> array = new List <NetworkInterfaceTapConfigurationData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(NetworkInterfaceTapConfigurationData.DeserializeNetworkInterfaceTapConfigurationData(item)); } tapConfigurations = array; continue; } if (property0.NameEquals("dnsSettings")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } dnsSettings = NetworkInterfaceDnsSettings.DeserializeNetworkInterfaceDnsSettings(property0.Value); continue; } if (property0.NameEquals("macAddress")) { macAddress = property0.Value.GetString(); continue; } if (property0.NameEquals("primary")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } primary = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("enableAcceleratedNetworking")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } enableAcceleratedNetworking = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("enableIPForwarding")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } enableIPForwarding = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("hostedWorkloads")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <string> array = new List <string>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(item.GetString()); } hostedWorkloads = array; continue; } if (property0.NameEquals("dscpConfiguration")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } dscpConfiguration = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString()); continue; } if (property0.NameEquals("resourceGuid")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } resourceGuid = property0.Value.GetGuid(); continue; } if (property0.NameEquals("provisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } provisioningState = new NetworkProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("workloadType")) { workloadType = property0.Value.GetString(); continue; } if (property0.NameEquals("nicType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } nicType = new NetworkInterfaceNicType(property0.Value.GetString()); continue; } if (property0.NameEquals("privateLinkService")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } privateLinkService = PrivateLinkServiceData.DeserializePrivateLinkServiceData(property0.Value); continue; } if (property0.NameEquals("migrationPhase")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } migrationPhase = new NetworkInterfaceMigrationPhase(property0.Value.GetString()); continue; } } continue; } } return(new NetworkInterfaceData(id.Value, name.Value, Optional.ToNullable(type), Optional.ToNullable(location), Optional.ToDictionary(tags), extendedLocation.Value, Optional.ToNullable(etag), virtualMachine, networkSecurityGroup.Value, privateEndpoint.Value, Optional.ToList(ipConfigurations), Optional.ToList(tapConfigurations), dnsSettings.Value, macAddress.Value, Optional.ToNullable(primary), Optional.ToNullable(enableAcceleratedNetworking), Optional.ToNullable(enableIPForwarding), Optional.ToList(hostedWorkloads), dscpConfiguration, Optional.ToNullable(resourceGuid), Optional.ToNullable(provisioningState), workloadType.Value, Optional.ToNullable(nicType), privateLinkService.Value, Optional.ToNullable(migrationPhase))); }
internal NetworkInterfaceTapConfiguration(ArmClient client, NetworkInterfaceTapConfigurationData data) : this(client, new ResourceIdentifier(data.Id)) { HasData = true; _data = data; }
public virtual async Task <ArmOperation <NetworkInterfaceTapConfigurationResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string tapConfigurationName, NetworkInterfaceTapConfigurationData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(tapConfigurationName, nameof(tapConfigurationName)); Argument.AssertNotNull(data, nameof(data)); using var scope = _networkInterfaceTapConfigurationClientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationCollection.CreateOrUpdate"); scope.Start(); try { var response = await _networkInterfaceTapConfigurationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tapConfigurationName, data, cancellationToken).ConfigureAwait(false); var operation = new NetworkArmOperation <NetworkInterfaceTapConfigurationResource>(new NetworkInterfaceTapConfigurationOperationSource(Client), _networkInterfaceTapConfigurationClientDiagnostics, Pipeline, _networkInterfaceTapConfigurationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tapConfigurationName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
internal NetworkInterfaceTapConfigurationResource(ArmClient client, NetworkInterfaceTapConfigurationData data) : this(client, data.Id) { HasData = true; _data = data; }
public async virtual Task <NetworkInterfaceTapConfigurationCreateOrUpdateOperation> CreateOrUpdateAsync(string tapConfigurationName, NetworkInterfaceTapConfigurationData tapConfigurationParameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (tapConfigurationName == null) { throw new ArgumentNullException(nameof(tapConfigurationName)); } if (tapConfigurationParameters == null) { throw new ArgumentNullException(nameof(tapConfigurationParameters)); } using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationCollection.CreateOrUpdate"); scope.Start(); try { var response = await _networkInterfaceTapConfigurationsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tapConfigurationName, tapConfigurationParameters, cancellationToken).ConfigureAwait(false); var operation = new NetworkInterfaceTapConfigurationCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _networkInterfaceTapConfigurationsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tapConfigurationName, tapConfigurationParameters).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
internal static VirtualNetworkTapData DeserializeVirtualNetworkTapData(JsonElement element) { Optional <string> etag = default; Optional <string> name = default; Optional <string> type = default; Optional <string> location = default; Optional <IDictionary <string, string> > tags = default; ResourceIdentifier id = default; Optional <IReadOnlyList <NetworkInterfaceTapConfigurationData> > networkInterfaceTapConfigurations = default; Optional <string> resourceGuid = default; Optional <ProvisioningState> provisioningState = default; Optional <NetworkInterfaceIPConfiguration> destinationNetworkInterfaceIPConfiguration = default; Optional <FrontendIPConfiguration> destinationLoadBalancerFrontEndIPConfiguration = default; Optional <int> destinationPort = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag")) { etag = 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("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("networkInterfaceTapConfigurations")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <NetworkInterfaceTapConfigurationData> array = new List <NetworkInterfaceTapConfigurationData>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(NetworkInterfaceTapConfigurationData.DeserializeNetworkInterfaceTapConfigurationData(item)); } networkInterfaceTapConfigurations = array; continue; } if (property0.NameEquals("resourceGuid")) { resourceGuid = property0.Value.GetString(); continue; } if (property0.NameEquals("provisioningState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } provisioningState = new ProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("destinationNetworkInterfaceIPConfiguration")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } destinationNetworkInterfaceIPConfiguration = NetworkInterfaceIPConfiguration.DeserializeNetworkInterfaceIPConfiguration(property0.Value); continue; } if (property0.NameEquals("destinationLoadBalancerFrontEndIPConfiguration")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } destinationLoadBalancerFrontEndIPConfiguration = FrontendIPConfiguration.DeserializeFrontendIPConfiguration(property0.Value); continue; } if (property0.NameEquals("destinationPort")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } destinationPort = property0.Value.GetInt32(); continue; } } continue; } } return(new VirtualNetworkTapData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(networkInterfaceTapConfigurations), resourceGuid.Value, Optional.ToNullable(provisioningState), destinationNetworkInterfaceIPConfiguration.Value, destinationLoadBalancerFrontEndIPConfiguration.Value, Optional.ToNullable(destinationPort))); }
public virtual ArmOperation <NetworkInterfaceTapConfiguration> CreateOrUpdate(bool waitForCompletion, string tapConfigurationName, NetworkInterfaceTapConfigurationData tapConfigurationParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(tapConfigurationName, nameof(tapConfigurationName)); Argument.AssertNotNull(tapConfigurationParameters, nameof(tapConfigurationParameters)); using var scope = _networkInterfaceTapConfigurationClientDiagnostics.CreateScope("NetworkInterfaceTapConfigurationCollection.CreateOrUpdate"); scope.Start(); try { var response = _networkInterfaceTapConfigurationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tapConfigurationName, tapConfigurationParameters, cancellationToken); var operation = new NetworkArmOperation <NetworkInterfaceTapConfiguration>(new NetworkInterfaceTapConfigurationOperationSource(Client), _networkInterfaceTapConfigurationClientDiagnostics, Pipeline, _networkInterfaceTapConfigurationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, tapConfigurationName, tapConfigurationParameters).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }