Blame vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-09-01/network/vpnsitelinkconnections.go

Packit Service 4d2de5
package network
Packit Service 4d2de5
Packit Service 4d2de5
// Copyright (c) Microsoft and contributors.  All rights reserved.
Packit Service 4d2de5
//
Packit Service 4d2de5
// Licensed under the Apache License, Version 2.0 (the "License");
Packit Service 4d2de5
// you may not use this file except in compliance with the License.
Packit Service 4d2de5
// You may obtain a copy of the License at
Packit Service 4d2de5
// http://www.apache.org/licenses/LICENSE-2.0
Packit Service 4d2de5
//
Packit Service 4d2de5
// Unless required by applicable law or agreed to in writing, software
Packit Service 4d2de5
// distributed under the License is distributed on an "AS IS" BASIS,
Packit Service 4d2de5
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit Service 4d2de5
//
Packit Service 4d2de5
// See the License for the specific language governing permissions and
Packit Service 4d2de5
// limitations under the License.
Packit Service 4d2de5
//
Packit Service 4d2de5
// Code generated by Microsoft (R) AutoRest Code Generator.
Packit Service 4d2de5
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
Packit Service 4d2de5
Packit Service 4d2de5
import (
Packit Service 4d2de5
	"context"
Packit Service 4d2de5
	"github.com/Azure/go-autorest/autorest"
Packit Service 4d2de5
	"github.com/Azure/go-autorest/autorest/azure"
Packit Service 4d2de5
	"github.com/Azure/go-autorest/tracing"
Packit Service 4d2de5
	"net/http"
Packit Service 4d2de5
)
Packit Service 4d2de5
Packit Service 4d2de5
// VpnSiteLinkConnectionsClient is the network Client
Packit Service 4d2de5
type VpnSiteLinkConnectionsClient struct {
Packit Service 4d2de5
	BaseClient
Packit Service 4d2de5
}
Packit Service 4d2de5
Packit Service 4d2de5
// NewVpnSiteLinkConnectionsClient creates an instance of the VpnSiteLinkConnectionsClient client.
Packit Service 4d2de5
func NewVpnSiteLinkConnectionsClient(subscriptionID string) VpnSiteLinkConnectionsClient {
Packit Service 4d2de5
	return NewVpnSiteLinkConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
Packit Service 4d2de5
}
Packit Service 4d2de5
Packit Service 4d2de5
// NewVpnSiteLinkConnectionsClientWithBaseURI creates an instance of the VpnSiteLinkConnectionsClient client using a
Packit Service 4d2de5
// custom endpoint.  Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds,
Packit Service 4d2de5
// Azure stack).
Packit Service 4d2de5
func NewVpnSiteLinkConnectionsClientWithBaseURI(baseURI string, subscriptionID string) VpnSiteLinkConnectionsClient {
Packit Service 4d2de5
	return VpnSiteLinkConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)}
