public virtual Response <SapSizingRecommendationResult> SapSizingRecommendations(string location, SapSizingRecommendationContent content = null, CancellationToken cancellationToken = default) { using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.SapSizingRecommendations"); scope.Start(); try { var response = DefaultRestClient.SapSizingRecommendations(Id.SubscriptionId, location, content, cancellationToken); return(response); } catch (Exception e) { scope.Failed(e); throw; } }
public static Response <SapSizingRecommendationResult> SapSizingRecommendations(this SubscriptionResource subscriptionResource, string location, SapSizingRecommendationContent content = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(location, nameof(location)); return(GetExtensionClient(subscriptionResource).SapSizingRecommendations(location, content, cancellationToken)); }
public async Task <Response <SapSizingRecommendationResult> > SapSizingRecommendationsAsync(string subscriptionId, string location, SapSizingRecommendationContent content = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(location, nameof(location)); using var message = CreateSapSizingRecommendationsRequest(subscriptionId, location, content); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { SapSizingRecommendationResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = SapSizingRecommendationResult.DeserializeSapSizingRecommendationResult(document.RootElement); return(Response.FromValue(value, message.Response)); }
public static async Task <Response <SapSizingRecommendationResult> > SapSizingRecommendationsAsync(this SubscriptionResource subscriptionResource, string location, SapSizingRecommendationContent content = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(location, nameof(location)); return(await GetExtensionClient(subscriptionResource).SapSizingRecommendationsAsync(location, content, cancellationToken).ConfigureAwait(false)); }
internal HttpMessage CreateSapSizingRecommendationsRequest(string subscriptionId, string location, SapSizingRecommendationContent content) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.Workloads/locations/", false); uri.AppendPath(location, true); uri.AppendPath("/sapVirtualInstanceMetadata/default/getSizingRecommendations", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); if (content != null) { request.Headers.Add("Content-Type", "application/json"); var content0 = new Utf8JsonRequestContent(); content0.JsonWriter.WriteObjectValue(content); request.Content = content0; } _userAgent.Apply(message); return(message); }