Adding the package
This commit is contained in:
Коммит
7243da7960
|
@ -0,0 +1,241 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.7.6, generator: @autorest/go@4.0.0-preview.42)
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package dataprotectiondatasourceplugin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
)
|
||||
|
||||
type BackupClient struct {
|
||||
pl runtime.Pipeline
|
||||
}
|
||||
|
||||
// NewBackupClient creates a new instance of BackupClient with the specified values.
|
||||
// pl - the pipeline used for sending requests and handling responses.
|
||||
func NewBackupClient(pl runtime.Pipeline) *BackupClient {
|
||||
client := &BackupClient{
|
||||
pl: pl,
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// Cancel - Cancel the operation. Poll the LRO to get the final status.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - BackupClientCancelOptions contains the optional parameters for the BackupClient.Cancel method.
|
||||
func (client *BackupClient) Cancel(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *BackupClientCancelOptions) (BackupClientCancelResponse, error) {
|
||||
req, err := client.cancelCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return BackupClientCancelResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return BackupClientCancelResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return BackupClientCancelResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.cancelHandleResponse(resp)
|
||||
}
|
||||
|
||||
// cancelCreateRequest creates the Cancel request.
|
||||
func (client *BackupClient) cancelCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *BackupClientCancelOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/backupOperations/{operationId}:cancel"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// cancelHandleResponse handles the Cancel response.
|
||||
func (client *BackupClient) cancelHandleResponse(resp *http.Response) (BackupClientCancelResponse, error) {
|
||||
result := BackupClientCancelResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return BackupClientCancelResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.BackupResponse); err != nil {
|
||||
return BackupClientCancelResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Get - Gets the status of a Backup LRO.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - Unique id of the resource
|
||||
// taskID - Unique id of the current task
|
||||
// xmsClientRequestID - Correlation request Id for tracking a particular request.
|
||||
// options - BackupClientGetOptions contains the optional parameters for the BackupClient.Get method.
|
||||
func (client *BackupClient) Get(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *BackupClientGetOptions) (BackupClientGetResponse, error) {
|
||||
req, err := client.getCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, options)
|
||||
if err != nil {
|
||||
return BackupClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return BackupClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return BackupClientGetResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.getHandleResponse(resp)
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *BackupClient) getCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *BackupClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/backupOperations/{operationId}"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *BackupClient) getHandleResponse(resp *http.Response) (BackupClientGetResponse, error) {
|
||||
result := BackupClientGetResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return BackupClientGetResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.BackupResponse); err != nil {
|
||||
return BackupClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// RefreshTokens - Refresh tokens for a given operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - BackupClientRefreshTokensOptions contains the optional parameters for the BackupClient.RefreshTokens method.
|
||||
func (client *BackupClient) RefreshTokens(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *BackupClientRefreshTokensOptions) (BackupClientRefreshTokensResponse, error) {
|
||||
req, err := client.refreshTokensCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return BackupClientRefreshTokensResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return BackupClientRefreshTokensResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return BackupClientRefreshTokensResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.refreshTokensHandleResponse(resp)
|
||||
}
|
||||
|
||||
// refreshTokensCreateRequest creates the RefreshTokens request.
|
||||
func (client *BackupClient) refreshTokensCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *BackupClientRefreshTokensOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/backupOperations/{operationId}:refreshTokens"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// refreshTokensHandleResponse handles the RefreshTokens response.
|
||||
func (client *BackupClient) refreshTokensHandleResponse(resp *http.Response) (BackupClientRefreshTokensResponse, error) {
|
||||
result := BackupClientRefreshTokensResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return BackupClientRefreshTokensResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.BackupResponse); err != nil {
|
||||
return BackupClientRefreshTokensResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
|
@ -0,0 +1,244 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.7.6, generator: @autorest/go@4.0.0-preview.42)
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package dataprotectiondatasourceplugin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
)
|
||||
|
||||
type CommitOrRollbackBackupClient struct {
|
||||
pl runtime.Pipeline
|
||||
}
|
||||
|
||||
// NewCommitOrRollbackBackupClient creates a new instance of CommitOrRollbackBackupClient with the specified values.
|
||||
// pl - the pipeline used for sending requests and handling responses.
|
||||
func NewCommitOrRollbackBackupClient(pl runtime.Pipeline) *CommitOrRollbackBackupClient {
|
||||
client := &CommitOrRollbackBackupClient{
|
||||
pl: pl,
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// Cancel - Cancel the operation. Poll the LRO to get the final status.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - CommitOrRollbackBackupClientCancelOptions contains the optional parameters for the CommitOrRollbackBackupClient.Cancel
|
||||
// method.
|
||||
func (client *CommitOrRollbackBackupClient) Cancel(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *CommitOrRollbackBackupClientCancelOptions) (CommitOrRollbackBackupClientCancelResponse, error) {
|
||||
req, err := client.cancelCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return CommitOrRollbackBackupClientCancelResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return CommitOrRollbackBackupClientCancelResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return CommitOrRollbackBackupClientCancelResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.cancelHandleResponse(resp)
|
||||
}
|
||||
|
||||
// cancelCreateRequest creates the Cancel request.
|
||||
func (client *CommitOrRollbackBackupClient) cancelCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *CommitOrRollbackBackupClientCancelOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/commitOrRollbackBackupOperations/{operationId}:cancel"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// cancelHandleResponse handles the Cancel response.
|
||||
func (client *CommitOrRollbackBackupClient) cancelHandleResponse(resp *http.Response) (CommitOrRollbackBackupClientCancelResponse, error) {
|
||||
result := CommitOrRollbackBackupClientCancelResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return CommitOrRollbackBackupClientCancelResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.CommitOrRollbackBackupResponse); err != nil {
|
||||
return CommitOrRollbackBackupClientCancelResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Get - Gets the status of a Backup LRO.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - Unique id of the resource
|
||||
// taskID - Unique id of the current task
|
||||
// xmsClientRequestID - Correlation request Id for tracking a particular request.
|
||||
// options - CommitOrRollbackBackupClientGetOptions contains the optional parameters for the CommitOrRollbackBackupClient.Get
|
||||
// method.
|
||||
func (client *CommitOrRollbackBackupClient) Get(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *CommitOrRollbackBackupClientGetOptions) (CommitOrRollbackBackupClientGetResponse, error) {
|
||||
req, err := client.getCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, options)
|
||||
if err != nil {
|
||||
return CommitOrRollbackBackupClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return CommitOrRollbackBackupClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return CommitOrRollbackBackupClientGetResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.getHandleResponse(resp)
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *CommitOrRollbackBackupClient) getCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *CommitOrRollbackBackupClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/commitOrRollbackBackupOperations/{operationId}"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *CommitOrRollbackBackupClient) getHandleResponse(resp *http.Response) (CommitOrRollbackBackupClientGetResponse, error) {
|
||||
result := CommitOrRollbackBackupClientGetResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return CommitOrRollbackBackupClientGetResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.CommitOrRollbackBackupResponse); err != nil {
|
||||
return CommitOrRollbackBackupClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// RefreshTokens - Refresh tokens for a given operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - CommitOrRollbackBackupClientRefreshTokensOptions contains the optional parameters for the CommitOrRollbackBackupClient.RefreshTokens
|
||||
// method.
|
||||
func (client *CommitOrRollbackBackupClient) RefreshTokens(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *CommitOrRollbackBackupClientRefreshTokensOptions) (CommitOrRollbackBackupClientRefreshTokensResponse, error) {
|
||||
req, err := client.refreshTokensCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return CommitOrRollbackBackupClientRefreshTokensResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return CommitOrRollbackBackupClientRefreshTokensResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return CommitOrRollbackBackupClientRefreshTokensResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.refreshTokensHandleResponse(resp)
|
||||
}
|
||||
|
||||
// refreshTokensCreateRequest creates the RefreshTokens request.
|
||||
func (client *CommitOrRollbackBackupClient) refreshTokensCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *CommitOrRollbackBackupClientRefreshTokensOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/commitOrRollbackBackupOperations/{operationId}:refreshTokens"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// refreshTokensHandleResponse handles the RefreshTokens response.
|
||||
func (client *CommitOrRollbackBackupClient) refreshTokensHandleResponse(resp *http.Response) (CommitOrRollbackBackupClientRefreshTokensResponse, error) {
|
||||
result := CommitOrRollbackBackupClientRefreshTokensResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return CommitOrRollbackBackupClientRefreshTokensResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.CommitOrRollbackBackupResponse); err != nil {
|
||||
return CommitOrRollbackBackupClientRefreshTokensResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
|
@ -0,0 +1,245 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.7.6, generator: @autorest/go@4.0.0-preview.42)
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package dataprotectiondatasourceplugin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
)
|
||||
|
||||
type CommitOrRollbackRestoreClient struct {
|
||||
pl runtime.Pipeline
|
||||
}
|
||||
|
||||
// NewCommitOrRollbackRestoreClient creates a new instance of CommitOrRollbackRestoreClient with the specified values.
|
||||
// pl - the pipeline used for sending requests and handling responses.
|
||||
func NewCommitOrRollbackRestoreClient(pl runtime.Pipeline) *CommitOrRollbackRestoreClient {
|
||||
client := &CommitOrRollbackRestoreClient{
|
||||
pl: pl,
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// Cancel - Cancel the operation. Poll the LRO to get the final status.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - CommitOrRollbackRestoreClientCancelOptions contains the optional parameters for the CommitOrRollbackRestoreClient.Cancel
|
||||
// method.
|
||||
func (client *CommitOrRollbackRestoreClient) Cancel(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *CommitOrRollbackRestoreClientCancelOptions) (CommitOrRollbackRestoreClientCancelResponse, error) {
|
||||
req, err := client.cancelCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return CommitOrRollbackRestoreClientCancelResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return CommitOrRollbackRestoreClientCancelResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return CommitOrRollbackRestoreClientCancelResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.cancelHandleResponse(resp)
|
||||
}
|
||||
|
||||
// cancelCreateRequest creates the Cancel request.
|
||||
func (client *CommitOrRollbackRestoreClient) cancelCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *CommitOrRollbackRestoreClientCancelOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/commitOrRollbackRestoreOperations/{operationId}:cancel"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths( host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// cancelHandleResponse handles the Cancel response.
|
||||
func (client *CommitOrRollbackRestoreClient) cancelHandleResponse(resp *http.Response) (CommitOrRollbackRestoreClientCancelResponse, error) {
|
||||
result := CommitOrRollbackRestoreClientCancelResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return CommitOrRollbackRestoreClientCancelResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.CommitOrRollbackRestoreResponse); err != nil {
|
||||
return CommitOrRollbackRestoreClientCancelResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Get - Gets the status of a commitOrRollbackRestore LRO.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - Unique id of the resource
|
||||
// taskID - Unique id of the current task
|
||||
// xmsClientRequestID - Correlation request Id for tracking a particular request.
|
||||
// options - CommitOrRollbackRestoreClientGetOptions contains the optional parameters for the CommitOrRollbackRestoreClient.Get
|
||||
// method.
|
||||
func (client *CommitOrRollbackRestoreClient) Get(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *CommitOrRollbackRestoreClientGetOptions) (CommitOrRollbackRestoreClientGetResponse, error) {
|
||||
req, err := client.getCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, options)
|
||||
if err != nil {
|
||||
return CommitOrRollbackRestoreClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return CommitOrRollbackRestoreClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return CommitOrRollbackRestoreClientGetResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.getHandleResponse(resp)
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *CommitOrRollbackRestoreClient) getCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *CommitOrRollbackRestoreClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/commitOrRollbackRestoreOperations/{operationId}"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths( host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *CommitOrRollbackRestoreClient) getHandleResponse(resp *http.Response) (CommitOrRollbackRestoreClientGetResponse, error) {
|
||||
result := CommitOrRollbackRestoreClientGetResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return CommitOrRollbackRestoreClientGetResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.CommitOrRollbackRestoreResponse); err != nil {
|
||||
return CommitOrRollbackRestoreClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// RefreshTokens - Refresh tokens for a given operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - CommitOrRollbackRestoreClientRefreshTokensOptions contains the optional parameters for the CommitOrRollbackRestoreClient.RefreshTokens
|
||||
// method.
|
||||
func (client *CommitOrRollbackRestoreClient) RefreshTokens(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *CommitOrRollbackRestoreClientRefreshTokensOptions) (CommitOrRollbackRestoreClientRefreshTokensResponse, error) {
|
||||
req, err := client.refreshTokensCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return CommitOrRollbackRestoreClientRefreshTokensResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return CommitOrRollbackRestoreClientRefreshTokensResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return CommitOrRollbackRestoreClientRefreshTokensResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.refreshTokensHandleResponse(resp)
|
||||
}
|
||||
|
||||
// refreshTokensCreateRequest creates the RefreshTokens request.
|
||||
func (client *CommitOrRollbackRestoreClient) refreshTokensCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *CommitOrRollbackRestoreClientRefreshTokensOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/commitOrRollbackRestoreOperations/{operationId}:refreshTokens"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths( host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// refreshTokensHandleResponse handles the RefreshTokens response.
|
||||
func (client *CommitOrRollbackRestoreClient) refreshTokensHandleResponse(resp *http.Response) (CommitOrRollbackRestoreClientRefreshTokensResponse, error) {
|
||||
result := CommitOrRollbackRestoreClientRefreshTokensResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return CommitOrRollbackRestoreClientRefreshTokensResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.CommitOrRollbackRestoreResponse); err != nil {
|
||||
return CommitOrRollbackRestoreClientRefreshTokensResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
|
@ -0,0 +1,209 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.7.6, generator: @autorest/go@4.0.0-preview.42)
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package dataprotectiondatasourceplugin
|
||||
|
||||
const host = "https://pluginBaseUrl.com"
|
||||
|
||||
type AbsoluteMarker string
|
||||
|
||||
const (
|
||||
AbsoluteMarkerAllBackup AbsoluteMarker = "AllBackup"
|
||||
AbsoluteMarkerFirstOfDay AbsoluteMarker = "FirstOfDay"
|
||||
AbsoluteMarkerFirstOfMonth AbsoluteMarker = "FirstOfMonth"
|
||||
AbsoluteMarkerFirstOfWeek AbsoluteMarker = "FirstOfWeek"
|
||||
AbsoluteMarkerFirstOfYear AbsoluteMarker = "FirstOfYear"
|
||||
AbsoluteMarkerInvalid AbsoluteMarker = "Invalid"
|
||||
)
|
||||
|
||||
// PossibleAbsoluteMarkerValues returns the possible values for the AbsoluteMarker const type.
|
||||
func PossibleAbsoluteMarkerValues() []AbsoluteMarker {
|
||||
return []AbsoluteMarker{
|
||||
AbsoluteMarkerAllBackup,
|
||||
AbsoluteMarkerFirstOfDay,
|
||||
AbsoluteMarkerFirstOfMonth,
|
||||
AbsoluteMarkerFirstOfWeek,
|
||||
AbsoluteMarkerFirstOfYear,
|
||||
AbsoluteMarkerInvalid,
|
||||
}
|
||||
}
|
||||
|
||||
// AutoHealStatus - Policy controlled toggle
|
||||
type AutoHealStatus string
|
||||
|
||||
const (
|
||||
AutoHealStatusOff AutoHealStatus = "Off"
|
||||
AutoHealStatusOn AutoHealStatus = "On"
|
||||
)
|
||||
|
||||
// PossibleAutoHealStatusValues returns the possible values for the AutoHealStatus const type.
|
||||
func PossibleAutoHealStatusValues() []AutoHealStatus {
|
||||
return []AutoHealStatus{
|
||||
AutoHealStatusOff,
|
||||
AutoHealStatusOn,
|
||||
}
|
||||
}
|
||||
|
||||
// DataStoreTypes - type of datastore; SnapShot/Hot/Archive
|
||||
type DataStoreTypes string
|
||||
|
||||
const (
|
||||
DataStoreTypesArchiveStore DataStoreTypes = "ArchiveStore"
|
||||
DataStoreTypesOperationalStore DataStoreTypes = "OperationalStore"
|
||||
DataStoreTypesVaultStore DataStoreTypes = "VaultStore"
|
||||
)
|
||||
|
||||
// PossibleDataStoreTypesValues returns the possible values for the DataStoreTypes const type.
|
||||
func PossibleDataStoreTypesValues() []DataStoreTypes {
|
||||
return []DataStoreTypes{
|
||||
DataStoreTypesArchiveStore,
|
||||
DataStoreTypesOperationalStore,
|
||||
DataStoreTypesVaultStore,
|
||||
}
|
||||
}
|
||||
|
||||
type DayOfWeek string
|
||||
|
||||
const (
|
||||
DayOfWeekFriday DayOfWeek = "Friday"
|
||||
DayOfWeekMonday DayOfWeek = "Monday"
|
||||
DayOfWeekSaturday DayOfWeek = "Saturday"
|
||||
DayOfWeekSunday DayOfWeek = "Sunday"
|
||||
DayOfWeekThursday DayOfWeek = "Thursday"
|
||||
DayOfWeekTuesday DayOfWeek = "Tuesday"
|
||||
DayOfWeekWednesday DayOfWeek = "Wednesday"
|
||||
)
|
||||
|
||||
// PossibleDayOfWeekValues returns the possible values for the DayOfWeek const type.
|
||||
func PossibleDayOfWeekValues() []DayOfWeek {
|
||||
return []DayOfWeek{
|
||||
DayOfWeekFriday,
|
||||
DayOfWeekMonday,
|
||||
DayOfWeekSaturday,
|
||||
DayOfWeekSunday,
|
||||
DayOfWeekThursday,
|
||||
DayOfWeekTuesday,
|
||||
DayOfWeekWednesday,
|
||||
}
|
||||
}
|
||||
|
||||
// ExecutionStatus - Service-set extensible enum indicating operation?s kind
|
||||
type ExecutionStatus string
|
||||
|
||||
const (
|
||||
ExecutionStatusCancelled ExecutionStatus = "Cancelled"
|
||||
ExecutionStatusFailed ExecutionStatus = "Failed"
|
||||
ExecutionStatusNotStarted ExecutionStatus = "NotStarted"
|
||||
ExecutionStatusRunning ExecutionStatus = "Running"
|
||||
ExecutionStatusSucceeded ExecutionStatus = "Succeeded"
|
||||
)
|
||||
|
||||
// PossibleExecutionStatusValues returns the possible values for the ExecutionStatus const type.
|
||||
func PossibleExecutionStatusValues() []ExecutionStatus {
|
||||
return []ExecutionStatus{
|
||||
ExecutionStatusCancelled,
|
||||
ExecutionStatusFailed,
|
||||
ExecutionStatusNotStarted,
|
||||
ExecutionStatusRunning,
|
||||
ExecutionStatusSucceeded,
|
||||
}
|
||||
}
|
||||
|
||||
type Month string
|
||||
|
||||
const (
|
||||
MonthApril Month = "April"
|
||||
MonthAugust Month = "August"
|
||||
MonthDecember Month = "December"
|
||||
MonthFebruary Month = "February"
|
||||
MonthJanuary Month = "January"
|
||||
MonthJuly Month = "July"
|
||||
MonthJune Month = "June"
|
||||
MonthMarch Month = "March"
|
||||
MonthMay Month = "May"
|
||||
MonthNovember Month = "November"
|
||||
MonthOctober Month = "October"
|
||||
MonthSeptember Month = "September"
|
||||
)
|
||||
|
||||
// PossibleMonthValues returns the possible values for the Month const type.
|
||||
func PossibleMonthValues() []Month {
|
||||
return []Month{
|
||||
MonthApril,
|
||||
MonthAugust,
|
||||
MonthDecember,
|
||||
MonthFebruary,
|
||||
MonthJanuary,
|
||||
MonthJuly,
|
||||
MonthJune,
|
||||
MonthMarch,
|
||||
MonthMay,
|
||||
MonthNovember,
|
||||
MonthOctober,
|
||||
MonthSeptember,
|
||||
}
|
||||
}
|
||||
|
||||
// RestoreTargetLocationType - Denotes the target location where the data will be restored, string value for the enum {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType}
|
||||
type RestoreTargetLocationType string
|
||||
|
||||
const (
|
||||
RestoreTargetLocationTypeAzureBlobs RestoreTargetLocationType = "AzureBlobs"
|
||||
RestoreTargetLocationTypeAzureDisks RestoreTargetLocationType = "AzureDisks"
|
||||
RestoreTargetLocationTypeAzureFiles RestoreTargetLocationType = "AzureFiles"
|
||||
RestoreTargetLocationTypeAzureKubernetesWorkload RestoreTargetLocationType = "AzureKubernetesWorkload"
|
||||
RestoreTargetLocationTypeInvalid RestoreTargetLocationType = "Invalid"
|
||||
)
|
||||
|
||||
// PossibleRestoreTargetLocationTypeValues returns the possible values for the RestoreTargetLocationType const type.
|
||||
func PossibleRestoreTargetLocationTypeValues() []RestoreTargetLocationType {
|
||||
return []RestoreTargetLocationType{
|
||||
RestoreTargetLocationTypeAzureBlobs,
|
||||
RestoreTargetLocationTypeAzureDisks,
|
||||
RestoreTargetLocationTypeAzureFiles,
|
||||
RestoreTargetLocationTypeAzureKubernetesWorkload,
|
||||
RestoreTargetLocationTypeInvalid,
|
||||
}
|
||||
}
|
||||
|
||||
// TriggerType - Trigger Type ? Adhoc/Scheduled/Custom event etc.
|
||||
type TriggerType string
|
||||
|
||||
const (
|
||||
TriggerTypeAdhoc TriggerType = "Adhoc"
|
||||
TriggerTypeScheduled TriggerType = "Scheduled"
|
||||
)
|
||||
|
||||
// PossibleTriggerTypeValues returns the possible values for the TriggerType const type.
|
||||
func PossibleTriggerTypeValues() []TriggerType {
|
||||
return []TriggerType{
|
||||
TriggerTypeAdhoc,
|
||||
TriggerTypeScheduled,
|
||||
}
|
||||
}
|
||||
|
||||
type WeekNumber string
|
||||
|
||||
const (
|
||||
WeekNumberFirst WeekNumber = "First"
|
||||
WeekNumberFourth WeekNumber = "Fourth"
|
||||
WeekNumberInvalid WeekNumber = "Invalid"
|
||||
WeekNumberLast WeekNumber = "Last"
|
||||
WeekNumberSecond WeekNumber = "Second"
|
||||
WeekNumberThird WeekNumber = "Third"
|
||||
)
|
||||
|
||||
// PossibleWeekNumberValues returns the possible values for the WeekNumber const type.
|
||||
func PossibleWeekNumberValues() []WeekNumber {
|
||||
return []WeekNumber{
|
||||
WeekNumberFirst,
|
||||
WeekNumberFourth,
|
||||
WeekNumberInvalid,
|
||||
WeekNumberLast,
|
||||
WeekNumberSecond,
|
||||
WeekNumberThird,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
module github.com/Azure/DPPGoSDK
|
||||
|
||||
go 1.18
|
||||
|
||||
require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.1
|
||||
|
||||
require (
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect
|
||||
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
)
|
|
@ -0,0 +1,12 @@
|
|||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.1 h1:tz19qLF65vuu2ibfTqGVJxG/zZAI27NEIIbvAOQwYbw=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.1/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w=
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA=
|
||||
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,734 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.7.6, generator: @autorest/go@4.0.0-preview.42)
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package dataprotectiondatasourceplugin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
)
|
||||
|
||||
type PluginClient struct {
|
||||
pl runtime.Pipeline
|
||||
}
|
||||
|
||||
// NewPluginClient creates a new instance of PluginClient with the specified values.
|
||||
// pl - the pipeline used for sending requests and handling responses.
|
||||
func NewPluginClient(pl runtime.Pipeline) *PluginClient {
|
||||
client := &PluginClient{
|
||||
pl: pl,
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// Backup - Start the Backup operation
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique id of the LRO
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - PluginClientBackupOptions contains the optional parameters for the PluginClient.Backup method.
|
||||
func (client *PluginClient) Backup(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters BackupRequest, options *PluginClientBackupOptions) (PluginClientBackupResponse, error) {
|
||||
req, err := client.backupCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return PluginClientBackupResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return PluginClientBackupResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusAccepted) {
|
||||
return PluginClientBackupResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.backupHandleResponse(resp)
|
||||
}
|
||||
|
||||
// backupCreateRequest creates the Backup request.
|
||||
func (client *PluginClient) backupCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters BackupRequest, options *PluginClientBackupOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin:backup"
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["operation-Id"] = []string{operationID}
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// backupHandleResponse handles the Backup response.
|
||||
func (client *PluginClient) backupHandleResponse(resp *http.Response) (PluginClientBackupResponse, error) {
|
||||
result := PluginClientBackupResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return PluginClientBackupResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Operation-Location"); val != "" {
|
||||
result.OperationLocation = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.BackupResponse); err != nil {
|
||||
return PluginClientBackupResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// CommitOrRollbackBackup - Start the commitOrRollbackBackup operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique id of the LRO
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - PluginClientCommitOrRollbackBackupOptions contains the optional parameters for the PluginClient.CommitOrRollbackBackup
|
||||
// method.
|
||||
func (client *PluginClient) CommitOrRollbackBackup(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CommitOrRollbackBackupRequest, options *PluginClientCommitOrRollbackBackupOptions) (PluginClientCommitOrRollbackBackupResponse, error) {
|
||||
req, err := client.commitOrRollbackBackupCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return PluginClientCommitOrRollbackBackupResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return PluginClientCommitOrRollbackBackupResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusAccepted) {
|
||||
return PluginClientCommitOrRollbackBackupResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.commitOrRollbackBackupHandleResponse(resp)
|
||||
}
|
||||
|
||||
// commitOrRollbackBackupCreateRequest creates the CommitOrRollbackBackup request.
|
||||
func (client *PluginClient) commitOrRollbackBackupCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CommitOrRollbackBackupRequest, options *PluginClientCommitOrRollbackBackupOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin:commitOrRollbackBackup"
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["operation-Id"] = []string{operationID}
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// commitOrRollbackBackupHandleResponse handles the CommitOrRollbackBackup response.
|
||||
func (client *PluginClient) commitOrRollbackBackupHandleResponse(resp *http.Response) (PluginClientCommitOrRollbackBackupResponse, error) {
|
||||
result := PluginClientCommitOrRollbackBackupResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return PluginClientCommitOrRollbackBackupResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Operation-Location"); val != "" {
|
||||
result.OperationLocation = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.CommitOrRollbackBackupResponse); err != nil {
|
||||
return PluginClientCommitOrRollbackBackupResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// CommitOrRollbackRestore - Start the commitOrRollbackRestore operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique id of the LRO
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - PluginClientCommitOrRollbackRestoreOptions contains the optional parameters for the PluginClient.CommitOrRollbackRestore
|
||||
// method.
|
||||
func (client *PluginClient) CommitOrRollbackRestore(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CommitOrRollbackRestoreRequest, options *PluginClientCommitOrRollbackRestoreOptions) (PluginClientCommitOrRollbackRestoreResponse, error) {
|
||||
req, err := client.commitOrRollbackRestoreCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return PluginClientCommitOrRollbackRestoreResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return PluginClientCommitOrRollbackRestoreResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusAccepted) {
|
||||
return PluginClientCommitOrRollbackRestoreResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.commitOrRollbackRestoreHandleResponse(resp)
|
||||
}
|
||||
|
||||
// commitOrRollbackRestoreCreateRequest creates the CommitOrRollbackRestore request.
|
||||
func (client *PluginClient) commitOrRollbackRestoreCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CommitOrRollbackRestoreRequest, options *PluginClientCommitOrRollbackRestoreOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin:commitOrRollbackRestore"
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["operation-Id"] = []string{operationID}
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// commitOrRollbackRestoreHandleResponse handles the CommitOrRollbackRestore response.
|
||||
func (client *PluginClient) commitOrRollbackRestoreHandleResponse(resp *http.Response) (PluginClientCommitOrRollbackRestoreResponse, error) {
|
||||
result := PluginClientCommitOrRollbackRestoreResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return PluginClientCommitOrRollbackRestoreResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Operation-Location"); val != "" {
|
||||
result.OperationLocation = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.CommitOrRollbackRestoreResponse); err != nil {
|
||||
return PluginClientCommitOrRollbackRestoreResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Restore - Start the restore operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique id of the LRO
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - PluginClientRestoreOptions contains the optional parameters for the PluginClient.Restore method.
|
||||
func (client *PluginClient) Restore(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RestoreRequest, options *PluginClientRestoreOptions) (PluginClientRestoreResponse, error) {
|
||||
req, err := client.restoreCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return PluginClientRestoreResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return PluginClientRestoreResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusAccepted) {
|
||||
return PluginClientRestoreResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.restoreHandleResponse(resp)
|
||||
}
|
||||
|
||||
// restoreCreateRequest creates the Restore request.
|
||||
func (client *PluginClient) restoreCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RestoreRequest, options *PluginClientRestoreOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin:restore"
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["operation-Id"] = []string{operationID}
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// restoreHandleResponse handles the Restore response.
|
||||
func (client *PluginClient) restoreHandleResponse(resp *http.Response) (PluginClientRestoreResponse, error) {
|
||||
result := PluginClientRestoreResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return PluginClientRestoreResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Operation-Location"); val != "" {
|
||||
result.OperationLocation = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.RestoreResponse); err != nil {
|
||||
return PluginClientRestoreResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// StartProtection - Start the startProtection operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique id of the LRO
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - PluginClientStartProtectionOptions contains the optional parameters for the PluginClient.StartProtection method.
|
||||
func (client *PluginClient) StartProtection(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters StartProtectionRequest, options *PluginClientStartProtectionOptions) (PluginClientStartProtectionResponse, error) {
|
||||
req, err := client.startProtectionCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return PluginClientStartProtectionResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return PluginClientStartProtectionResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusAccepted) {
|
||||
return PluginClientStartProtectionResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.startProtectionHandleResponse(resp)
|
||||
}
|
||||
|
||||
// startProtectionCreateRequest creates the StartProtection request.
|
||||
func (client *PluginClient) startProtectionCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters StartProtectionRequest, options *PluginClientStartProtectionOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin:startProtection"
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["operation-Id"] = []string{operationID}
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// startProtectionHandleResponse handles the StartProtection response.
|
||||
func (client *PluginClient) startProtectionHandleResponse(resp *http.Response) (PluginClientStartProtectionResponse, error) {
|
||||
result := PluginClientStartProtectionResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return PluginClientStartProtectionResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Operation-Location"); val != "" {
|
||||
result.OperationLocation = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.StartProtectionResponse); err != nil {
|
||||
return PluginClientStartProtectionResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// StopProtection - Start the stopProtection operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique id of the LRO
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - PluginClientStopProtectionOptions contains the optional parameters for the PluginClient.StopProtection method.
|
||||
func (client *PluginClient) StopProtection(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters StopProtectionRequest, options *PluginClientStopProtectionOptions) (PluginClientStopProtectionResponse, error) {
|
||||
req, err := client.stopProtectionCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return PluginClientStopProtectionResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return PluginClientStopProtectionResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusAccepted) {
|
||||
return PluginClientStopProtectionResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.stopProtectionHandleResponse(resp)
|
||||
}
|
||||
|
||||
// stopProtectionCreateRequest creates the StopProtection request.
|
||||
func (client *PluginClient) stopProtectionCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters StopProtectionRequest, options *PluginClientStopProtectionOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin:stopProtection"
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["operation-Id"] = []string{operationID}
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// stopProtectionHandleResponse handles the StopProtection response.
|
||||
func (client *PluginClient) stopProtectionHandleResponse(resp *http.Response) (PluginClientStopProtectionResponse, error) {
|
||||
result := PluginClientStopProtectionResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return PluginClientStopProtectionResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Operation-Location"); val != "" {
|
||||
result.OperationLocation = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.StopProtectionResponse); err != nil {
|
||||
return PluginClientStopProtectionResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// UpdateProtection - Start the updateProtection operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique id of the LRO
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - PluginClientUpdateProtectionOptions contains the optional parameters for the PluginClient.UpdateProtection method.
|
||||
func (client *PluginClient) UpdateProtection(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters UpdateProtectionRequest, options *PluginClientUpdateProtectionOptions) (PluginClientUpdateProtectionResponse, error) {
|
||||
req, err := client.updateProtectionCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return PluginClientUpdateProtectionResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return PluginClientUpdateProtectionResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusAccepted) {
|
||||
return PluginClientUpdateProtectionResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.updateProtectionHandleResponse(resp)
|
||||
}
|
||||
|
||||
// updateProtectionCreateRequest creates the UpdateProtection request.
|
||||
func (client *PluginClient) updateProtectionCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters UpdateProtectionRequest, options *PluginClientUpdateProtectionOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin:updateProtection"
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["operation-Id"] = []string{operationID}
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// updateProtectionHandleResponse handles the UpdateProtection response.
|
||||
func (client *PluginClient) updateProtectionHandleResponse(resp *http.Response) (PluginClientUpdateProtectionResponse, error) {
|
||||
result := PluginClientUpdateProtectionResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return PluginClientUpdateProtectionResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Operation-Location"); val != "" {
|
||||
result.OperationLocation = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.UpdateProtectionResponse); err != nil {
|
||||
return PluginClientUpdateProtectionResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ValidateForBackup - Start the validateForBackup operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique id of the LRO
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - PluginClientValidateForBackupOptions contains the optional parameters for the PluginClient.ValidateForBackup
|
||||
// method.
|
||||
func (client *PluginClient) ValidateForBackup(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters ValidateForBackupRequest, options *PluginClientValidateForBackupOptions) (PluginClientValidateForBackupResponse, error) {
|
||||
req, err := client.validateForBackupCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return PluginClientValidateForBackupResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return PluginClientValidateForBackupResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusAccepted) {
|
||||
return PluginClientValidateForBackupResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.validateForBackupHandleResponse(resp)
|
||||
}
|
||||
|
||||
// validateForBackupCreateRequest creates the ValidateForBackup request.
|
||||
func (client *PluginClient) validateForBackupCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters ValidateForBackupRequest, options *PluginClientValidateForBackupOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin:validateForBackup"
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["operation-Id"] = []string{operationID}
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// validateForBackupHandleResponse handles the ValidateForBackup response.
|
||||
func (client *PluginClient) validateForBackupHandleResponse(resp *http.Response) (PluginClientValidateForBackupResponse, error) {
|
||||
result := PluginClientValidateForBackupResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return PluginClientValidateForBackupResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Operation-Location"); val != "" {
|
||||
result.OperationLocation = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ValidateForBackupResponse); err != nil {
|
||||
return PluginClientValidateForBackupResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ValidateForProtection - Start the validateForProtection operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique id of the LRO
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - PluginClientValidateForProtectionOptions contains the optional parameters for the PluginClient.ValidateForProtection
|
||||
// method.
|
||||
func (client *PluginClient) ValidateForProtection(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters ValidateForProtectionRequest, options *PluginClientValidateForProtectionOptions) (PluginClientValidateForProtectionResponse, error) {
|
||||
req, err := client.validateForProtectionCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return PluginClientValidateForProtectionResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return PluginClientValidateForProtectionResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusAccepted) {
|
||||
return PluginClientValidateForProtectionResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.validateForProtectionHandleResponse(resp)
|
||||
}
|
||||
|
||||
// validateForProtectionCreateRequest creates the ValidateForProtection request.
|
||||
func (client *PluginClient) validateForProtectionCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters ValidateForProtectionRequest, options *PluginClientValidateForProtectionOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin:validateForProtection"
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["operation-Id"] = []string{operationID}
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// validateForProtectionHandleResponse handles the ValidateForProtection response.
|
||||
func (client *PluginClient) validateForProtectionHandleResponse(resp *http.Response) (PluginClientValidateForProtectionResponse, error) {
|
||||
result := PluginClientValidateForProtectionResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return PluginClientValidateForProtectionResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Operation-Location"); val != "" {
|
||||
result.OperationLocation = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ValidateForProtectionResponse); err != nil {
|
||||
return PluginClientValidateForProtectionResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ValidateForRestore - Start the validateForRestore operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique id of the LRO
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - PluginClientValidateForRestoreOptions contains the optional parameters for the PluginClient.ValidateForRestore
|
||||
// method.
|
||||
func (client *PluginClient) ValidateForRestore(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters ValidateForRestoreRequest, options *PluginClientValidateForRestoreOptions) (PluginClientValidateForRestoreResponse, error) {
|
||||
req, err := client.validateForRestoreCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return PluginClientValidateForRestoreResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return PluginClientValidateForRestoreResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusAccepted) {
|
||||
return PluginClientValidateForRestoreResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.validateForRestoreHandleResponse(resp)
|
||||
}
|
||||
|
||||
// validateForRestoreCreateRequest creates the ValidateForRestore request.
|
||||
func (client *PluginClient) validateForRestoreCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters ValidateForRestoreRequest, options *PluginClientValidateForRestoreOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin:validateForRestore"
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["operation-Id"] = []string{operationID}
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// validateForRestoreHandleResponse handles the ValidateForRestore response.
|
||||
func (client *PluginClient) validateForRestoreHandleResponse(resp *http.Response) (PluginClientValidateForRestoreResponse, error) {
|
||||
result := PluginClientValidateForRestoreResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return PluginClientValidateForRestoreResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if val := resp.Header.Get("Operation-Location"); val != "" {
|
||||
result.OperationLocation = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ValidateForRestoreResponse); err != nil {
|
||||
return PluginClientValidateForRestoreResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
|
@ -0,0 +1,219 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.7.6, generator: @autorest/go@4.0.0-preview.42)
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package dataprotectiondatasourceplugin
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
func unmarshalBackupCriteriaClassification(rawMsg json.RawMessage) (BackupCriteriaClassification, error) {
|
||||
if rawMsg == nil {
|
||||
return nil, nil
|
||||
}
|
||||
var m map[string]interface{}
|
||||
if err := json.Unmarshal(rawMsg, &m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var b BackupCriteriaClassification
|
||||
switch m["objectType"] {
|
||||
case "ScheduleBasedBackupCriteria":
|
||||
b = &ScheduleBasedBackupCriteria{}
|
||||
default:
|
||||
b = &BackupCriteria{}
|
||||
}
|
||||
return b, json.Unmarshal(rawMsg, b)
|
||||
}
|
||||
|
||||
func unmarshalBackupCriteriaClassificationArray(rawMsg json.RawMessage) ([]BackupCriteriaClassification, error) {
|
||||
if rawMsg == nil {
|
||||
return nil, nil
|
||||
}
|
||||
var rawMessages []json.RawMessage
|
||||
if err := json.Unmarshal(rawMsg, &rawMessages); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fArray := make([]BackupCriteriaClassification, len(rawMessages))
|
||||
for index, rawMessage := range rawMessages {
|
||||
f, err := unmarshalBackupCriteriaClassification(rawMessage)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fArray[index] = f
|
||||
}
|
||||
return fArray, nil
|
||||
}
|
||||
|
||||
func unmarshalBackupDatasourceParametersClassification(rawMsg json.RawMessage) (BackupDatasourceParametersClassification, error) {
|
||||
if rawMsg == nil {
|
||||
return nil, nil
|
||||
}
|
||||
var m map[string]interface{}
|
||||
if err := json.Unmarshal(rawMsg, &m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var b BackupDatasourceParametersClassification
|
||||
switch m["objectType"] {
|
||||
case "BlobBackupDatasourceParameters":
|
||||
b = &BlobBackupDatasourceParameters{}
|
||||
default:
|
||||
b = &BackupDatasourceParameters{}
|
||||
}
|
||||
return b, json.Unmarshal(rawMsg, b)
|
||||
}
|
||||
|
||||
func unmarshalBackupDatasourceParametersClassificationArray(rawMsg json.RawMessage) ([]BackupDatasourceParametersClassification, error) {
|
||||
if rawMsg == nil {
|
||||
return nil, nil
|
||||
}
|
||||
var rawMessages []json.RawMessage
|
||||
if err := json.Unmarshal(rawMsg, &rawMessages); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fArray := make([]BackupDatasourceParametersClassification, len(rawMessages))
|
||||
for index, rawMessage := range rawMessages {
|
||||
f, err := unmarshalBackupDatasourceParametersClassification(rawMessage)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fArray[index] = f
|
||||
}
|
||||
return fArray, nil
|
||||
}
|
||||
|
||||
func unmarshalBackupParametersClassification(rawMsg json.RawMessage) (BackupParametersClassification, error) {
|
||||
if rawMsg == nil {
|
||||
return nil, nil
|
||||
}
|
||||
var m map[string]interface{}
|
||||
if err := json.Unmarshal(rawMsg, &m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var b BackupParametersClassification
|
||||
switch m["objectType"] {
|
||||
case "AzureBackupParams":
|
||||
b = &AzureBackupParams{}
|
||||
case "AzureBackupParamsForPlugin":
|
||||
b = &AzureBackupParamsForPlugin{}
|
||||
default:
|
||||
b = &BackupParameters{}
|
||||
}
|
||||
return b, json.Unmarshal(rawMsg, b)
|
||||
}
|
||||
|
||||
func unmarshalBaseResourcePropertiesClassification(rawMsg json.RawMessage) (BaseResourcePropertiesClassification, error) {
|
||||
if rawMsg == nil {
|
||||
return nil, nil
|
||||
}
|
||||
var m map[string]interface{}
|
||||
if err := json.Unmarshal(rawMsg, &m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var b BaseResourcePropertiesClassification
|
||||
switch m["objectType"] {
|
||||
default:
|
||||
b = &BaseResourceProperties{}
|
||||
}
|
||||
return b, json.Unmarshal(rawMsg, b)
|
||||
}
|
||||
|
||||
func unmarshalDataStoreParametersClassification(rawMsg json.RawMessage) (DataStoreParametersClassification, error) {
|
||||
if rawMsg == nil {
|
||||
return nil, nil
|
||||
}
|
||||
var m map[string]interface{}
|
||||
if err := json.Unmarshal(rawMsg, &m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var b DataStoreParametersClassification
|
||||
switch m["objectType"] {
|
||||
case "AzureOperationalStoreParameters":
|
||||
b = &AzureOperationalStoreParameters{}
|
||||
default:
|
||||
b = &DataStoreParameters{}
|
||||
}
|
||||
return b, json.Unmarshal(rawMsg, b)
|
||||
}
|
||||
|
||||
func unmarshalDataStoreParametersClassificationArray(rawMsg json.RawMessage) ([]DataStoreParametersClassification, error) {
|
||||
if rawMsg == nil {
|
||||
return nil, nil
|
||||
}
|
||||
var rawMessages []json.RawMessage
|
||||
if err := json.Unmarshal(rawMsg, &rawMessages); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fArray := make([]DataStoreParametersClassification, len(rawMessages))
|
||||
for index, rawMessage := range rawMessages {
|
||||
f, err := unmarshalDataStoreParametersClassification(rawMessage)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fArray[index] = f
|
||||
}
|
||||
return fArray, nil
|
||||
}
|
||||
|
||||
func unmarshalItemLevelRestoreCriteriaClassification(rawMsg json.RawMessage) (ItemLevelRestoreCriteriaClassification, error) {
|
||||
if rawMsg == nil {
|
||||
return nil, nil
|
||||
}
|
||||
var m map[string]interface{}
|
||||
if err := json.Unmarshal(rawMsg, &m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var b ItemLevelRestoreCriteriaClassification
|
||||
switch m["objectType"] {
|
||||
case "ItemPathBasedRestoreCriteria":
|
||||
b = &ItemPathBasedRestoreCriteria{}
|
||||
case "KubernetesPVRestoreCriteria":
|
||||
b = &KubernetesPVRestoreCriteria{}
|
||||
case "KubernetesStorageClassRestoreCriteria":
|
||||
b = &KubernetesStorageClassRestoreCriteria{}
|
||||
case "RangeBasedItemLevelRestoreCriteria":
|
||||
b = &RangeBasedItemLevelRestoreCriteria{}
|
||||
default:
|
||||
b = &ItemLevelRestoreCriteria{}
|
||||
}
|
||||
return b, json.Unmarshal(rawMsg, b)
|
||||
}
|
||||
|
||||
func unmarshalItemLevelRestoreCriteriaClassificationArray(rawMsg json.RawMessage) ([]ItemLevelRestoreCriteriaClassification, error) {
|
||||
if rawMsg == nil {
|
||||
return nil, nil
|
||||
}
|
||||
var rawMessages []json.RawMessage
|
||||
if err := json.Unmarshal(rawMsg, &rawMessages); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fArray := make([]ItemLevelRestoreCriteriaClassification, len(rawMessages))
|
||||
for index, rawMessage := range rawMessages {
|
||||
f, err := unmarshalItemLevelRestoreCriteriaClassification(rawMessage)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fArray[index] = f
|
||||
}
|
||||
return fArray, nil
|
||||
}
|
||||
|
||||
func unmarshalTriggerContextClassification(rawMsg json.RawMessage) (TriggerContextClassification, error) {
|
||||
if rawMsg == nil {
|
||||
return nil, nil
|
||||
}
|
||||
var m map[string]interface{}
|
||||
if err := json.Unmarshal(rawMsg, &m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var b TriggerContextClassification
|
||||
switch m["objectType"] {
|
||||
case "AdhocBasedTriggerContext":
|
||||
b = &AdhocBasedTriggerContext{}
|
||||
case "ScheduleBasedTriggerContext":
|
||||
b = &ScheduleBasedTriggerContext{}
|
||||
default:
|
||||
b = &TriggerContext{}
|
||||
}
|
||||
return b, json.Unmarshal(rawMsg, b)
|
||||
}
|
|
@ -0,0 +1,557 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.7.6, generator: @autorest/go@4.0.0-preview.42)
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package dataprotectiondatasourceplugin
|
||||
|
||||
// BackupClientCancelResponse contains the response from method BackupClient.Cancel.
|
||||
type BackupClientCancelResponse struct {
|
||||
BackupResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// BackupClientGetResponse contains the response from method BackupClient.Get.
|
||||
type BackupClientGetResponse struct {
|
||||
BackupResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// BackupClientRefreshTokensResponse contains the response from method BackupClient.RefreshTokens.
|
||||
type BackupClientRefreshTokensResponse struct {
|
||||
BackupResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// CommitOrRollbackBackupClientCancelResponse contains the response from method CommitOrRollbackBackupClient.Cancel.
|
||||
type CommitOrRollbackBackupClientCancelResponse struct {
|
||||
CommitOrRollbackBackupResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// CommitOrRollbackBackupClientGetResponse contains the response from method CommitOrRollbackBackupClient.Get.
|
||||
type CommitOrRollbackBackupClientGetResponse struct {
|
||||
CommitOrRollbackBackupResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// CommitOrRollbackBackupClientRefreshTokensResponse contains the response from method CommitOrRollbackBackupClient.RefreshTokens.
|
||||
type CommitOrRollbackBackupClientRefreshTokensResponse struct {
|
||||
CommitOrRollbackBackupResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// CommitOrRollbackRestoreClientCancelResponse contains the response from method CommitOrRollbackRestoreClient.Cancel.
|
||||
type CommitOrRollbackRestoreClientCancelResponse struct {
|
||||
CommitOrRollbackRestoreResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// CommitOrRollbackRestoreClientGetResponse contains the response from method CommitOrRollbackRestoreClient.Get.
|
||||
type CommitOrRollbackRestoreClientGetResponse struct {
|
||||
CommitOrRollbackRestoreResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// CommitOrRollbackRestoreClientRefreshTokensResponse contains the response from method CommitOrRollbackRestoreClient.RefreshTokens.
|
||||
type CommitOrRollbackRestoreClientRefreshTokensResponse struct {
|
||||
CommitOrRollbackRestoreResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// PluginClientBackupResponse contains the response from method PluginClient.Backup.
|
||||
type PluginClientBackupResponse struct {
|
||||
BackupResponse
|
||||
// OperationLocation contains the information returned from the Operation-Location header response.
|
||||
OperationLocation *string
|
||||
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// PluginClientCommitOrRollbackBackupResponse contains the response from method PluginClient.CommitOrRollbackBackup.
|
||||
type PluginClientCommitOrRollbackBackupResponse struct {
|
||||
CommitOrRollbackBackupResponse
|
||||
// OperationLocation contains the information returned from the Operation-Location header response.
|
||||
OperationLocation *string
|
||||
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// PluginClientCommitOrRollbackRestoreResponse contains the response from method PluginClient.CommitOrRollbackRestore.
|
||||
type PluginClientCommitOrRollbackRestoreResponse struct {
|
||||
CommitOrRollbackRestoreResponse
|
||||
// OperationLocation contains the information returned from the Operation-Location header response.
|
||||
OperationLocation *string
|
||||
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// PluginClientRestoreResponse contains the response from method PluginClient.Restore.
|
||||
type PluginClientRestoreResponse struct {
|
||||
RestoreResponse
|
||||
// OperationLocation contains the information returned from the Operation-Location header response.
|
||||
OperationLocation *string
|
||||
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// PluginClientStartProtectionResponse contains the response from method PluginClient.StartProtection.
|
||||
type PluginClientStartProtectionResponse struct {
|
||||
StartProtectionResponse
|
||||
// OperationLocation contains the information returned from the Operation-Location header response.
|
||||
OperationLocation *string
|
||||
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// PluginClientStopProtectionResponse contains the response from method PluginClient.StopProtection.
|
||||
type PluginClientStopProtectionResponse struct {
|
||||
StopProtectionResponse
|
||||
// OperationLocation contains the information returned from the Operation-Location header response.
|
||||
OperationLocation *string
|
||||
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// PluginClientUpdateProtectionResponse contains the response from method PluginClient.UpdateProtection.
|
||||
type PluginClientUpdateProtectionResponse struct {
|
||||
UpdateProtectionResponse
|
||||
// OperationLocation contains the information returned from the Operation-Location header response.
|
||||
OperationLocation *string
|
||||
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// PluginClientValidateForBackupResponse contains the response from method PluginClient.ValidateForBackup.
|
||||
type PluginClientValidateForBackupResponse struct {
|
||||
ValidateForBackupResponse
|
||||
// OperationLocation contains the information returned from the Operation-Location header response.
|
||||
OperationLocation *string
|
||||
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// PluginClientValidateForProtectionResponse contains the response from method PluginClient.ValidateForProtection.
|
||||
type PluginClientValidateForProtectionResponse struct {
|
||||
ValidateForProtectionResponse
|
||||
// OperationLocation contains the information returned from the Operation-Location header response.
|
||||
OperationLocation *string
|
||||
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// PluginClientValidateForRestoreResponse contains the response from method PluginClient.ValidateForRestore.
|
||||
type PluginClientValidateForRestoreResponse struct {
|
||||
ValidateForRestoreResponse
|
||||
// OperationLocation contains the information returned from the Operation-Location header response.
|
||||
OperationLocation *string
|
||||
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// RestoreClientCancelResponse contains the response from method RestoreClient.Cancel.
|
||||
type RestoreClientCancelResponse struct {
|
||||
RestoreResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// RestoreClientGetResponse contains the response from method RestoreClient.Get.
|
||||
type RestoreClientGetResponse struct {
|
||||
RestoreResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// RestoreClientRefreshTokensResponse contains the response from method RestoreClient.RefreshTokens.
|
||||
type RestoreClientRefreshTokensResponse struct {
|
||||
RestoreResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// StartProtectionClientCancelResponse contains the response from method StartProtectionClient.Cancel.
|
||||
type StartProtectionClientCancelResponse struct {
|
||||
StartProtectionResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// StartProtectionClientGetResponse contains the response from method StartProtectionClient.Get.
|
||||
type StartProtectionClientGetResponse struct {
|
||||
StartProtectionResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// StartProtectionClientRefreshTokensResponse contains the response from method StartProtectionClient.RefreshTokens.
|
||||
type StartProtectionClientRefreshTokensResponse struct {
|
||||
StartProtectionResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// StopProtectionClientCancelResponse contains the response from method StopProtectionClient.Cancel.
|
||||
type StopProtectionClientCancelResponse struct {
|
||||
StopProtectionResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// StopProtectionClientGetResponse contains the response from method StopProtectionClient.Get.
|
||||
type StopProtectionClientGetResponse struct {
|
||||
StopProtectionResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// StopProtectionClientRefreshTokensResponse contains the response from method StopProtectionClient.RefreshTokens.
|
||||
type StopProtectionClientRefreshTokensResponse struct {
|
||||
StopProtectionResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// UpdateProtectionClientCancelResponse contains the response from method UpdateProtectionClient.Cancel.
|
||||
type UpdateProtectionClientCancelResponse struct {
|
||||
UpdateProtectionResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// UpdateProtectionClientGetResponse contains the response from method UpdateProtectionClient.Get.
|
||||
type UpdateProtectionClientGetResponse struct {
|
||||
UpdateProtectionResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// UpdateProtectionClientRefreshTokensResponse contains the response from method UpdateProtectionClient.RefreshTokens.
|
||||
type UpdateProtectionClientRefreshTokensResponse struct {
|
||||
UpdateProtectionResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// ValidateForBackupClientCancelResponse contains the response from method ValidateForBackupClient.Cancel.
|
||||
type ValidateForBackupClientCancelResponse struct {
|
||||
ValidateForBackupResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// ValidateForBackupClientGetResponse contains the response from method ValidateForBackupClient.Get.
|
||||
type ValidateForBackupClientGetResponse struct {
|
||||
ValidateForBackupResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// ValidateForBackupClientRefreshTokensResponse contains the response from method ValidateForBackupClient.RefreshTokens.
|
||||
type ValidateForBackupClientRefreshTokensResponse struct {
|
||||
ValidateForBackupResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// ValidateForProtectionClientCancelResponse contains the response from method ValidateForProtectionClient.Cancel.
|
||||
type ValidateForProtectionClientCancelResponse struct {
|
||||
ValidateForProtectionResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// ValidateForProtectionClientGetResponse contains the response from method ValidateForProtectionClient.Get.
|
||||
type ValidateForProtectionClientGetResponse struct {
|
||||
ValidateForProtectionResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// ValidateForProtectionClientRefreshTokensResponse contains the response from method ValidateForProtectionClient.RefreshTokens.
|
||||
type ValidateForProtectionClientRefreshTokensResponse struct {
|
||||
ValidateForProtectionResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// ValidateForRestoreClientCancelResponse contains the response from method ValidateForRestoreClient.Cancel.
|
||||
type ValidateForRestoreClientCancelResponse struct {
|
||||
ValidateForRestoreResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// ValidateForRestoreClientGetResponse contains the response from method ValidateForRestoreClient.Get.
|
||||
type ValidateForRestoreClientGetResponse struct {
|
||||
ValidateForRestoreResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
||||
|
||||
// ValidateForRestoreClientRefreshTokensResponse contains the response from method ValidateForRestoreClient.RefreshTokens.
|
||||
type ValidateForRestoreClientRefreshTokensResponse struct {
|
||||
ValidateForRestoreResponse
|
||||
// RetryAfter contains the information returned from the Retry-After header response.
|
||||
RetryAfter *int32
|
||||
|
||||
// XMSErrorCode contains the information returned from the x-ms-error-code header response.
|
||||
XMSErrorCode *string
|
||||
|
||||
// XMSRequestID contains the information returned from the x-ms-request-id header response.
|
||||
XMSRequestID *string
|
||||
}
|
|
@ -0,0 +1,241 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.7.6, generator: @autorest/go@4.0.0-preview.42)
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package dataprotectiondatasourceplugin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
)
|
||||
|
||||
type RestoreClient struct {
|
||||
pl runtime.Pipeline
|
||||
}
|
||||
|
||||
// NewRestoreClient creates a new instance of RestoreClient with the specified values.
|
||||
// pl - the pipeline used for sending requests and handling responses.
|
||||
func NewRestoreClient(pl runtime.Pipeline) *RestoreClient {
|
||||
client := &RestoreClient{
|
||||
pl: pl,
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// Cancel - Cancel the operation. Poll the LRO to get the final status.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - RestoreClientCancelOptions contains the optional parameters for the RestoreClient.Cancel method.
|
||||
func (client *RestoreClient) Cancel(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *RestoreClientCancelOptions) (RestoreClientCancelResponse, error) {
|
||||
req, err := client.cancelCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return RestoreClientCancelResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return RestoreClientCancelResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return RestoreClientCancelResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.cancelHandleResponse(resp)
|
||||
}
|
||||
|
||||
// cancelCreateRequest creates the Cancel request.
|
||||
func (client *RestoreClient) cancelCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *RestoreClientCancelOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/restoreOperations/{operationId}:cancel"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// cancelHandleResponse handles the Cancel response.
|
||||
func (client *RestoreClient) cancelHandleResponse(resp *http.Response) (RestoreClientCancelResponse, error) {
|
||||
result := RestoreClientCancelResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return RestoreClientCancelResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.RestoreResponse); err != nil {
|
||||
return RestoreClientCancelResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Get - Gets the status of a Restore LRO.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - Unique id of the resource
|
||||
// taskID - Unique id of the current task
|
||||
// xmsClientRequestID - Correlation request Id for tracking a particular request.
|
||||
// options - RestoreClientGetOptions contains the optional parameters for the RestoreClient.Get method.
|
||||
func (client *RestoreClient) Get(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *RestoreClientGetOptions) (RestoreClientGetResponse, error) {
|
||||
req, err := client.getCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, options)
|
||||
if err != nil {
|
||||
return RestoreClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return RestoreClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return RestoreClientGetResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.getHandleResponse(resp)
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *RestoreClient) getCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *RestoreClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/restoreOperations/{operationId}"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *RestoreClient) getHandleResponse(resp *http.Response) (RestoreClientGetResponse, error) {
|
||||
result := RestoreClientGetResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return RestoreClientGetResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.RestoreResponse); err != nil {
|
||||
return RestoreClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// RefreshTokens - Refresh tokens for a given operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - RestoreClientRefreshTokensOptions contains the optional parameters for the RestoreClient.RefreshTokens method.
|
||||
func (client *RestoreClient) RefreshTokens(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *RestoreClientRefreshTokensOptions) (RestoreClientRefreshTokensResponse, error) {
|
||||
req, err := client.refreshTokensCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return RestoreClientRefreshTokensResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return RestoreClientRefreshTokensResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return RestoreClientRefreshTokensResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.refreshTokensHandleResponse(resp)
|
||||
}
|
||||
|
||||
// refreshTokensCreateRequest creates the RefreshTokens request.
|
||||
func (client *RestoreClient) refreshTokensCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *RestoreClientRefreshTokensOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/restoreOperations/{operationId}:refreshTokens"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// refreshTokensHandleResponse handles the RefreshTokens response.
|
||||
func (client *RestoreClient) refreshTokensHandleResponse(resp *http.Response) (RestoreClientRefreshTokensResponse, error) {
|
||||
result := RestoreClientRefreshTokensResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return RestoreClientRefreshTokensResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.RestoreResponse); err != nil {
|
||||
return RestoreClientRefreshTokensResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
|
@ -0,0 +1,242 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.7.6, generator: @autorest/go@4.0.0-preview.42)
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package dataprotectiondatasourceplugin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
)
|
||||
|
||||
type StartProtectionClient struct {
|
||||
pl runtime.Pipeline
|
||||
}
|
||||
|
||||
// NewStartProtectionClient creates a new instance of StartProtectionClient with the specified values.
|
||||
// pl - the pipeline used for sending requests and handling responses.
|
||||
func NewStartProtectionClient(pl runtime.Pipeline) *StartProtectionClient {
|
||||
client := &StartProtectionClient{
|
||||
pl: pl,
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// Cancel - Cancel the operation. Poll the LRO to get the final status.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - StartProtectionClientCancelOptions contains the optional parameters for the StartProtectionClient.Cancel method.
|
||||
func (client *StartProtectionClient) Cancel(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *StartProtectionClientCancelOptions) (StartProtectionClientCancelResponse, error) {
|
||||
req, err := client.cancelCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return StartProtectionClientCancelResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return StartProtectionClientCancelResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return StartProtectionClientCancelResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.cancelHandleResponse(resp)
|
||||
}
|
||||
|
||||
// cancelCreateRequest creates the Cancel request.
|
||||
func (client *StartProtectionClient) cancelCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *StartProtectionClientCancelOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/startProtectionOperations/{operationId}:cancel"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// cancelHandleResponse handles the Cancel response.
|
||||
func (client *StartProtectionClient) cancelHandleResponse(resp *http.Response) (StartProtectionClientCancelResponse, error) {
|
||||
result := StartProtectionClientCancelResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return StartProtectionClientCancelResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.StartProtectionResponse); err != nil {
|
||||
return StartProtectionClientCancelResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Get - Gets the status of a startProtection LRO.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - Unique id of the resource
|
||||
// taskID - Unique id of the current task
|
||||
// xmsClientRequestID - Correlation request Id for tracking a particular request.
|
||||
// options - StartProtectionClientGetOptions contains the optional parameters for the StartProtectionClient.Get method.
|
||||
func (client *StartProtectionClient) Get(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *StartProtectionClientGetOptions) (StartProtectionClientGetResponse, error) {
|
||||
req, err := client.getCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, options)
|
||||
if err != nil {
|
||||
return StartProtectionClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return StartProtectionClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return StartProtectionClientGetResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.getHandleResponse(resp)
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *StartProtectionClient) getCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *StartProtectionClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/startProtectionOperations/{operationId}"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *StartProtectionClient) getHandleResponse(resp *http.Response) (StartProtectionClientGetResponse, error) {
|
||||
result := StartProtectionClientGetResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return StartProtectionClientGetResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.StartProtectionResponse); err != nil {
|
||||
return StartProtectionClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// RefreshTokens - Refresh tokens for a given operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - StartProtectionClientRefreshTokensOptions contains the optional parameters for the StartProtectionClient.RefreshTokens
|
||||
// method.
|
||||
func (client *StartProtectionClient) RefreshTokens(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *StartProtectionClientRefreshTokensOptions) (StartProtectionClientRefreshTokensResponse, error) {
|
||||
req, err := client.refreshTokensCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return StartProtectionClientRefreshTokensResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return StartProtectionClientRefreshTokensResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return StartProtectionClientRefreshTokensResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.refreshTokensHandleResponse(resp)
|
||||
}
|
||||
|
||||
// refreshTokensCreateRequest creates the RefreshTokens request.
|
||||
func (client *StartProtectionClient) refreshTokensCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *StartProtectionClientRefreshTokensOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/startProtectionOperations/{operationId}:refreshTokens"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// refreshTokensHandleResponse handles the RefreshTokens response.
|
||||
func (client *StartProtectionClient) refreshTokensHandleResponse(resp *http.Response) (StartProtectionClientRefreshTokensResponse, error) {
|
||||
result := StartProtectionClientRefreshTokensResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return StartProtectionClientRefreshTokensResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.StartProtectionResponse); err != nil {
|
||||
return StartProtectionClientRefreshTokensResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
|
@ -0,0 +1,242 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.7.6, generator: @autorest/go@4.0.0-preview.42)
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package dataprotectiondatasourceplugin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
)
|
||||
|
||||
type StopProtectionClient struct {
|
||||
pl runtime.Pipeline
|
||||
}
|
||||
|
||||
// NewStopProtectionClient creates a new instance of StopProtectionClient with the specified values.
|
||||
// pl - the pipeline used for sending requests and handling responses.
|
||||
func NewStopProtectionClient(pl runtime.Pipeline) *StopProtectionClient {
|
||||
client := &StopProtectionClient{
|
||||
pl: pl,
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// Cancel - Cancel the operation. Poll the LRO to get the final status.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - StopProtectionClientCancelOptions contains the optional parameters for the StopProtectionClient.Cancel method.
|
||||
func (client *StopProtectionClient) Cancel(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *StopProtectionClientCancelOptions) (StopProtectionClientCancelResponse, error) {
|
||||
req, err := client.cancelCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return StopProtectionClientCancelResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return StopProtectionClientCancelResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return StopProtectionClientCancelResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.cancelHandleResponse(resp)
|
||||
}
|
||||
|
||||
// cancelCreateRequest creates the Cancel request.
|
||||
func (client *StopProtectionClient) cancelCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *StopProtectionClientCancelOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/stopProtectionOperations/{operationId}:cancel"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// cancelHandleResponse handles the Cancel response.
|
||||
func (client *StopProtectionClient) cancelHandleResponse(resp *http.Response) (StopProtectionClientCancelResponse, error) {
|
||||
result := StopProtectionClientCancelResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return StopProtectionClientCancelResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.StopProtectionResponse); err != nil {
|
||||
return StopProtectionClientCancelResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Get - Gets the status of a stopProtection LRO.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - Unique id of the resource
|
||||
// taskID - Unique id of the current task
|
||||
// xmsClientRequestID - Correlation request Id for tracking a particular request.
|
||||
// options - StopProtectionClientGetOptions contains the optional parameters for the StopProtectionClient.Get method.
|
||||
func (client *StopProtectionClient) Get(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *StopProtectionClientGetOptions) (StopProtectionClientGetResponse, error) {
|
||||
req, err := client.getCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, options)
|
||||
if err != nil {
|
||||
return StopProtectionClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return StopProtectionClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return StopProtectionClientGetResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.getHandleResponse(resp)
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *StopProtectionClient) getCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *StopProtectionClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/stopProtectionOperations/{operationId}"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *StopProtectionClient) getHandleResponse(resp *http.Response) (StopProtectionClientGetResponse, error) {
|
||||
result := StopProtectionClientGetResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return StopProtectionClientGetResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.StopProtectionResponse); err != nil {
|
||||
return StopProtectionClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// RefreshTokens - Refresh tokens for a given operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - StopProtectionClientRefreshTokensOptions contains the optional parameters for the StopProtectionClient.RefreshTokens
|
||||
// method.
|
||||
func (client *StopProtectionClient) RefreshTokens(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *StopProtectionClientRefreshTokensOptions) (StopProtectionClientRefreshTokensResponse, error) {
|
||||
req, err := client.refreshTokensCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return StopProtectionClientRefreshTokensResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return StopProtectionClientRefreshTokensResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return StopProtectionClientRefreshTokensResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.refreshTokensHandleResponse(resp)
|
||||
}
|
||||
|
||||
// refreshTokensCreateRequest creates the RefreshTokens request.
|
||||
func (client *StopProtectionClient) refreshTokensCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *StopProtectionClientRefreshTokensOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/stopProtectionOperations/{operationId}:refreshTokens"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// refreshTokensHandleResponse handles the RefreshTokens response.
|
||||
func (client *StopProtectionClient) refreshTokensHandleResponse(resp *http.Response) (StopProtectionClientRefreshTokensResponse, error) {
|
||||
result := StopProtectionClientRefreshTokensResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return StopProtectionClientRefreshTokensResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.StopProtectionResponse); err != nil {
|
||||
return StopProtectionClientRefreshTokensResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.7.6, generator: @autorest/go@4.0.0-preview.42)
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package dataprotectiondatasourceplugin
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
utcLayoutJSON = `"2006-01-02T15:04:05.999999999"`
|
||||
utcLayout = "2006-01-02T15:04:05.999999999"
|
||||
rfc3339JSON = `"` + time.RFC3339Nano + `"`
|
||||
)
|
||||
|
||||
// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases.
|
||||
var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`)
|
||||
|
||||
type timeRFC3339 time.Time
|
||||
|
||||
func (t timeRFC3339) MarshalJSON() (json []byte, err error) {
|
||||
tt := time.Time(t)
|
||||
return tt.MarshalJSON()
|
||||
}
|
||||
|
||||
func (t timeRFC3339) MarshalText() (text []byte, err error) {
|
||||
tt := time.Time(t)
|
||||
return tt.MarshalText()
|
||||
}
|
||||
|
||||
func (t *timeRFC3339) UnmarshalJSON(data []byte) error {
|
||||
layout := utcLayoutJSON
|
||||
if tzOffsetRegex.Match(data) {
|
||||
layout = rfc3339JSON
|
||||
}
|
||||
return t.Parse(layout, string(data))
|
||||
}
|
||||
|
||||
func (t *timeRFC3339) UnmarshalText(data []byte) (err error) {
|
||||
layout := utcLayout
|
||||
if tzOffsetRegex.Match(data) {
|
||||
layout = time.RFC3339Nano
|
||||
}
|
||||
return t.Parse(layout, string(data))
|
||||
}
|
||||
|
||||
func (t *timeRFC3339) Parse(layout, value string) error {
|
||||
p, err := time.Parse(layout, strings.ToUpper(value))
|
||||
*t = timeRFC3339(p)
|
||||
return err
|
||||
}
|
|
@ -0,0 +1,242 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.7.6, generator: @autorest/go@4.0.0-preview.42)
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package dataprotectiondatasourceplugin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
)
|
||||
|
||||
type UpdateProtectionClient struct {
|
||||
pl runtime.Pipeline
|
||||
}
|
||||
|
||||
// NewUpdateProtectionClient creates a new instance of UpdateProtectionClient with the specified values.
|
||||
// pl - the pipeline used for sending requests and handling responses.
|
||||
func NewUpdateProtectionClient(pl runtime.Pipeline) *UpdateProtectionClient {
|
||||
client := &UpdateProtectionClient{
|
||||
pl: pl,
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// Cancel - Cancel the operation. Poll the LRO to get the final status.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - UpdateProtectionClientCancelOptions contains the optional parameters for the UpdateProtectionClient.Cancel method.
|
||||
func (client *UpdateProtectionClient) Cancel(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *UpdateProtectionClientCancelOptions) (UpdateProtectionClientCancelResponse, error) {
|
||||
req, err := client.cancelCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return UpdateProtectionClientCancelResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return UpdateProtectionClientCancelResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return UpdateProtectionClientCancelResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.cancelHandleResponse(resp)
|
||||
}
|
||||
|
||||
// cancelCreateRequest creates the Cancel request.
|
||||
func (client *UpdateProtectionClient) cancelCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *UpdateProtectionClientCancelOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/updateProtectionOperations/{operationId}:cancel"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// cancelHandleResponse handles the Cancel response.
|
||||
func (client *UpdateProtectionClient) cancelHandleResponse(resp *http.Response) (UpdateProtectionClientCancelResponse, error) {
|
||||
result := UpdateProtectionClientCancelResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return UpdateProtectionClientCancelResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.UpdateProtectionResponse); err != nil {
|
||||
return UpdateProtectionClientCancelResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Get - Gets the status of a updateProtection LRO.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - Unique id of the resource
|
||||
// taskID - Unique id of the current task
|
||||
// xmsClientRequestID - Correlation request Id for tracking a particular request.
|
||||
// options - UpdateProtectionClientGetOptions contains the optional parameters for the UpdateProtectionClient.Get method.
|
||||
func (client *UpdateProtectionClient) Get(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *UpdateProtectionClientGetOptions) (UpdateProtectionClientGetResponse, error) {
|
||||
req, err := client.getCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, options)
|
||||
if err != nil {
|
||||
return UpdateProtectionClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return UpdateProtectionClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return UpdateProtectionClientGetResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.getHandleResponse(resp)
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *UpdateProtectionClient) getCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *UpdateProtectionClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/updateProtectionOperations/{operationId}"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *UpdateProtectionClient) getHandleResponse(resp *http.Response) (UpdateProtectionClientGetResponse, error) {
|
||||
result := UpdateProtectionClientGetResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return UpdateProtectionClientGetResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.UpdateProtectionResponse); err != nil {
|
||||
return UpdateProtectionClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// RefreshTokens - Refresh tokens for a given operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - UpdateProtectionClientRefreshTokensOptions contains the optional parameters for the UpdateProtectionClient.RefreshTokens
|
||||
// method.
|
||||
func (client *UpdateProtectionClient) RefreshTokens(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *UpdateProtectionClientRefreshTokensOptions) (UpdateProtectionClientRefreshTokensResponse, error) {
|
||||
req, err := client.refreshTokensCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return UpdateProtectionClientRefreshTokensResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return UpdateProtectionClientRefreshTokensResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return UpdateProtectionClientRefreshTokensResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.refreshTokensHandleResponse(resp)
|
||||
}
|
||||
|
||||
// refreshTokensCreateRequest creates the RefreshTokens request.
|
||||
func (client *UpdateProtectionClient) refreshTokensCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *UpdateProtectionClientRefreshTokensOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/updateProtectionOperations/{operationId}:refreshTokens"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// refreshTokensHandleResponse handles the RefreshTokens response.
|
||||
func (client *UpdateProtectionClient) refreshTokensHandleResponse(resp *http.Response) (UpdateProtectionClientRefreshTokensResponse, error) {
|
||||
result := UpdateProtectionClientRefreshTokensResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return UpdateProtectionClientRefreshTokensResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.UpdateProtectionResponse); err != nil {
|
||||
return UpdateProtectionClientRefreshTokensResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
|
@ -0,0 +1,243 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.7.6, generator: @autorest/go@4.0.0-preview.42)
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package dataprotectiondatasourceplugin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
)
|
||||
|
||||
type ValidateForBackupClient struct {
|
||||
pl runtime.Pipeline
|
||||
}
|
||||
|
||||
// NewValidateForBackupClient creates a new instance of ValidateForBackupClient with the specified values.
|
||||
// pl - the pipeline used for sending requests and handling responses.
|
||||
func NewValidateForBackupClient(pl runtime.Pipeline) *ValidateForBackupClient {
|
||||
client := &ValidateForBackupClient{
|
||||
pl: pl,
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// Cancel - Cancel the operation. Poll the LRO to get the final status.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - ValidateForBackupClientCancelOptions contains the optional parameters for the ValidateForBackupClient.Cancel
|
||||
// method.
|
||||
func (client *ValidateForBackupClient) Cancel(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *ValidateForBackupClientCancelOptions) (ValidateForBackupClientCancelResponse, error) {
|
||||
req, err := client.cancelCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return ValidateForBackupClientCancelResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return ValidateForBackupClientCancelResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return ValidateForBackupClientCancelResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.cancelHandleResponse(resp)
|
||||
}
|
||||
|
||||
// cancelCreateRequest creates the Cancel request.
|
||||
func (client *ValidateForBackupClient) cancelCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *ValidateForBackupClientCancelOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/validateForBackupOperations/{operationId}:cancel"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// cancelHandleResponse handles the Cancel response.
|
||||
func (client *ValidateForBackupClient) cancelHandleResponse(resp *http.Response) (ValidateForBackupClientCancelResponse, error) {
|
||||
result := ValidateForBackupClientCancelResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return ValidateForBackupClientCancelResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ValidateForBackupResponse); err != nil {
|
||||
return ValidateForBackupClientCancelResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Get - Gets the status of a validateForBackup LRO.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - Unique id of the resource
|
||||
// taskID - Unique id of the current task
|
||||
// xmsClientRequestID - Correlation request Id for tracking a particular request.
|
||||
// options - ValidateForBackupClientGetOptions contains the optional parameters for the ValidateForBackupClient.Get method.
|
||||
func (client *ValidateForBackupClient) Get(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *ValidateForBackupClientGetOptions) (ValidateForBackupClientGetResponse, error) {
|
||||
req, err := client.getCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, options)
|
||||
if err != nil {
|
||||
return ValidateForBackupClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return ValidateForBackupClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return ValidateForBackupClientGetResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.getHandleResponse(resp)
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *ValidateForBackupClient) getCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *ValidateForBackupClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/validateForBackupOperations/{operationId}"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *ValidateForBackupClient) getHandleResponse(resp *http.Response) (ValidateForBackupClientGetResponse, error) {
|
||||
result := ValidateForBackupClientGetResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return ValidateForBackupClientGetResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ValidateForBackupResponse); err != nil {
|
||||
return ValidateForBackupClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// RefreshTokens - Refresh tokens for a given operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - ValidateForBackupClientRefreshTokensOptions contains the optional parameters for the ValidateForBackupClient.RefreshTokens
|
||||
// method.
|
||||
func (client *ValidateForBackupClient) RefreshTokens(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *ValidateForBackupClientRefreshTokensOptions) (ValidateForBackupClientRefreshTokensResponse, error) {
|
||||
req, err := client.refreshTokensCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return ValidateForBackupClientRefreshTokensResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return ValidateForBackupClientRefreshTokensResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return ValidateForBackupClientRefreshTokensResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.refreshTokensHandleResponse(resp)
|
||||
}
|
||||
|
||||
// refreshTokensCreateRequest creates the RefreshTokens request.
|
||||
func (client *ValidateForBackupClient) refreshTokensCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *ValidateForBackupClientRefreshTokensOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/validateForBackupOperations/{operationId}:refreshTokens"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// refreshTokensHandleResponse handles the RefreshTokens response.
|
||||
func (client *ValidateForBackupClient) refreshTokensHandleResponse(resp *http.Response) (ValidateForBackupClientRefreshTokensResponse, error) {
|
||||
result := ValidateForBackupClientRefreshTokensResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return ValidateForBackupClientRefreshTokensResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ValidateForBackupResponse); err != nil {
|
||||
return ValidateForBackupClientRefreshTokensResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
|
@ -0,0 +1,244 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.7.6, generator: @autorest/go@4.0.0-preview.42)
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package dataprotectiondatasourceplugin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
)
|
||||
|
||||
type ValidateForProtectionClient struct {
|
||||
pl runtime.Pipeline
|
||||
}
|
||||
|
||||
// NewValidateForProtectionClient creates a new instance of ValidateForProtectionClient with the specified values.
|
||||
// pl - the pipeline used for sending requests and handling responses.
|
||||
func NewValidateForProtectionClient(pl runtime.Pipeline) *ValidateForProtectionClient {
|
||||
client := &ValidateForProtectionClient{
|
||||
pl: pl,
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// Cancel - Cancel the operation. Poll the LRO to get the final status.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - ValidateForProtectionClientCancelOptions contains the optional parameters for the ValidateForProtectionClient.Cancel
|
||||
// method.
|
||||
func (client *ValidateForProtectionClient) Cancel(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *ValidateForProtectionClientCancelOptions) (ValidateForProtectionClientCancelResponse, error) {
|
||||
req, err := client.cancelCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return ValidateForProtectionClientCancelResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return ValidateForProtectionClientCancelResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return ValidateForProtectionClientCancelResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.cancelHandleResponse(resp)
|
||||
}
|
||||
|
||||
// cancelCreateRequest creates the Cancel request.
|
||||
func (client *ValidateForProtectionClient) cancelCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *ValidateForProtectionClientCancelOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/validateForProtectionOperations/{operationId}:cancel"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// cancelHandleResponse handles the Cancel response.
|
||||
func (client *ValidateForProtectionClient) cancelHandleResponse(resp *http.Response) (ValidateForProtectionClientCancelResponse, error) {
|
||||
result := ValidateForProtectionClientCancelResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return ValidateForProtectionClientCancelResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ValidateForProtectionResponse); err != nil {
|
||||
return ValidateForProtectionClientCancelResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Get - Gets the status of a validateForProtection LRO.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - Unique id of the resource
|
||||
// taskID - Unique id of the current task
|
||||
// xmsClientRequestID - Correlation request Id for tracking a particular request.
|
||||
// options - ValidateForProtectionClientGetOptions contains the optional parameters for the ValidateForProtectionClient.Get
|
||||
// method.
|
||||
func (client *ValidateForProtectionClient) Get(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *ValidateForProtectionClientGetOptions) (ValidateForProtectionClientGetResponse, error) {
|
||||
req, err := client.getCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, options)
|
||||
if err != nil {
|
||||
return ValidateForProtectionClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return ValidateForProtectionClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return ValidateForProtectionClientGetResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.getHandleResponse(resp)
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *ValidateForProtectionClient) getCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *ValidateForProtectionClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/validateForProtectionOperations/{operationId}"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *ValidateForProtectionClient) getHandleResponse(resp *http.Response) (ValidateForProtectionClientGetResponse, error) {
|
||||
result := ValidateForProtectionClientGetResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return ValidateForProtectionClientGetResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ValidateForProtectionResponse); err != nil {
|
||||
return ValidateForProtectionClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// RefreshTokens - Refresh tokens for a given operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - ValidateForProtectionClientRefreshTokensOptions contains the optional parameters for the ValidateForProtectionClient.RefreshTokens
|
||||
// method.
|
||||
func (client *ValidateForProtectionClient) RefreshTokens(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *ValidateForProtectionClientRefreshTokensOptions) (ValidateForProtectionClientRefreshTokensResponse, error) {
|
||||
req, err := client.refreshTokensCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return ValidateForProtectionClientRefreshTokensResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return ValidateForProtectionClientRefreshTokensResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return ValidateForProtectionClientRefreshTokensResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.refreshTokensHandleResponse(resp)
|
||||
}
|
||||
|
||||
// refreshTokensCreateRequest creates the RefreshTokens request.
|
||||
func (client *ValidateForProtectionClient) refreshTokensCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *ValidateForProtectionClientRefreshTokensOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/validateForProtectionOperations/{operationId}:refreshTokens"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// refreshTokensHandleResponse handles the RefreshTokens response.
|
||||
func (client *ValidateForProtectionClient) refreshTokensHandleResponse(resp *http.Response) (ValidateForProtectionClientRefreshTokensResponse, error) {
|
||||
result := ValidateForProtectionClientRefreshTokensResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return ValidateForProtectionClientRefreshTokensResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ValidateForProtectionResponse); err != nil {
|
||||
return ValidateForProtectionClientRefreshTokensResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
|
@ -0,0 +1,243 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.7.6, generator: @autorest/go@4.0.0-preview.42)
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package dataprotectiondatasourceplugin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
)
|
||||
|
||||
type ValidateForRestoreClient struct {
|
||||
pl runtime.Pipeline
|
||||
}
|
||||
|
||||
// NewValidateForRestoreClient creates a new instance of ValidateForRestoreClient with the specified values.
|
||||
// pl - the pipeline used for sending requests and handling responses.
|
||||
func NewValidateForRestoreClient(pl runtime.Pipeline) *ValidateForRestoreClient {
|
||||
client := &ValidateForRestoreClient{
|
||||
pl: pl,
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// Cancel - Cancel the operation. Poll the LRO to get the final status.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - ValidateForRestoreClientCancelOptions contains the optional parameters for the ValidateForRestoreClient.Cancel
|
||||
// method.
|
||||
func (client *ValidateForRestoreClient) Cancel(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *ValidateForRestoreClientCancelOptions) (ValidateForRestoreClientCancelResponse, error) {
|
||||
req, err := client.cancelCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return ValidateForRestoreClientCancelResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return ValidateForRestoreClientCancelResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return ValidateForRestoreClientCancelResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.cancelHandleResponse(resp)
|
||||
}
|
||||
|
||||
// cancelCreateRequest creates the Cancel request.
|
||||
func (client *ValidateForRestoreClient) cancelCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters CancelRequest, options *ValidateForRestoreClientCancelOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/validateForRestoreOperations/{operationId}:cancel"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// cancelHandleResponse handles the Cancel response.
|
||||
func (client *ValidateForRestoreClient) cancelHandleResponse(resp *http.Response) (ValidateForRestoreClientCancelResponse, error) {
|
||||
result := ValidateForRestoreClientCancelResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return ValidateForRestoreClientCancelResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ValidateForRestoreResponse); err != nil {
|
||||
return ValidateForRestoreClientCancelResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Get - Gets the status of a validateForRestore LRO.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - Unique id of the resource
|
||||
// taskID - Unique id of the current task
|
||||
// xmsClientRequestID - Correlation request Id for tracking a particular request.
|
||||
// options - ValidateForRestoreClientGetOptions contains the optional parameters for the ValidateForRestoreClient.Get method.
|
||||
func (client *ValidateForRestoreClient) Get(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *ValidateForRestoreClientGetOptions) (ValidateForRestoreClientGetResponse, error) {
|
||||
req, err := client.getCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, options)
|
||||
if err != nil {
|
||||
return ValidateForRestoreClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return ValidateForRestoreClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return ValidateForRestoreClientGetResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.getHandleResponse(resp)
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *ValidateForRestoreClient) getCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, options *ValidateForRestoreClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/validateForRestoreOperations/{operationId}"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *ValidateForRestoreClient) getHandleResponse(resp *http.Response) (ValidateForRestoreClientGetResponse, error) {
|
||||
result := ValidateForRestoreClientGetResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return ValidateForRestoreClientGetResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ValidateForRestoreResponse); err != nil {
|
||||
return ValidateForRestoreClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// RefreshTokens - Refresh tokens for a given operation.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
// Generated from API version 2022-03-01-preview
|
||||
// operationID - Unique Id of this LRO operation
|
||||
// subscriptionID - SubscriptionId of the resource
|
||||
// resourceID - unique id of the resource
|
||||
// taskID - unique id of the current task
|
||||
// xmsClientRequestID - correlation request Id for tracking a particular call.
|
||||
// parameters - Request body for operation
|
||||
// options - ValidateForRestoreClientRefreshTokensOptions contains the optional parameters for the ValidateForRestoreClient.RefreshTokens
|
||||
// method.
|
||||
func (client *ValidateForRestoreClient) RefreshTokens(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *ValidateForRestoreClientRefreshTokensOptions) (ValidateForRestoreClientRefreshTokensResponse, error) {
|
||||
req, err := client.refreshTokensCreateRequest(ctx, operationID, subscriptionID, resourceID, taskID, xmsClientRequestID, parameters, options)
|
||||
if err != nil {
|
||||
return ValidateForRestoreClientRefreshTokensResponse{}, err
|
||||
}
|
||||
resp, err := client.pl.Do(req)
|
||||
if err != nil {
|
||||
return ValidateForRestoreClientRefreshTokensResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(resp, http.StatusOK) {
|
||||
return ValidateForRestoreClientRefreshTokensResponse{}, runtime.NewResponseError(resp)
|
||||
}
|
||||
return client.refreshTokensHandleResponse(resp)
|
||||
}
|
||||
|
||||
// refreshTokensCreateRequest creates the RefreshTokens request.
|
||||
func (client *ValidateForRestoreClient) refreshTokensCreateRequest(ctx context.Context, operationID string, subscriptionID string, resourceID string, taskID string, xmsClientRequestID string, parameters RefreshTokensRequest, options *ValidateForRestoreClientRefreshTokensOptions) (*policy.Request, error) {
|
||||
urlPath := "/plugin/validateForRestoreOperations/{operationId}:refreshTokens"
|
||||
if operationID == "" {
|
||||
return nil, errors.New("parameter operationID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2022-03-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["subscription-id"] = []string{subscriptionID}
|
||||
req.Raw().Header["resource-id"] = []string{resourceID}
|
||||
req.Raw().Header["task-id"] = []string{taskID}
|
||||
req.Raw().Header["x-ms-client-request-id"] = []string{xmsClientRequestID}
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, runtime.MarshalAsJSON(req, parameters)
|
||||
}
|
||||
|
||||
// refreshTokensHandleResponse handles the RefreshTokens response.
|
||||
func (client *ValidateForRestoreClient) refreshTokensHandleResponse(resp *http.Response) (ValidateForRestoreClientRefreshTokensResponse, error) {
|
||||
result := ValidateForRestoreClientRefreshTokensResponse{}
|
||||
if val := resp.Header.Get("Retry-After"); val != "" {
|
||||
retryAfter32, err := strconv.ParseInt(val, 10, 32)
|
||||
retryAfter := int32(retryAfter32)
|
||||
if err != nil {
|
||||
return ValidateForRestoreClientRefreshTokensResponse{}, err
|
||||
}
|
||||
result.RetryAfter = &retryAfter
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-error-code"); val != "" {
|
||||
result.XMSErrorCode = &val
|
||||
}
|
||||
if val := resp.Header.Get("x-ms-request-id"); val != "" {
|
||||
result.XMSRequestID = &val
|
||||
}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ValidateForRestoreResponse); err != nil {
|
||||
return ValidateForRestoreClientRefreshTokensResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
Загрузка…
Ссылка в новой задаче