public Response Update(string subscriptionId, string resourceGroupName, string dnsResolverName, string inboundEndpointName, InboundEndpointPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(dnsResolverName, nameof(dnsResolverName)); Argument.AssertNotNullOrEmpty(inboundEndpointName, nameof(inboundEndpointName)); Argument.AssertNotNull(patch, nameof(patch)); using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, dnsResolverName, inboundEndpointName, patch, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: case 202: return(message.Response); default: throw new RequestFailedException(message.Response); } }
public virtual ArmOperation <InboundEndpointResource> Update(WaitUntil waitUntil, InboundEndpointPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); using var scope = _inboundEndpointClientDiagnostics.CreateScope("InboundEndpointResource.Update"); scope.Start(); try { var response = _inboundEndpointRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, ifMatch, cancellationToken); var operation = new DnsResolverArmOperation <InboundEndpointResource>(new InboundEndpointOperationSource(Client), _inboundEndpointClientDiagnostics, Pipeline, _inboundEndpointRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string dnsResolverName, string inboundEndpointName, InboundEndpointPatch patch, string ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Patch; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Network/dnsResolvers/", false); uri.AppendPath(dnsResolverName, true); uri.AppendPath("/inboundEndpoints/", false); uri.AppendPath(inboundEndpointName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; if (ifMatch != null) { request.Headers.Add("If-Match", ifMatch); } request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(patch); request.Content = content; _userAgent.Apply(message); return(message); }