Packit Service 4d2de5
}
Packit Service 4d2de5
Packit Service 4d2de5
// Get retrieves the details of a vpn site link connection.
Packit Service 4d2de5
// Parameters:
Packit Service 4d2de5
// resourceGroupName - the resource group name of the VpnGateway.
Packit Service 4d2de5
// gatewayName - the name of the gateway.
Packit Service 4d2de5
// connectionName - the name of the vpn connection.
Packit Service 4d2de5
// linkConnectionName - the name of the vpn connection.
Packit Service 4d2de5
func (client VpnSiteLinkConnectionsClient) Get(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string) (result VpnSiteLinkConnection, err error) {
Packit Service 4d2de5
	if tracing.IsEnabled() {
Packit Service 4d2de5
		ctx = tracing.StartSpan(ctx, fqdn+"/VpnSiteLinkConnectionsClient.Get")
Packit Service 4d2de5
		defer func() {
Packit Service 4d2de5
			sc := -1
Packit Service 4d2de5
			if result.Response.Response != nil {
Packit Service 4d2de5
				sc = result.Response.Response.StatusCode
Packit Service 4d2de5
			}
Packit Service 4d2de5
			tracing.EndSpan(ctx, sc, err)
Packit Service 4d2de5
		}()
Packit Service 4d2de5
	}
Packit Service 4d2de5
	req, err := client.GetPreparer(ctx, resourceGroupName, gatewayName, connectionName, linkConnectionName)
Packit Service 4d2de5
	if err != nil {
Packit Service 4d2de5
		err = autorest.NewErrorWithError(err, "network.VpnSiteLinkConnectionsClient", "Get", nil, "Failure preparing request")
Packit Service 4d2de5
		return
Packit Service 4d2de5
	}
Packit Service 4d2de5
Packit Service 4d2de5
	resp, err := client.GetSender(req)
Packit Service 4d2de5
	if err != nil {
Packit Service 4d2de5
		result.Response = autorest.Response{Response: resp}
Packit Service 4d2de5
		err = autorest.NewErrorWithError(err, "network.VpnSiteLinkConnectionsClient", "Get", resp, "Failure sending request")
Packit Service 4d2de5
		return
Packit Service 4d2de5
	}
Packit Service 4d2de5
Packit Service 4d2de5
	result, err = client.GetResponder(resp)
Packit Service 4d2de5
	if err != nil {
Packit Service 4d2de5
		err = autorest.NewErrorWithError(err, "network.VpnSiteLinkConnectionsClient", "Get", resp, "Failure responding to request")
Packit Service 4d2de5
	}
Packit Service 4d2de5
Packit Service 4d2de5
	return
Packit Service 4d2de5
}
Packit Service 4d2de5
Packit Service 4d2de5
// GetPreparer prepares the Get request.
Packit Service 4d2de5
func (client VpnSiteLinkConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string) (*http.Request, error) {
Packit Service 4d2de5
	pathParameters := map[string]interface{}{
Packit Service 4d2de5
		"connectionName":     autorest.Encode("path", connectionName),
Packit Service 4d2de5
		"gatewayName":        autorest.Encode("path", gatewayName),
Packit Service 4d2de5
		"linkConnectionName": autorest.Encode("path", linkConnectionName),
Packit Service 4d2de5
		"resourceGroupName":  autorest.Encode("path", resourceGroupName),
Packit Service 4d2de5
		"subscriptionId":     autorest.Encode("path", client.SubscriptionID),
Packit Service 4d2de5
	}
Packit Service 4d2de5
Packit Service 4d2de5
	const APIVersion = "2019-09-01"
Packit Service 4d2de5
	queryParameters := map[string]interface{}{
Packit Service 4d2de5
		"api-version": APIVersion,
Packit Service 4d2de5
	}
Packit Service 4d2de5
Packit Service 4d2de5
	preparer := autorest.CreatePreparer(
Packit Service 4d2de5
		autorest.AsGet(),
Packit Service 4d2de5
		autorest.WithBaseURL(client.BaseURI),
Packit Service 4d2de5
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}", pathParameters),
Packit Service 4d2de5
		autorest.WithQueryParameters(queryParameters))
Packit Service 4d2de5
	return preparer.Prepare((&http.Request{}).WithContext(ctx))
Packit Service 4d2de5
}
Packit Service 4d2de5
Packit Service 4d2de5
// GetSender sends the Get request. The method will close the
Packit Service 4d2de5
// http.Response Body if it receives an error.
Packit Service 4d2de5
func (client VpnSiteLinkConnectionsClient) GetSender(req *http.Request) (*http.Response, error) {
Packit Service 4d2de5
	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
Packit Service 4d2de5
}
Packit Service 4d2de5
Packit Service 4d2de5
// GetResponder handles the response to the Get request. The method always
Packit Service 4d2de5
// closes the http.Response Body.
Packit Service 4d2de5
func (client VpnSiteLinkConnectionsClient) GetResponder(resp *http.Response) (result VpnSiteLinkConnection, err error) {
Packit Service 4d2de5
	err = autorest.Respond(
Packit Service 4d2de5
		resp,
Packit Service 4d2de5
		client.ByInspecting(),
Packit Service 4d2de5
		azure.WithErrorUnlessStatusCode(http.StatusOK),
Packit Service 4d2de5
		autorest.ByUnmarshallingJSON(&result),
Packit Service 4d2de5
		autorest.ByClosing())
Packit Service 4d2de5
	result.Response = autorest.Response{Response: resp}
Packit Service 4d2de5
	return
Packit Service 4d2de5
}