public async Task <Response <OutboundFirewallRuleData> > GetAsync(string subscriptionId, string resourceGroupName, string serverName, string outboundRuleFqdn, CancellationToken cancellationToken = default) { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (serverName == null) { throw new ArgumentNullException(nameof(serverName)); } if (outboundRuleFqdn == null) { throw new ArgumentNullException(nameof(outboundRuleFqdn)); } using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, outboundRuleFqdn); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { OutboundFirewallRuleData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = OutboundFirewallRuleData.DeserializeOutboundFirewallRuleData(document.RootElement); return(Response.FromValue(value, message.Response)); }
internal OutboundFirewallRule(ArmResource options, OutboundFirewallRuleData resource) : base(options, resource.Id) { HasData = true; _data = resource; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _outboundFirewallRulesRestClient = new OutboundFirewallRulesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); }
OutboundFirewallRule IOperationSource <OutboundFirewallRule> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = OutboundFirewallRuleData.DeserializeOutboundFirewallRuleData(document.RootElement); return(new OutboundFirewallRule(_client, data)); }
internal OutboundFirewallRuleResource(ArmClient client, OutboundFirewallRuleData data) : this(client, data.Id) { HasData = true; _data = data; }
public virtual ArmOperation <OutboundFirewallRuleResource> Update(WaitUntil waitUntil, OutboundFirewallRuleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _outboundFirewallRuleClientDiagnostics.CreateScope("OutboundFirewallRuleResource.Update"); scope.Start(); try { var response = _outboundFirewallRuleRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); var operation = new SqlArmOperation <OutboundFirewallRuleResource>(new OutboundFirewallRuleOperationSource(Client), _outboundFirewallRuleClientDiagnostics, Pipeline, _outboundFirewallRuleRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <ArmOperation <OutboundFirewallRule> > CreateOrUpdateAsync(WaitUntil waitUntil, string outboundRuleFqdn, OutboundFirewallRuleData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(outboundRuleFqdn, nameof(outboundRuleFqdn)); Argument.AssertNotNull(parameters, nameof(parameters)); using var scope = _outboundFirewallRuleClientDiagnostics.CreateScope("OutboundFirewallRuleCollection.CreateOrUpdate"); scope.Start(); try { var response = await _outboundFirewallRuleRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, outboundRuleFqdn, parameters, cancellationToken).ConfigureAwait(false); var operation = new SqlArmOperation <OutboundFirewallRule>(new OutboundFirewallRuleOperationSource(Client), _outboundFirewallRuleClientDiagnostics, Pipeline, _outboundFirewallRuleRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, outboundRuleFqdn, parameters).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <OutboundFirewallRuleCreateOrUpdateOperation> CreateOrUpdateAsync(string outboundRuleFqdn, OutboundFirewallRuleData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (outboundRuleFqdn == null) { throw new ArgumentNullException(nameof(outboundRuleFqdn)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("OutboundFirewallRuleCollection.CreateOrUpdate"); scope.Start(); try { var response = await _outboundFirewallRulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, outboundRuleFqdn, parameters, cancellationToken).ConfigureAwait(false); var operation = new OutboundFirewallRuleCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _outboundFirewallRulesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, outboundRuleFqdn, parameters).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual OutboundFirewallRuleCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string outboundRuleFqdn, OutboundFirewallRuleData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(outboundRuleFqdn, nameof(outboundRuleFqdn)); if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _outboundFirewallRuleClientDiagnostics.CreateScope("OutboundFirewallRuleCollection.CreateOrUpdate"); scope.Start(); try { var response = _outboundFirewallRuleRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, outboundRuleFqdn, parameters, cancellationToken); var operation = new OutboundFirewallRuleCreateOrUpdateOperation(ArmClient, _outboundFirewallRuleClientDiagnostics, Pipeline, _outboundFirewallRuleRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, outboundRuleFqdn, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
internal OutboundFirewallRule(ArmClient armClient, OutboundFirewallRuleData data) : this(armClient, data.Id) { HasData = true; _data = data; }