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// IntegrationRuntimeObjectMetadataClient is the azure Synapse Analytics Management Client 19type IntegrationRuntimeObjectMetadataClient struct { 20 BaseClient 21} 22 23// NewIntegrationRuntimeObjectMetadataClient creates an instance of the IntegrationRuntimeObjectMetadataClient client. 24func NewIntegrationRuntimeObjectMetadataClient(subscriptionID string) IntegrationRuntimeObjectMetadataClient { 25 return NewIntegrationRuntimeObjectMetadataClientWithBaseURI(DefaultBaseURI, subscriptionID) 26} 27 28// NewIntegrationRuntimeObjectMetadataClientWithBaseURI creates an instance of the 29// IntegrationRuntimeObjectMetadataClient client using a custom endpoint. Use this when interacting with an Azure 30// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). 31func NewIntegrationRuntimeObjectMetadataClientWithBaseURI(baseURI string, subscriptionID string) IntegrationRuntimeObjectMetadataClient { 32 return IntegrationRuntimeObjectMetadataClient{NewWithBaseURI(baseURI, subscriptionID)} 33} 34 35// List get object metadata from an integration runtime 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 40// getMetadataRequest - the parameters for getting a SSIS object metadata. 41func (client IntegrationRuntimeObjectMetadataClient) List(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, getMetadataRequest *GetSsisObjectMetadataRequest) (result SsisObjectMetadataListResponse, err error) { 42 if tracing.IsEnabled() { 43 ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeObjectMetadataClient.List") 44 defer func() { 45 sc := -1 46 if result.Response.Response != nil { 47 sc = result.Response.Response.StatusCode 48 } 49 tracing.EndSpan(ctx, sc, err) 50 }() 51 } 52 if err := validation.Validate([]validation.Validation{ 53 {TargetValue: client.SubscriptionID, 54 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, 55 {TargetValue: resourceGroupName, 56 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 57 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 58 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { 59 return result, validation.NewError("synapse.IntegrationRuntimeObjectMetadataClient", "List", err.Error()) 60 } 61 62 req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName, getMetadataRequest) 63 if err != nil { 64 err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataClient", "List", nil, "Failure preparing request") 65 return 66 } 67 68 resp, err := client.ListSender(req) 69 if err != nil { 70 result.Response = autorest.Response{Response: resp} 71 err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataClient", "List", resp, "Failure sending request") 72 return 73 } 74 75 result, err = client.ListResponder(resp) 76 if err != nil { 77 err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataClient", "List", resp, "Failure responding to request") 78 return 79 } 80 81 return 82} 83 84// ListPreparer prepares the List request. 85func (client IntegrationRuntimeObjectMetadataClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string, getMetadataRequest *GetSsisObjectMetadataRequest) (*http.Request, error) { 86 pathParameters := map[string]interface{}{ 87 "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), 88 "resourceGroupName": autorest.Encode("path", resourceGroupName), 89 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 90 "workspaceName": autorest.Encode("path", workspaceName), 91 } 92 93 const APIVersion = "2021-03-01" 94 queryParameters := map[string]interface{}{ 95 "api-version": APIVersion, 96 } 97 98 preparer := autorest.CreatePreparer( 99 autorest.AsContentType("application/json; charset=utf-8"), 100 autorest.AsPost(), 101 autorest.WithBaseURL(client.BaseURI), 102 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getObjectMetadata", pathParameters), 103 autorest.WithQueryParameters(queryParameters)) 104 if getMetadataRequest != nil { 105 preparer = autorest.DecoratePreparer(preparer, 106 autorest.WithJSON(getMetadataRequest)) 107 } 108 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 109} 110 111// ListSender sends the List request. The method will close the 112// http.Response Body if it receives an error. 113func (client IntegrationRuntimeObjectMetadataClient) ListSender(req *http.Request) (*http.Response, error) { 114 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 115} 116 117// ListResponder handles the response to the List request. The method always 118// closes the http.Response Body. 119func (client IntegrationRuntimeObjectMetadataClient) ListResponder(resp *http.Response) (result SsisObjectMetadataListResponse, err error) { 120 err = autorest.Respond( 121 resp, 122 azure.WithErrorUnlessStatusCode(http.StatusOK), 123 autorest.ByUnmarshallingJSON(&result), 124 autorest.ByClosing()) 125 result.Response = autorest.Response{Response: resp} 126 return 127} 128 129// Refresh refresh the object metadata in an integration runtime 130// Parameters: 131// resourceGroupName - the name of the resource group. The name is case insensitive. 132// workspaceName - the name of the workspace. 133// integrationRuntimeName - integration runtime name 134func (client IntegrationRuntimeObjectMetadataClient) Refresh(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (result IntegrationRuntimeObjectMetadataRefreshFuture, err error) { 135 if tracing.IsEnabled() { 136 ctx = tracing.StartSpan(ctx, fqdn+"/IntegrationRuntimeObjectMetadataClient.Refresh") 137 defer func() { 138 sc := -1 139 if result.FutureAPI != nil && result.FutureAPI.Response() != nil { 140 sc = result.FutureAPI.Response().StatusCode 141 } 142 tracing.EndSpan(ctx, sc, err) 143 }() 144 } 145 if err := validation.Validate([]validation.Validation{ 146 {TargetValue: client.SubscriptionID, 147 Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, 148 {TargetValue: resourceGroupName, 149 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 150 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 151 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { 152 return result, validation.NewError("synapse.IntegrationRuntimeObjectMetadataClient", "Refresh", err.Error()) 153 } 154 155 req, err := client.RefreshPreparer(ctx, resourceGroupName, workspaceName, integrationRuntimeName) 156 if err != nil { 157 err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataClient", "Refresh", nil, "Failure preparing request") 158 return 159 } 160 161 result, err = client.RefreshSender(req) 162 if err != nil { 163 err = autorest.NewErrorWithError(err, "synapse.IntegrationRuntimeObjectMetadataClient", "Refresh", nil, "Failure sending request") 164 return 165 } 166 167 return 168} 169 170// RefreshPreparer prepares the Refresh request. 171func (client IntegrationRuntimeObjectMetadataClient) RefreshPreparer(ctx context.Context, resourceGroupName string, workspaceName string, integrationRuntimeName string) (*http.Request, error) { 172 pathParameters := map[string]interface{}{ 173 "integrationRuntimeName": autorest.Encode("path", integrationRuntimeName), 174 "resourceGroupName": autorest.Encode("path", resourceGroupName), 175 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 176 "workspaceName": autorest.Encode("path", workspaceName), 177 } 178 179 const APIVersion = "2021-03-01" 180 queryParameters := map[string]interface{}{ 181 "api-version": APIVersion, 182 } 183 184 preparer := autorest.CreatePreparer( 185 autorest.AsPost(), 186 autorest.WithBaseURL(client.BaseURI), 187 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/refreshObjectMetadata", pathParameters), 188 autorest.WithQueryParameters(queryParameters)) 189 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 190} 191 192// RefreshSender sends the Refresh request. The method will close the 193// http.Response Body if it receives an error. 194func (client IntegrationRuntimeObjectMetadataClient) RefreshSender(req *http.Request) (future IntegrationRuntimeObjectMetadataRefreshFuture, err error) { 195 var resp *http.Response 196 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 197 if err != nil { 198 return 199 } 200 var azf azure.Future 201 azf, err = azure.NewFutureFromResponse(resp) 202 future.FutureAPI = &azf 203 future.Result = future.result 204 return 205} 206 207// RefreshResponder handles the response to the Refresh request. The method always 208// closes the http.Response Body. 209func (client IntegrationRuntimeObjectMetadataClient) RefreshResponder(resp *http.Response) (result SsisObjectMetadataStatusResponse, err error) { 210 err = autorest.Respond( 211 resp, 212 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 213 autorest.ByUnmarshallingJSON(&result), 214 autorest.ByClosing()) 215 result.Response = autorest.Response{Response: resp} 216 return 217} 218