diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/IRecoveryServicesClient.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/IRecoveryServicesClient.cs index eafe67a6d30e1..90608a256b5a5 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/IRecoveryServicesClient.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/IRecoveryServicesClient.cs @@ -14,6 +14,10 @@ namespace Microsoft.Azure.Management.RecoveryServices using Microsoft.Rest.Azure; using Models; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; /// /// Recovery Services Client @@ -114,5 +118,45 @@ public partial interface IRecoveryServicesClient : System.IDisposable /// IUsagesOperations Usages { get; } + /// + /// Gets the operation status for a resource. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> GetOperationStatusWithHttpMessagesAsync(string resourceGroupName, string vaultName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Gets the operation result for a resource. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> GetOperationResultWithHttpMessagesAsync(string resourceGroupName, string vaultName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } } diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/IVaultsOperations.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/IVaultsOperations.cs index f69cfbed75297..82f1923cf052b 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/IVaultsOperations.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/IVaultsOperations.cs @@ -174,6 +174,64 @@ public partial interface IVaultsOperations /// Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, PatchVault vault, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Creates or updates a Recovery Services vault. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// Recovery Services Vault to be created. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, Vault vault, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the vault. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// Recovery Services Vault to be created. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, PatchVault vault, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Fetches all the resources of the specified type in the /// subscription. /// diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/CmkKekIdentity.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/CmkKekIdentity.cs new file mode 100644 index 0000000000000..2b343f2813125 --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/CmkKekIdentity.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.RecoveryServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The details of the identity used for CMK + /// + public partial class CmkKekIdentity + { + /// + /// Initializes a new instance of the CmkKekIdentity class. + /// + public CmkKekIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CmkKekIdentity class. + /// + /// Indicate that system + /// assigned identity should be used. Mutually exclusive with + /// 'userAssignedIdentity' field + /// The user assigned identity to be + /// used to grant permissions in case the type of identity used is + /// UserAssigned + public CmkKekIdentity(bool? useSystemAssignedIdentity = default(bool?), string userAssignedIdentity = default(string)) + { + UseSystemAssignedIdentity = useSystemAssignedIdentity; + UserAssignedIdentity = userAssignedIdentity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicate that system assigned identity should be used. + /// Mutually exclusive with 'userAssignedIdentity' field + /// + [JsonProperty(PropertyName = "useSystemAssignedIdentity")] + public bool? UseSystemAssignedIdentity { get; set; } + + /// + /// Gets or sets the user assigned identity to be used to grant + /// permissions in case the type of identity used is UserAssigned + /// + [JsonProperty(PropertyName = "userAssignedIdentity")] + public string UserAssignedIdentity { get; set; } + + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/CmkKeyVaultProperties.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/CmkKeyVaultProperties.cs new file mode 100644 index 0000000000000..739e091709c7d --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/CmkKeyVaultProperties.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.RecoveryServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of the Key Vault which hosts CMK + /// + public partial class CmkKeyVaultProperties + { + /// + /// Initializes a new instance of the CmkKeyVaultProperties class. + /// + public CmkKeyVaultProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CmkKeyVaultProperties class. + /// + /// The key uri of the Customer Managed + /// Key + public CmkKeyVaultProperties(string keyUri = default(string)) + { + KeyUri = keyUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the key uri of the Customer Managed Key + /// + [JsonProperty(PropertyName = "keyUri")] + public string KeyUri { get; set; } + + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/CreatedByType.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/CreatedByType.cs new file mode 100644 index 0000000000000..ae622552f3ce7 --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/CreatedByType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.RecoveryServices.Models +{ + + /// + /// Defines values for CreatedByType. + /// + public static class CreatedByType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/Error.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/Error.cs new file mode 100644 index 0000000000000..90304aca9acc5 --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/Error.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.RecoveryServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource management error response. + /// + public partial class Error + { + /// + /// Initializes a new instance of the Error class. + /// + public Error() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Error class. + /// + /// The error additional info. + /// The error code. + /// The error details. + /// The error message. + /// The error target. + public Error(IList additionalInfo = default(IList), string code = default(string), IList details = default(IList), string message = default(string), string target = default(string)) + { + AdditionalInfo = additionalInfo; + Code = code; + Details = details; + Message = message; + Target = target; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 0000000000000..fc17370819e83 --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/ErrorAdditionalInfo.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.RecoveryServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource management error additional info. + /// + public partial class ErrorAdditionalInfo + { + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + public ErrorAdditionalInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + /// The additional info. + /// The additional info type. + public ErrorAdditionalInfo(object info = default(object), string type = default(string)) + { + Info = info; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the additional info. + /// + [JsonProperty(PropertyName = "info")] + public object Info { get; private set; } + + /// + /// Gets the additional info type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/IdentityData.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/IdentityData.cs index 052f13f2507a5..ecf67fe9a0d53 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/IdentityData.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/IdentityData.cs @@ -12,6 +12,8 @@ namespace Microsoft.Azure.Management.RecoveryServices.Models { using Microsoft.Rest; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -30,16 +32,25 @@ public IdentityData() /// /// Initializes a new instance of the IdentityData class. /// - /// The identity type. Possible values include: - /// 'SystemAssigned', 'None' + /// The type of managed identity used. The type + /// 'SystemAssigned, UserAssigned' includes both an implicitly created + /// identity and a set of user-assigned identities. The type 'None' + /// will remove any identities. Possible values include: + /// 'SystemAssigned', 'None', 'UserAssigned', 'SystemAssigned, + /// UserAssigned' /// The principal ID of resource /// identity. /// The tenant ID of resource. - public IdentityData(string type, string principalId = default(string), string tenantId = default(string)) + /// The list of user-assigned + /// identities associated with the resource. The user-assigned identity + /// dictionary keys will be ARM resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + public IdentityData(string type, string principalId = default(string), string tenantId = default(string), IDictionary userAssignedIdentities = default(IDictionary)) { PrincipalId = principalId; TenantId = tenantId; Type = type; + UserAssignedIdentities = userAssignedIdentities; CustomInit(); } @@ -61,12 +72,25 @@ public IdentityData() public string TenantId { get; private set; } /// - /// Gets or sets the identity type. Possible values include: - /// 'SystemAssigned', 'None' + /// Gets or sets the type of managed identity used. The type + /// 'SystemAssigned, UserAssigned' includes both an implicitly created + /// identity and a set of user-assigned identities. The type 'None' + /// will remove any identities. Possible values include: + /// 'SystemAssigned', 'None', 'UserAssigned', 'SystemAssigned, + /// UserAssigned' /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } + /// + /// Gets or sets the list of user-assigned identities associated with + /// the resource. The user-assigned identity dictionary keys will be + /// ARM resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + /// /// Validate the object. /// diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/InfrastructureEncryptionState.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/InfrastructureEncryptionState.cs new file mode 100644 index 0000000000000..d0ff75b9b96d4 --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/InfrastructureEncryptionState.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.RecoveryServices.Models +{ + + /// + /// Defines values for InfrastructureEncryptionState. + /// + public static class InfrastructureEncryptionState + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/OperationResource.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/OperationResource.cs new file mode 100644 index 0000000000000..fe6ae3969b02b --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/OperationResource.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.RecoveryServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Operation Resource + /// + public partial class OperationResource + { + /// + /// Initializes a new instance of the OperationResource class. + /// + public OperationResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationResource class. + /// + /// End time of the operation + /// Required if status == failed or status == + /// canceled. This is the OData v4 error format, used by the RPC and + /// will go into the v2.2 Azure REST API guidelines. + /// It should match what is used to GET the operation + /// result + /// It must match the last segment of the "id" + /// field, and will typically be a GUID / system generated + /// value + /// The status of the operation. + /// (InProgress/Success/Failed/Cancelled) + /// Start time of the operation + public OperationResource(System.DateTime? endTime = default(System.DateTime?), Error error = default(Error), string id = default(string), string name = default(string), string status = default(string), System.DateTime? startTime = default(System.DateTime?)) + { + EndTime = endTime; + Error = error; + Id = id; + Name = name; + Status = status; + StartTime = startTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets end time of the operation + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime? EndTime { get; set; } + + /// + /// Gets or sets required if status == failed or status == canceled. + /// This is the OData v4 error format, used by the RPC and will go into + /// the v2.2 Azure REST API guidelines. + /// + [JsonProperty(PropertyName = "error")] + public Error Error { get; set; } + + /// + /// Gets or sets it should match what is used to GET the operation + /// result + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets it must match the last segment of the "id" field, and + /// will typically be a GUID / system generated value + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the status of the operation. + /// (InProgress/Success/Failed/Cancelled) + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets start time of the operation + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; set; } + + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/PatchTrackedResource.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/PatchTrackedResource.cs index f7a7aa9a7db0e..cb5c535ac08a9 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/PatchTrackedResource.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/PatchTrackedResource.cs @@ -37,11 +37,11 @@ public PatchTrackedResource() /// resource. /// Resource type represents the complete path of /// the form Namespace/ResourceType/ResourceType/... - /// Optional ETag. + /// Optional ETag. /// Resource location. /// Resource tags. - public PatchTrackedResource(string id = default(string), string name = default(string), string type = default(string), string eTag = default(string), string location = default(string), IDictionary tags = default(IDictionary)) - : base(id, name, type, eTag) + public PatchTrackedResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + : base(id, name, type, etag) { Location = location; Tags = tags; diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/PatchVault.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/PatchVault.cs index 5b56a4b874aef..1753d6e798a81 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/PatchVault.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/PatchVault.cs @@ -37,11 +37,11 @@ public PatchVault() /// resource. /// Resource type represents the complete path of /// the form Namespace/ResourceType/ResourceType/... - /// Optional ETag. + /// Optional ETag. /// Resource location. /// Resource tags. - public PatchVault(string id = default(string), string name = default(string), string type = default(string), string eTag = default(string), string location = default(string), IDictionary tags = default(IDictionary), VaultProperties properties = default(VaultProperties), Sku sku = default(Sku), IdentityData identity = default(IdentityData)) - : base(id, name, type, eTag, location, tags) + public PatchVault(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string location = default(string), IDictionary tags = default(IDictionary), VaultProperties properties = default(VaultProperties), Sku sku = default(Sku), IdentityData identity = default(IdentityData)) + : base(id, name, type, etag, location, tags) { Properties = properties; Sku = sku; diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/Resource.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/Resource.cs index a7f83e9364ff4..7bc3d2e0b7457 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/Resource.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/Resource.cs @@ -37,13 +37,13 @@ public Resource() /// resource. /// Resource type represents the complete path of /// the form Namespace/ResourceType/ResourceType/... - /// Optional ETag. - public Resource(string id = default(string), string name = default(string), string type = default(string), string eTag = default(string)) + /// Optional ETag. + public Resource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) { Id = id; Name = name; Type = type; - ETag = eTag; + Etag = etag; CustomInit(); } @@ -74,8 +74,8 @@ public Resource() /// /// Gets or sets optional ETag. /// - [JsonProperty(PropertyName = "eTag")] - public string ETag { get; set; } + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } } } diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/ResourceCertificateAndAadDetails.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/ResourceCertificateAndAadDetails.cs index d95a50303f0e0..3f8a648211047 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/ResourceCertificateAndAadDetails.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/ResourceCertificateAndAadDetails.cs @@ -51,7 +51,8 @@ public ResourceCertificateAndAadDetails() /// Certificate Validity start Date /// time. /// Certificate Validity End Date time. - public ResourceCertificateAndAadDetails(string aadAuthority, string aadTenantId, string servicePrincipalClientId, string servicePrincipalObjectId, string azureManagementEndpointAudience, byte[] certificate = default(byte[]), string friendlyName = default(string), string issuer = default(string), long? resourceId = default(long?), string subject = default(string), string thumbprint = default(string), System.DateTime? validFrom = default(System.DateTime?), System.DateTime? validTo = default(System.DateTime?)) + /// Service Resource Id. + public ResourceCertificateAndAadDetails(string aadAuthority, string aadTenantId, string servicePrincipalClientId, string servicePrincipalObjectId, string azureManagementEndpointAudience, byte[] certificate = default(byte[]), string friendlyName = default(string), string issuer = default(string), long? resourceId = default(long?), string subject = default(string), string thumbprint = default(string), System.DateTime? validFrom = default(System.DateTime?), System.DateTime? validTo = default(System.DateTime?), string serviceResourceId = default(string)) : base(certificate, friendlyName, issuer, resourceId, subject, thumbprint, validFrom, validTo) { AadAuthority = aadAuthority; @@ -59,6 +60,7 @@ public ResourceCertificateAndAadDetails() ServicePrincipalClientId = servicePrincipalClientId; ServicePrincipalObjectId = servicePrincipalObjectId; AzureManagementEndpointAudience = azureManagementEndpointAudience; + ServiceResourceId = serviceResourceId; CustomInit(); } @@ -97,6 +99,12 @@ public ResourceCertificateAndAadDetails() [JsonProperty(PropertyName = "azureManagementEndpointAudience")] public string AzureManagementEndpointAudience { get; set; } + /// + /// Gets or sets service Resource Id. + /// + [JsonProperty(PropertyName = "serviceResourceId")] + public string ServiceResourceId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/ResourceIdentityType.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/ResourceIdentityType.cs index 0ea68639fe07b..b3c22e81e7740 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/ResourceIdentityType.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/ResourceIdentityType.cs @@ -18,5 +18,7 @@ public static class ResourceIdentityType { public const string SystemAssigned = "SystemAssigned"; public const string None = "None"; + public const string UserAssigned = "UserAssigned"; + public const string SystemAssignedUserAssigned = "SystemAssigned, UserAssigned"; } } diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/Sku.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/Sku.cs index a5ad264045a55..254536a463bb0 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/Sku.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/Sku.cs @@ -32,9 +32,11 @@ public Sku() /// /// The Sku name. Possible values include: /// 'Standard', 'RS0' - public Sku(string name) + /// The Sku tier. + public Sku(string name, string tier = default(string)) { Name = name; + Tier = tier; CustomInit(); } @@ -50,6 +52,12 @@ public Sku(string name) [JsonProperty(PropertyName = "name")] public string Name { get; set; } + /// + /// Gets or sets the Sku tier. + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; set; } + /// /// Validate the object. /// diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/SystemData.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/SystemData.cs new file mode 100644 index 0000000000000..a9cd2f2a86c76 --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/SystemData.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.RecoveryServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata pertaining to creation and last modification of the resource. + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// The identity that created the + /// resource. + /// The type of identity that created the + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// The timestamp of resource creation + /// (UTC). + /// The identity that last modified the + /// resource. + /// The type of identity that last + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The type of identity that last + /// modified the resource. + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity that created the resource. + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource creation (UTC). + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTime? CreatedAt { get; set; } + + /// + /// Gets or sets the identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTime? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/TrackedResource.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/TrackedResource.cs index e363a7093f468..9ea6761dd486a 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/TrackedResource.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/TrackedResource.cs @@ -39,10 +39,10 @@ public TrackedResource() /// resource. /// Resource type represents the complete path of /// the form Namespace/ResourceType/ResourceType/... - /// Optional ETag. + /// Optional ETag. /// Resource tags. - public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), string eTag = default(string), IDictionary tags = default(IDictionary)) - : base(id, name, type, eTag) + public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary)) + : base(id, name, type, etag) { Location = location; Tags = tags; diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/UserIdentity.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/UserIdentity.cs new file mode 100644 index 0000000000000..d59a11306bbdf --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/UserIdentity.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.RecoveryServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A resource identity that is managed by the user of the service. + /// + public partial class UserIdentity + { + /// + /// Initializes a new instance of the UserIdentity class. + /// + public UserIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserIdentity class. + /// + /// The principal ID of the user-assigned + /// identity. + /// The client ID of the user-assigned + /// identity. + public UserIdentity(string principalId = default(string), string clientId = default(string)) + { + PrincipalId = principalId; + ClientId = clientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal ID of the user-assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the client ID of the user-assigned identity. + /// + [JsonProperty(PropertyName = "clientId")] + public string ClientId { get; private set; } + + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/Vault.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/Vault.cs index d180b87a4364b..65191b68d14b8 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/Vault.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/Vault.cs @@ -38,14 +38,15 @@ public Vault() /// resource. /// Resource type represents the complete path of /// the form Namespace/ResourceType/ResourceType/... - /// Optional ETag. + /// Optional ETag. /// Resource tags. - public Vault(string location, string id = default(string), string name = default(string), string type = default(string), string eTag = default(string), IDictionary tags = default(IDictionary), IdentityData identity = default(IdentityData), VaultProperties properties = default(VaultProperties), Sku sku = default(Sku)) - : base(location, id, name, type, eTag, tags) + public Vault(string location, string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary), IdentityData identity = default(IdentityData), VaultProperties properties = default(VaultProperties), Sku sku = default(Sku), SystemData systemData = default(SystemData)) + : base(location, id, name, type, etag, tags) { Identity = identity; Properties = properties; Sku = sku; + SystemData = systemData; CustomInit(); } @@ -69,6 +70,11 @@ public Vault() [JsonProperty(PropertyName = "sku")] public Sku Sku { get; set; } + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + /// /// Validate the object. /// diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/VaultExtendedInfoResource.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/VaultExtendedInfoResource.cs index 4619f590b8b58..ed3a622930b56 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/VaultExtendedInfoResource.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/VaultExtendedInfoResource.cs @@ -38,14 +38,14 @@ public VaultExtendedInfoResource() /// resource. /// Resource type represents the complete path of /// the form Namespace/ResourceType/ResourceType/... - /// Optional ETag. + /// Optional ETag. /// Integrity key. /// Encryption key. /// Encryption key /// thumbprint. /// Algorithm for Vault ExtendedInfo - public VaultExtendedInfoResource(string id = default(string), string name = default(string), string type = default(string), string eTag = default(string), string integrityKey = default(string), string encryptionKey = default(string), string encryptionKeyThumbprint = default(string), string algorithm = default(string)) - : base(id, name, type, eTag) + public VaultExtendedInfoResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string integrityKey = default(string), string encryptionKey = default(string), string encryptionKeyThumbprint = default(string), string algorithm = default(string)) + : base(id, name, type, etag) { IntegrityKey = integrityKey; EncryptionKey = encryptionKey; diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/VaultProperties.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/VaultProperties.cs index 6c7e81d024d45..afc1954d58e27 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/VaultProperties.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/VaultProperties.cs @@ -39,13 +39,16 @@ public VaultProperties() /// Private endpoint /// state for site recovery. Possible values include: 'None', /// 'Enabled' - public VaultProperties(string provisioningState = default(string), UpgradeDetails upgradeDetails = default(UpgradeDetails), IList privateEndpointConnections = default(IList), string privateEndpointStateForBackup = default(string), string privateEndpointStateForSiteRecovery = default(string)) + /// Customer Managed Key details of the + /// resource. + public VaultProperties(string provisioningState = default(string), UpgradeDetails upgradeDetails = default(UpgradeDetails), IList privateEndpointConnections = default(IList), string privateEndpointStateForBackup = default(string), string privateEndpointStateForSiteRecovery = default(string), VaultPropertiesEncryption encryption = default(VaultPropertiesEncryption)) { ProvisioningState = provisioningState; UpgradeDetails = upgradeDetails; PrivateEndpointConnections = privateEndpointConnections; PrivateEndpointStateForBackup = privateEndpointStateForBackup; PrivateEndpointStateForSiteRecovery = privateEndpointStateForSiteRecovery; + Encryption = encryption; CustomInit(); } @@ -85,5 +88,11 @@ public VaultProperties() [JsonProperty(PropertyName = "privateEndpointStateForSiteRecovery")] public string PrivateEndpointStateForSiteRecovery { get; private set; } + /// + /// Gets or sets customer Managed Key details of the resource. + /// + [JsonProperty(PropertyName = "encryption")] + public VaultPropertiesEncryption Encryption { get; set; } + } } diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/VaultPropertiesEncryption.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/VaultPropertiesEncryption.cs new file mode 100644 index 0000000000000..032f9e4b9db5f --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/Models/VaultPropertiesEncryption.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.RecoveryServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Customer Managed Key details of the resource. + /// + public partial class VaultPropertiesEncryption + { + /// + /// Initializes a new instance of the VaultPropertiesEncryption class. + /// + public VaultPropertiesEncryption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VaultPropertiesEncryption class. + /// + /// Enabling/Disabling the + /// Double Encryption state. Possible values include: 'Enabled', + /// 'Disabled' + public VaultPropertiesEncryption(CmkKeyVaultProperties keyVaultProperties = default(CmkKeyVaultProperties), CmkKekIdentity kekIdentity = default(CmkKekIdentity), string infrastructureEncryption = default(string)) + { + KeyVaultProperties = keyVaultProperties; + KekIdentity = kekIdentity; + InfrastructureEncryption = infrastructureEncryption; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "keyVaultProperties")] + public CmkKeyVaultProperties KeyVaultProperties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "kekIdentity")] + public CmkKekIdentity KekIdentity { get; set; } + + /// + /// Gets or sets enabling/Disabling the Double Encryption state. + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "infrastructureEncryption")] + public string InfrastructureEncryption { get; set; } + + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesClient.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesClient.cs index 9712df407dcc7..d43f30c99a69a 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesClient.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesClient.cs @@ -20,6 +20,8 @@ namespace Microsoft.Azure.Management.RecoveryServices using System.Linq; using System.Net; using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; /// /// Recovery Services Client @@ -370,7 +372,7 @@ private void Initialize() VaultExtendedInfo = new VaultExtendedInfoOperations(this); Usages = new UsagesOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2016-06-01"; + ApiVersion = "2021-03-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; @@ -406,5 +408,415 @@ private void Initialize() DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } + /// + /// Gets the operation status for a resource. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetOperationStatusWithHttpMessagesAsync(string resourceGroupName, string vaultName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vaultName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); + } + if (operationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + } + if (ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("operationId", operationId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetOperationStatus", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/operationStatus/{operationId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); + List _queryParameters = new List(); + if (ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the operation result for a resource. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetOperationResultWithHttpMessagesAsync(string resourceGroupName, string vaultName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vaultName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); + } + if (operationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + } + if (ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("operationId", operationId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetOperationResult", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/operationResults/{operationId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); + List _queryParameters = new List(); + if (ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesClientExtensions.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesClientExtensions.cs new file mode 100644 index 0000000000000..9a17669d41de2 --- /dev/null +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/RecoveryServicesClientExtensions.cs @@ -0,0 +1,117 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.RecoveryServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for RecoveryServicesClient. + /// + public static partial class RecoveryServicesClientExtensions + { + /// + /// Gets the operation status for a resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// + public static OperationResource GetOperationStatus(this IRecoveryServicesClient operations, string resourceGroupName, string vaultName, string operationId) + { + return operations.GetOperationStatusAsync(resourceGroupName, vaultName, operationId).GetAwaiter().GetResult(); + } + + /// + /// Gets the operation status for a resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetOperationStatusAsync(this IRecoveryServicesClient operations, string resourceGroupName, string vaultName, string operationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetOperationStatusWithHttpMessagesAsync(resourceGroupName, vaultName, operationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the operation result for a resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// + public static Vault GetOperationResult(this IRecoveryServicesClient operations, string resourceGroupName, string vaultName, string operationId) + { + return operations.GetOperationResultAsync(resourceGroupName, vaultName, operationId).GetAwaiter().GetResult(); + } + + /// + /// Gets the operation result for a resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetOperationResultAsync(this IRecoveryServicesClient operations, string resourceGroupName, string vaultName, string operationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetOperationResultWithHttpMessagesAsync(resourceGroupName, vaultName, operationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/SdkInfo_RecoveryServicesClient.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/SdkInfo_RecoveryServicesClient.cs index fbc015bb2e165..45e137fe050da 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/SdkInfo_RecoveryServicesClient.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/SdkInfo_RecoveryServicesClient.cs @@ -19,28 +19,19 @@ public static IEnumerable> ApiInfo_RecoveryService { return new Tuple[] { - new Tuple("RecoveryServices", "Operations", "2016-06-01"), - new Tuple("RecoveryServices", "PrivateLinkResources", "2016-06-01"), - new Tuple("RecoveryServices", "RecoveryServices", "2016-06-01"), - new Tuple("RecoveryServices", "RegisteredIdentities", "2016-06-01"), - new Tuple("RecoveryServices", "ReplicationUsages", "2016-06-01"), - new Tuple("RecoveryServices", "Usages", "2016-06-01"), - new Tuple("RecoveryServices", "VaultCertificates", "2016-06-01"), - new Tuple("RecoveryServices", "VaultExtendedInfo", "2016-06-01"), - new Tuple("RecoveryServices", "Vaults", "2016-06-01"), + new Tuple("RecoveryServices", "GetOperationResult", "2021-03-01"), + new Tuple("RecoveryServices", "GetOperationStatus", "2021-03-01"), + new Tuple("RecoveryServices", "Operations", "2021-03-01"), + new Tuple("RecoveryServices", "PrivateLinkResources", "2021-03-01"), + new Tuple("RecoveryServices", "RecoveryServices", "2021-03-01"), + new Tuple("RecoveryServices", "RegisteredIdentities", "2021-03-01"), + new Tuple("RecoveryServices", "ReplicationUsages", "2021-03-01"), + new Tuple("RecoveryServices", "Usages", "2021-03-01"), + new Tuple("RecoveryServices", "VaultCertificates", "2021-03-01"), + new Tuple("RecoveryServices", "VaultExtendedInfo", "2021-03-01"), + new Tuple("RecoveryServices", "Vaults", "2021-03-01"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "V2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/recoveryservices/resource-manager/readme.md --csharp --version=V2 --reflect-api-versions --csharp-sdks-folder=D:\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "88fa0d128fbcf2d1ff3b330add6b4425c84f4149"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/VaultsOperations.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/VaultsOperations.cs index 4cd317dd120cd..5c720a6aad381 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/VaultsOperations.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/VaultsOperations.cs @@ -627,6 +627,29 @@ internal VaultsOperations(RecoveryServicesClient client) /// Recovery Services Vault to be created. /// /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, Vault vault, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vaultName, vault, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a vault. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// The name of the recovery services vault. + /// + /// /// Headers that will be added to request. /// /// @@ -635,9 +658,6 @@ internal VaultsOperations(RecoveryServicesClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -647,7 +667,7 @@ internal VaultsOperations(RecoveryServicesClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, Vault vault, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -665,14 +685,6 @@ internal VaultsOperations(RecoveryServicesClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); } - if (vault == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "vault"); - } - if (vault != null) - { - vault.Validate(); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -682,9 +694,8 @@ internal VaultsOperations(RecoveryServicesClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("vaultName", vaultName); - tracingParameters.Add("vault", vault); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -704,7 +715,7 @@ internal VaultsOperations(RecoveryServicesClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -735,12 +746,6 @@ internal VaultsOperations(RecoveryServicesClient client) // Serialize Request string _requestContent = null; - if(vault != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vault, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -761,7 +766,7 @@ internal VaultsOperations(RecoveryServicesClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -796,49 +801,13 @@ internal VaultsOperations(RecoveryServicesClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -847,7 +816,7 @@ internal VaultsOperations(RecoveryServicesClient client) } /// - /// Deletes a vault. + /// Updates the vault. /// /// /// The name of the resource group where the recovery services vault is @@ -856,6 +825,35 @@ internal VaultsOperations(RecoveryServicesClient client) /// /// The name of the recovery services vault. /// + /// + /// Recovery Services Vault to be created. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, PatchVault vault, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, vaultName, vault, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates a Recovery Services vault. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// Recovery Services Vault to be created. + /// /// /// Headers that will be added to request. /// @@ -865,6 +863,9 @@ internal VaultsOperations(RecoveryServicesClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -874,7 +875,7 @@ internal VaultsOperations(RecoveryServicesClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, Vault vault, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -892,6 +893,14 @@ internal VaultsOperations(RecoveryServicesClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); } + if (vault == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vault"); + } + if (vault != null) + { + vault.Validate(); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -901,8 +910,9 @@ internal VaultsOperations(RecoveryServicesClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("vault", vault); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -922,7 +932,7 @@ internal VaultsOperations(RecoveryServicesClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -953,6 +963,12 @@ internal VaultsOperations(RecoveryServicesClient client) // Serialize Request string _requestContent = null; + if(vault != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(vault, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -973,7 +989,7 @@ internal VaultsOperations(RecoveryServicesClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 201) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1008,13 +1024,49 @@ internal VaultsOperations(RecoveryServicesClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1056,7 +1108,7 @@ internal VaultsOperations(RecoveryServicesClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, PatchVault vault, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, PatchVault vault, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -1089,7 +1141,7 @@ internal VaultsOperations(RecoveryServicesClient client) tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("vault", vault); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -1166,7 +1218,7 @@ internal VaultsOperations(RecoveryServicesClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1226,24 +1278,6 @@ internal VaultsOperations(RecoveryServicesClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); diff --git a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/VaultsOperationsExtensions.cs b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/VaultsOperationsExtensions.cs index 4914964943619..7c807d9848c05 100644 --- a/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/VaultsOperationsExtensions.cs +++ b/sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices/src/Generated/VaultsOperationsExtensions.cs @@ -262,6 +262,102 @@ public static Vault Update(this IVaultsOperations operations, string resourceGro } } + /// + /// Creates or updates a Recovery Services vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// Recovery Services Vault to be created. + /// + public static Vault BeginCreateOrUpdate(this IVaultsOperations operations, string resourceGroupName, string vaultName, Vault vault) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, vaultName, vault).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Recovery Services vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// Recovery Services Vault to be created. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IVaultsOperations operations, string resourceGroupName, string vaultName, Vault vault, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vaultName, vault, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// Recovery Services Vault to be created. + /// + public static Vault BeginUpdate(this IVaultsOperations operations, string resourceGroupName, string vaultName, PatchVault vault) + { + return operations.BeginUpdateAsync(resourceGroupName, vaultName, vault).GetAwaiter().GetResult(); + } + + /// + /// Updates the vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// Recovery Services Vault to be created. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IVaultsOperations operations, string resourceGroupName, string vaultName, PatchVault vault, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, vaultName, vault, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Fetches all the resources of the specified type in the subscription. ///