1package synapse 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "github.com/Azure/go-autorest/autorest" 12 "github.com/Azure/go-autorest/autorest/azure" 13 "github.com/Azure/go-autorest/autorest/validation" 14 "github.com/Azure/go-autorest/tracing" 15 "net/http" 16) 17 18// IntegrationRuntimeStatusClient is the azure Synapse Analytics Management Client 19type IntegrationRuntimeStatusClient struct { 20 BaseClient 21} 22 23// NewIntegrationRuntimeStatusClient creates an instance of the IntegrationRuntimeStatusClient client. 24func NewIntegrationRuntimeStatusClient(subscriptionID string) IntegrationRuntimeStatusClient { 25 return NewIntegrationRuntimeStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) 26} 27 28// NewIntegrationRuntimeStatusClientWithBaseURI creates an instance of the IntegrationRuntimeStatusClient client using 29// a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign 30// clouds, Azure stack). 31func NewIntegrationRuntimeStatusClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeStatusClient { 32 return IntegrationRuntimeStatusClient{NewWithBaseURI(baseURI, subscriptionID)} 33} 34 35// Get get the integration runtime status 36// Parameters: 37// resourceGroupName - the name of the resource group. The name is case insensitive. 38// workspaceName - the name of the workspace. 39// integrationRuntimeName - integration runtime name 40func (client IntegrationRuntimeStatusClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimeStatusResponse, err error) { 41 if tracing.IsEnabled() { 42 ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeStatusClient.Get") 43 defer func() { 44 sc := -1 45 if result.Response.Response != nil { 46 sc = result.Response.Response.StatusCode 47 } 48 tracing.EndSpan(ctx, sc, err) 49 }() 50 } 51 if err := validation.Validate([]validation.Validation{ 52 {TargetValue: client.SubscriptionID, 53 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, 54 {TargetValue: resourceGroupName, 55 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 56 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 57 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { 58 return result, validation.NewError("synapse.IntegrationRuntimeStatusClient", "Get", err.Error()) 59 } 60 61 req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) 62 if err != nil { 63 err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeStatusClient", "Get", nil, "Failure preparing request") 64 return 65 } 66 67 resp, err := client.GetSender(req) 68 if err != nil { 69 result.Response = autorest.Response{Response: resp} 70 err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeStatusClient", "Get", resp, "Failure sending request") 71 return 72 } 73 74 result, err = client.GetResponder(resp) 75 if err != nil { 76 err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeStatusClient", "Get", resp, "Failure responding to request") 77 return 78 } 79 80 return 81} 82 83// GetPreparer prepares the Get request. 84func (client IntegrationRuntimeStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { 85 pathParameters := map[string]interface{}{ 86 "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), 87 "resourceGroupName": autorest.Encode("path", resourceGroupName), 88 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 89 "workspaceName": autorest.Encode("path", workspaceName), 90 } 91 92 const APIVersion = "2020-12-01" 93 queryParameters := map[string]interface{}{ 94 "api-version": APIVersion, 95 } 96 97 preparer := autorest.CreatePreparer( 98 autorest.AsPost(), 99 autorest.WithBaseURL(client.BaseURI), 100 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getStatus", pathParameters), 101 autorest.WithQueryParameters(queryParameters)) 102 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 103} 104 105// GetSender sends the Get request. The method will close the 106// http.Response Body if it receives an error. 107func (client IntegrationRuntimeStatusClient) GetSender(req *http.Request) (*http.Response, error) { 108 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 109} 110 111// GetResponder handles the response to the Get request. The method always 112// closes the http.Response Body. 113func (client IntegrationRuntimeStatusClient) GetResponder(resp *http.Response) (result IntegrationRuntimeStatusResponse, err error) { 114 err = autorest.Respond( 115 resp, 116 azure.WithErrorUnlessStatusCode(http.StatusOK), 117 autorest.ByUnmarshallingJSON(&result), 118 autorest.ByClosing()) 119 result.Response = autorest.Response{Response: resp} 120 return 121} 122