From e19a0158b1359e834daa4659c11ebac58da77ce2 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 11 Sep 2018 10:51:35 -0700 Subject: [PATCH] [AutoPR] network/resource-manager (#2620) * Generated from 40a59444fdb1c16031dbb33bcb8c81c12effb1c5 (#2597) * [AutoPR network/resource-manager] Microsot.Network/virtualnetworkgateways Reset VPN Client Shared Key (#2468) * Generated from fb70fd5547bd9d82379d82d5bb640285f9132e07 typo * Generated from aafca9c5d4b05246548aeb1b83ce0f1c96c1f635 CR rename * Generated from aafca9c5d4b05246548aeb1b83ce0f1c96c1f635 CR rename --- .../network/mgmt/2018-06-01/network/models.go | 23 ++++++ .../network/virtualnetworkgateways.go | 71 +++++++++++++++++++ 2 files changed, 94 insertions(+) diff --git a/services/network/mgmt/2018-06-01/network/models.go b/services/network/mgmt/2018-06-01/network/models.go index d9ef6e372b5b..27fc6a325904 100644 --- a/services/network/mgmt/2018-06-01/network/models.go +++ b/services/network/mgmt/2018-06-01/network/models.go @@ -17578,6 +17578,29 @@ func (future *VirtualNetworkGatewaysResetFuture) Result(client VirtualNetworkGat return } +// VirtualNetworkGatewaysResetVpnClientSharedKeyFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type VirtualNetworkGatewaysResetVpnClientSharedKeyFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *VirtualNetworkGatewaysResetVpnClientSharedKeyFuture) Result(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetVpnClientSharedKeyFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysResetVpnClientSharedKeyFuture") + return + } + ar.Response = future.Response() + return +} + // VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture an abstraction for monitoring and retrieving the results // of a long-running operation. type VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture struct { diff --git a/services/network/mgmt/2018-06-01/network/virtualnetworkgateways.go b/services/network/mgmt/2018-06-01/network/virtualnetworkgateways.go index 93daa0f71c70..ba9a78be9abc 100644 --- a/services/network/mgmt/2018-06-01/network/virtualnetworkgateways.go +++ b/services/network/mgmt/2018-06-01/network/virtualnetworkgateways.go @@ -1037,6 +1037,77 @@ func (client VirtualNetworkGatewaysClient) ResetResponder(resp *http.Response) ( return } +// ResetVpnClientSharedKey resets the VPN client shared key of the virtual network gateway in the specified resource +// group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysResetVpnClientSharedKeyFuture, err error) { + req, err := client.ResetVpnClientSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ResetVpnClientSharedKey", nil, "Failure preparing request") + return + } + + result, err = client.ResetVpnClientSharedKeySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ResetVpnClientSharedKey", result.Response(), "Failure sending request") + return + } + + return +} + +// ResetVpnClientSharedKeyPreparer prepares the ResetVpnClientSharedKey request. +func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKeyPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2018-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/resetvpnclientsharedkey", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetVpnClientSharedKeySender sends the ResetVpnClientSharedKey request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKeySender(req *http.Request) (future VirtualNetworkGatewaysResetVpnClientSharedKeyFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ResetVpnClientSharedKeyResponder handles the response to the ResetVpnClientSharedKey request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKeyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + // SetVpnclientIpsecParameters the Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S // client of virtual network gateway in the specified resource group through Network resource provider. // Parameters: