public async Task <Response <HubIpConfigurationData> > GetAsync(string subscriptionId, string resourceGroupName, string virtualHubName, string ipConfigName, CancellationToken cancellationToken = default) { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (virtualHubName == null) { throw new ArgumentNullException(nameof(virtualHubName)); } if (ipConfigName == null) { throw new ArgumentNullException(nameof(ipConfigName)); } using var message = CreateGetRequest(subscriptionId, resourceGroupName, virtualHubName, ipConfigName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { HubIpConfigurationData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = HubIpConfigurationData.DeserializeHubIpConfigurationData(document.RootElement); return(Response.FromValue(value, message.Response)); }
internal HubIpConfiguration(ArmResource options, HubIpConfigurationData resource) : base(options, new ResourceIdentifier(resource.Id)) { HasData = true; _data = resource; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _virtualHubIpConfigurationRestClient = new VirtualHubIpConfigurationRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); }
HubIpConfiguration IOperationSource <HubIpConfiguration> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = HubIpConfigurationData.DeserializeHubIpConfigurationData(document.RootElement); return(new HubIpConfiguration(_client, data)); }
internal HubIpConfiguration(ArmResource options, HubIpConfigurationData resource) : base(options, resource.Id) { HasData = true; _data = resource; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _restClient = new VirtualHubIpConfigurationRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); }
internal HubIpConfiguration(ArmClient armClient, HubIpConfigurationData data) : this(armClient, new ResourceIdentifier(data.Id)) { HasData = true; _data = data; }
public async virtual Task <HubIpConfigurationCreateOrUpdateOperation> CreateOrUpdateAsync(bool waitForCompletion, string ipConfigName, HubIpConfigurationData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(ipConfigName, nameof(ipConfigName)); if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _hubIpConfigurationVirtualHubIpConfigurationClientDiagnostics.CreateScope("HubIpConfigurationCollection.CreateOrUpdate"); scope.Start(); try { var response = await _hubIpConfigurationVirtualHubIpConfigurationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ipConfigName, parameters, cancellationToken).ConfigureAwait(false); var operation = new HubIpConfigurationCreateOrUpdateOperation(ArmClient, _hubIpConfigurationVirtualHubIpConfigurationClientDiagnostics, Pipeline, _hubIpConfigurationVirtualHubIpConfigurationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ipConfigName, parameters).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual VirtualHubIpConfigurationCreateOrUpdateOperation CreateOrUpdate(string ipConfigName, HubIpConfigurationData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (ipConfigName == null) { throw new ArgumentNullException(nameof(ipConfigName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("HubIpConfigurationCollection.CreateOrUpdate"); scope.Start(); try { var response = _virtualHubIpConfigurationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ipConfigName, parameters, cancellationToken); var operation = new VirtualHubIpConfigurationCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _virtualHubIpConfigurationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ipConfigName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <HubIpConfiguration> CreateOrUpdate(bool waitForCompletion, string ipConfigName, HubIpConfigurationData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(ipConfigName, nameof(ipConfigName)); Argument.AssertNotNull(parameters, nameof(parameters)); using var scope = _hubIpConfigurationVirtualHubIpConfigurationClientDiagnostics.CreateScope("HubIpConfigurationCollection.CreateOrUpdate"); scope.Start(); try { var response = _hubIpConfigurationVirtualHubIpConfigurationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ipConfigName, parameters, cancellationToken); var operation = new NetworkArmOperation <HubIpConfiguration>(new HubIpConfigurationOperationSource(Client), _hubIpConfigurationVirtualHubIpConfigurationClientDiagnostics, Pipeline, _hubIpConfigurationVirtualHubIpConfigurationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ipConfigName, parameters).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }