1package synapse 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "github.com/Azure/go-autorest/autorest/validation" 25 "github.com/Azure/go-autorest/tracing" 26 "net/http" 27) 28 29// IntegrationRuntimeNodeIPAddressClient is the azure Synapse Analytics Management Client 30type IntegrationRuntimeNodeIPAddressClient struct { 31 BaseClient 32} 33 34// NewIntegrationRuntimeNodeIPAddressClient creates an instance of the IntegrationRuntimeNodeIPAddressClient client. 35func NewIntegrationRuntimeNodeIPAddressClient(subscriptionID string) IntegrationRuntimeNodeIPAddressClient { 36 return NewIntegrationRuntimeNodeIPAddressClientWithBaseURI(DefaultBaseURI, subscriptionID) 37} 38 39// NewIntegrationRuntimeNodeIPAddressClientWithBaseURI creates an instance of the IntegrationRuntimeNodeIPAddressClient 40// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI 41// (sovereign clouds, Azure stack). 42func NewIntegrationRuntimeNodeIPAddressClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeNodeIPAddressClient { 43 return IntegrationRuntimeNodeIPAddressClient{NewWithBaseURI(baseURI, subscriptionID)} 44} 45 46// Get get the IP address of an integration runtime node 47// Parameters: 48// resourceGroupName - the name of the resource group. The name is case insensitive. 49// workspaceName - the name of the workspace. 50// integrationRuntimeName - integration runtime name 51// nodeName - integration runtime node name 52func (client IntegrationRuntimeNodeIPAddressClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (result IntegrationRuntimeNodeIPAddress, err error) { 53 if tracing.IsEnabled() { 54 ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeNodeIPAddressClient.Get") 55 defer func() { 56 sc := -1 57 if result.Response.Response != nil { 58 sc = result.Response.Response.StatusCode 59 } 60 tracing.EndSpan(ctx, sc, err) 61 }() 62 } 63 if err := validation.Validate([]validation.Validation{ 64 {TargetValue: client.SubscriptionID, 65 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, 66 {TargetValue: resourceGroupName, 67 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 68 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 69 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { 70 return result, validation.NewError("synapse.IntegrationRuntimeNodeIPAddressClient", "Get", err.Error()) 71 } 72 73 req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, nodeName) 74 if err != nil { 75 err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodeIPAddressClient", "Get", nil, "Failure preparing request") 76 return 77 } 78 79 resp, err := client.GetSender(req) 80 if err != nil { 81 result.Response = autorest.Response{Response: resp} 82 err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodeIPAddressClient", "Get", resp, "Failure sending request") 83 return 84 } 85 86 result, err = client.GetResponder(resp) 87 if err != nil { 88 err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeNodeIPAddressClient", "Get", resp, "Failure responding to request") 89 return 90 } 91 92 return 93} 94 95// GetPreparer prepares the Get request. 96func (client IntegrationRuntimeNodeIPAddressClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, nodeName string) (*http.Request, error) { 97 pathParameters := map[string]interface{}{ 98 "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), 99 "nodeName": autorest.Encode("path", nodeName), 100 "resourceGroupName": autorest.Encode("path", resourceGroupName), 101 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 102 "workspaceName": autorest.Encode("path", workspaceName), 103 } 104 105 const APIVersion = "2019-06-01-preview" 106 queryParameters := map[string]interface{}{ 107 "api-version": APIVersion, 108 } 109 110 preparer := autorest.CreatePreparer( 111 autorest.AsPost(), 112 autorest.WithBaseURL(client.BaseURI), 113 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}/ipAddress", pathParameters), 114 autorest.WithQueryParameters(queryParameters)) 115 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 116} 117 118// GetSender sends the Get request. The method will close the 119// http.Response Body if it receives an error. 120func (client IntegrationRuntimeNodeIPAddressClient) GetSender(req *http.Request) (*http.Response, error) { 121 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 122} 123 124// GetResponder handles the response to the Get request. The method always 125// closes the http.Response Body. 126func (client IntegrationRuntimeNodeIPAddressClient) GetResponder(resp *http.Response) (result IntegrationRuntimeNodeIPAddress, err error) { 127 err = autorest.Respond( 128 resp, 129 azure.WithErrorUnlessStatusCode(http.StatusOK), 130 autorest.ByUnmarshallingJSON(&result), 131 autorest.ByClosing()) 132 result.Response = autorest.Response{Response: resp} 133 return 134} 135