diff --git a/services/recoveryservices/mgmt/2019-06-15/backup/backupapi/interfaces.go b/services/recoveryservices/mgmt/2019-06-15/backup/backupapi/interfaces.go index 7b20b6a876fb..b5fe4994b64f 100644 --- a/services/recoveryservices/mgmt/2019-06-15/backup/backupapi/interfaces.go +++ b/services/recoveryservices/mgmt/2019-06-15/backup/backupapi/interfaces.go @@ -26,6 +26,7 @@ import ( // ResourceVaultConfigsClientAPI contains the set of methods on the ResourceVaultConfigsClient type. type ResourceVaultConfigsClientAPI interface { Get(ctx context.Context, vaultName string, resourceGroupName string) (result backup.ResourceVaultConfigResource, err error) + Put(ctx context.Context, vaultName string, resourceGroupName string, parameters backup.ResourceVaultConfigResource) (result backup.ResourceVaultConfigResource, err error) Update(ctx context.Context, vaultName string, resourceGroupName string, parameters backup.ResourceVaultConfigResource) (result backup.ResourceVaultConfigResource, err error) } diff --git a/services/recoveryservices/mgmt/2019-06-15/backup/models.go b/services/recoveryservices/mgmt/2019-06-15/backup/models.go index c6f7ec3067df..8cce8a41d291 100644 --- a/services/recoveryservices/mgmt/2019-06-15/backup/models.go +++ b/services/recoveryservices/mgmt/2019-06-15/backup/models.go @@ -12481,6 +12481,14 @@ type EngineExtendedInfo struct { AzureProtectedInstances *int32 `json:"azureProtectedInstances,omitempty"` } +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + // ErrorDetail error Detail class which encapsulates Code, Message and Recommendations. type ErrorDetail struct { // Code - READ-ONLY; Error code. @@ -12491,6 +12499,20 @@ type ErrorDetail struct { Recommendations *[]string `json:"recommendations,omitempty"` } +// ErrorResponse the resource management error response. +type ErrorResponse struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorResponse `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + // ExportJobsOperationResultInfo this class is used to send blob details after exporting jobs. type ExportJobsOperationResultInfo struct { // BlobURL - URL of the blob into which the serialized string of list of jobs is exported. diff --git a/services/recoveryservices/mgmt/2019-06-15/backup/resourcevaultconfigs.go b/services/recoveryservices/mgmt/2019-06-15/backup/resourcevaultconfigs.go index 6a0320a9368f..bd15ce7eb7db 100644 --- a/services/recoveryservices/mgmt/2019-06-15/backup/resourcevaultconfigs.go +++ b/services/recoveryservices/mgmt/2019-06-15/backup/resourcevaultconfigs.go @@ -118,6 +118,85 @@ func (client ResourceVaultConfigsClient) GetResponder(resp *http.Response) (resu return } +// Put updates vault security config. +// Parameters: +// vaultName - the name of the recovery services vault. +// resourceGroupName - the name of the resource group where the recovery services vault is present. +// parameters - resource config request +func (client ResourceVaultConfigsClient) Put(ctx context.Context, vaultName string, resourceGroupName string, parameters ResourceVaultConfigResource) (result ResourceVaultConfigResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceVaultConfigsClient.Put") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PutPreparer(ctx, vaultName, resourceGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "backup.ResourceVaultConfigsClient", "Put", nil, "Failure preparing request") + return + } + + resp, err := client.PutSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "backup.ResourceVaultConfigsClient", "Put", resp, "Failure sending request") + return + } + + result, err = client.PutResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "backup.ResourceVaultConfigsClient", "Put", resp, "Failure responding to request") + } + + return +} + +// PutPreparer prepares the Put request. +func (client ResourceVaultConfigsClient) PutPreparer(ctx context.Context, vaultName string, resourceGroupName string, parameters ResourceVaultConfigResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2019-06-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PutSender sends the Put request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceVaultConfigsClient) PutSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PutResponder handles the response to the Put request. The method always +// closes the http.Response Body. +func (client ResourceVaultConfigsClient) PutResponder(resp *http.Response) (result ResourceVaultConfigResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Update updates vault security config. // Parameters: // vaultName - the name of the recovery services vault.