diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeyVaultManagementClient.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeyVaultManagementClient.cs index b1629f6a0bd38..c52d34e300bc7 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeyVaultManagementClient.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeyVaultManagementClient.cs @@ -77,6 +77,16 @@ public partial interface IKeyVaultManagementClient : System.IDisposable /// IVaultsOperations Vaults { get; } + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } + + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + IPrivateLinkResourcesOperations PrivateLinkResources { get; } + /// /// Gets the IOperations. /// diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IPrivateEndpointConnectionsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IPrivateEndpointConnectionsOperations.cs new file mode 100644 index 0000000000000..d71345f8e4914 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IPrivateEndpointConnectionsOperations.cs @@ -0,0 +1,150 @@ +// +// 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.KeyVault +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateEndpointConnectionsOperations operations. + /// + public partial interface IPrivateEndpointConnectionsOperations + { + /// + /// Gets the specified private endpoint connection associated with the + /// key vault. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// Name of the private endpoint connection associated with the key + /// vault. + /// + /// + /// 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> GetWithHttpMessagesAsync(string resourceGroupName, string vaultName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the specified private endpoint connection associated with + /// the key vault. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// Name of the private endpoint connection associated with the key + /// vault. + /// + /// + /// The intended state of private endpoint connection. + /// + /// + /// 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> PutWithHttpMessagesAsync(string resourceGroupName, string vaultName, string privateEndpointConnectionName, PrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified private endpoint connection associated with + /// the key vault. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// Name of the private endpoint connection associated with the key + /// vault. + /// + /// + /// 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> DeleteWithHttpMessagesAsync(string resourceGroupName, string vaultName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified private endpoint connection associated with + /// the key vault. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// Name of the private endpoint connection associated with the key + /// vault. + /// + /// + /// 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> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vaultName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IPrivateLinkResourcesOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IPrivateLinkResourcesOperations.cs new file mode 100644 index 0000000000000..eb4832cf4a723 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IPrivateLinkResourcesOperations.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.KeyVault +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateLinkResourcesOperations operations. + /// + public partial interface IPrivateLinkResourcesOperations + { + /// + /// Gets the private link resources supported for the key vault. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// 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> ListByVaultWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeyVaultManagementClient.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeyVaultManagementClient.cs index 30be6cdeac29d..6939f97563710 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeyVaultManagementClient.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeyVaultManagementClient.cs @@ -82,6 +82,16 @@ public partial class KeyVaultManagementClient : ServiceClient public virtual IVaultsOperations Vaults { get; private set; } + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } + + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } + /// /// Gets the IOperations. /// @@ -329,9 +339,11 @@ public KeyVaultManagementClient(System.Uri baseUri, ServiceClientCredentials cre private void Initialize() { Vaults = new VaultsOperations(this); + PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); + PrivateLinkResources = new PrivateLinkResourcesOperations(this); Operations = new Operations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2018-02-14"; + ApiVersion = "2019-09-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpoint.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpoint.cs new file mode 100644 index 0000000000000..0f1f9dd69ef21 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpoint.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.KeyVault.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Private endpoint object properties. + /// + public partial class PrivateEndpoint + { + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + public PrivateEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + /// Full identifier of the private endpoint + /// resource. + public PrivateEndpoint(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets full identifier of the private endpoint resource. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnection.cs new file mode 100644 index 0000000000000..ba2311ec14ca8 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnection.cs @@ -0,0 +1,78 @@ +// +// 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.KeyVault.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Private endpoint connection resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class PrivateEndpointConnection : IResource + { + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + public PrivateEndpointConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + /// Properties of the private endpoint + /// object. + /// Approval state of + /// the private link connection. + /// Provisioning state of the private + /// endpoint connection. Possible values include: 'Succeeded', + /// 'Creating', 'Updating', 'Deleting', 'Failed', + /// 'Disconnected' + public PrivateEndpointConnection(PrivateEndpoint privateEndpoint = default(PrivateEndpoint), PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState), string provisioningState = default(string)) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of the private endpoint object. + /// + [JsonProperty(PropertyName = "properties.privateEndpoint")] + public PrivateEndpoint PrivateEndpoint { get; set; } + + /// + /// Gets or sets approval state of the private link connection. + /// + [JsonProperty(PropertyName = "properties.privateLinkServiceConnectionState")] + public PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } + + /// + /// Gets or sets provisioning state of the private endpoint connection. + /// Possible values include: 'Succeeded', 'Creating', 'Updating', + /// 'Deleting', 'Failed', 'Disconnected' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnectionItem.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnectionItem.cs new file mode 100644 index 0000000000000..fc159b9dc2af0 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnectionItem.cs @@ -0,0 +1,79 @@ +// +// 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.KeyVault.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Private endpoint connection item. + /// + [Rest.Serialization.JsonTransformation] + public partial class PrivateEndpointConnectionItem + { + /// + /// Initializes a new instance of the PrivateEndpointConnectionItem + /// class. + /// + public PrivateEndpointConnectionItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpointConnectionItem + /// class. + /// + /// Properties of the private endpoint + /// object. + /// Approval state of + /// the private link connection. + /// Provisioning state of the private + /// endpoint connection. Possible values include: 'Succeeded', + /// 'Creating', 'Updating', 'Deleting', 'Failed', + /// 'Disconnected' + public PrivateEndpointConnectionItem(PrivateEndpoint privateEndpoint = default(PrivateEndpoint), PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState), string provisioningState = default(string)) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of the private endpoint object. + /// + [JsonProperty(PropertyName = "properties.privateEndpoint")] + public PrivateEndpoint PrivateEndpoint { get; set; } + + /// + /// Gets or sets approval state of the private link connection. + /// + [JsonProperty(PropertyName = "properties.privateLinkServiceConnectionState")] + public PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } + + /// + /// Gets or sets provisioning state of the private endpoint connection. + /// Possible values include: 'Succeeded', 'Creating', 'Updating', + /// 'Deleting', 'Failed', 'Disconnected' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs new file mode 100644 index 0000000000000..8cc99369303e1 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs @@ -0,0 +1,26 @@ +// +// 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.KeyVault.Models +{ + + /// + /// Defines values for PrivateEndpointConnectionProvisioningState. + /// + public static class PrivateEndpointConnectionProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Creating = "Creating"; + public const string Updating = "Updating"; + public const string Deleting = "Deleting"; + public const string Failed = "Failed"; + public const string Disconnected = "Disconnected"; + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnectionsDeleteHeaders.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnectionsDeleteHeaders.cs new file mode 100644 index 0000000000000..787b92696fd1c --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnectionsDeleteHeaders.cs @@ -0,0 +1,64 @@ +// +// 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.KeyVault.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class PrivateEndpointConnectionsDeleteHeaders + { + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionsDeleteHeaders class. + /// + public PrivateEndpointConnectionsDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionsDeleteHeaders class. + /// + /// The recommended number of seconds to wait + /// before calling the URI specified in the location header. + /// The URI to poll for completion + /// status. + public PrivateEndpointConnectionsDeleteHeaders(int? retryAfter = default(int?), string location = default(string)) + { + RetryAfter = retryAfter; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the recommended number of seconds to wait before + /// calling the URI specified in the location header. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + /// + /// Gets or sets the URI to poll for completion status. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnectionsPutHeaders.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnectionsPutHeaders.cs new file mode 100644 index 0000000000000..0259358958fe3 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnectionsPutHeaders.cs @@ -0,0 +1,70 @@ +// +// 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.KeyVault.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Put operation. + /// + public partial class PrivateEndpointConnectionsPutHeaders + { + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionsPutHeaders class. + /// + public PrivateEndpointConnectionsPutHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionsPutHeaders class. + /// + /// (specified only if operation does not + /// finish synchronously) The recommended number of seconds to wait + /// before calling the URI specified in Azure-AsyncOperation. + /// (specified only if operation does + /// not finish synchronously) The URI to poll for completion status. + /// The response of this URI may be synchronous or + /// asynchronous. + public PrivateEndpointConnectionsPutHeaders(int? retryAfter = default(int?), string azureAsyncOperation = default(string)) + { + RetryAfter = retryAfter; + AzureAsyncOperation = azureAsyncOperation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets (specified only if operation does not finish + /// synchronously) The recommended number of seconds to wait before + /// calling the URI specified in Azure-AsyncOperation. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + /// + /// Gets or sets (specified only if operation does not finish + /// synchronously) The URI to poll for completion status. The response + /// of this URI may be synchronous or asynchronous. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs new file mode 100644 index 0000000000000..aa8b0c7400464 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointServiceConnectionStatus.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.KeyVault.Models +{ + + /// + /// Defines values for PrivateEndpointServiceConnectionStatus. + /// + public static class PrivateEndpointServiceConnectionStatus + { + public const string Pending = "Pending"; + public const string Approved = "Approved"; + public const string Rejected = "Rejected"; + public const string Disconnected = "Disconnected"; + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateLinkResource.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateLinkResource.cs new file mode 100644 index 0000000000000..d4a4cf2d5482f --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateLinkResource.cs @@ -0,0 +1,84 @@ +// +// 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.KeyVault.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A private link resource + /// + [Rest.Serialization.JsonTransformation] + public partial class PrivateLinkResource : Resource + { + /// + /// Initializes a new instance of the PrivateLinkResource class. + /// + public PrivateLinkResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResource class. + /// + /// Fully qualified identifier of the key vault + /// resource. + /// Name of the key vault resource. + /// Resource type of the key vault resource. + /// Azure location of the key vault + /// resource. + /// Tags assigned to the key vault resource. + /// Group identifier of private link + /// resource. + /// Required member names of private link + /// resource. + /// Required DNS zone names of the the + /// private link resource. + public PrivateLinkResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string groupId = default(string), IList requiredMembers = default(IList), IList requiredZoneNames = default(IList)) + : base(id, name, type, location, tags) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets group identifier of private link resource. + /// + [JsonProperty(PropertyName = "properties.groupId")] + public string GroupId { get; private set; } + + /// + /// Gets required member names of private link resource. + /// + [JsonProperty(PropertyName = "properties.requiredMembers")] + public IList RequiredMembers { get; private set; } + + /// + /// Gets or sets required DNS zone names of the the private link + /// resource. + /// + [JsonProperty(PropertyName = "properties.requiredZoneNames")] + public IList RequiredZoneNames { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateLinkResourceListResult.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateLinkResourceListResult.cs new file mode 100644 index 0000000000000..fd22626df1cdc --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateLinkResourceListResult.cs @@ -0,0 +1,55 @@ +// +// 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.KeyVault.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of private link resources + /// + public partial class PrivateLinkResourceListResult + { + /// + /// Initializes a new instance of the PrivateLinkResourceListResult + /// class. + /// + public PrivateLinkResourceListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResourceListResult + /// class. + /// + /// Array of private link resources + public PrivateLinkResourceListResult(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of private link resources + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateLinkServiceConnectionState.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateLinkServiceConnectionState.cs new file mode 100644 index 0000000000000..936f811c968d6 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateLinkServiceConnectionState.cs @@ -0,0 +1,78 @@ +// +// 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.KeyVault.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An object that represents the approval state of the private link + /// connection. + /// + public partial class PrivateLinkServiceConnectionState + { + /// + /// Initializes a new instance of the PrivateLinkServiceConnectionState + /// class. + /// + public PrivateLinkServiceConnectionState() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkServiceConnectionState + /// class. + /// + /// Indicates whether the connection has been + /// approved, rejected or removed by the key vault owner. Possible + /// values include: 'Pending', 'Approved', 'Rejected', + /// 'Disconnected' + /// The reason for approval or + /// rejection. + /// A message indicating if changes on the + /// service provider require any updates on the consumer. + public PrivateLinkServiceConnectionState(string status = default(string), string description = default(string), string actionRequired = default(string)) + { + Status = status; + Description = description; + ActionRequired = actionRequired; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether the connection has been approved, + /// rejected or removed by the key vault owner. Possible values + /// include: 'Pending', 'Approved', 'Rejected', 'Disconnected' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the reason for approval or rejection. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets a message indicating if changes on the service + /// provider require any updates on the consumer. + /// + [JsonProperty(PropertyName = "actionRequired")] + public string ActionRequired { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Resource.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Resource.cs index febfb3d09cb83..f645a55249029 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Resource.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Resource.cs @@ -33,15 +33,14 @@ public Resource() /// /// Initializes a new instance of the Resource class. /// - /// The supported Azure location where the key - /// vault should be created. - /// The Azure Resource Manager resource ID for the key - /// vault. - /// The name of the key vault. - /// The resource type of the key vault. - /// The tags that will be assigned to the key vault. - /// - public Resource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + /// Fully qualified identifier of the key vault + /// resource. + /// Name of the key vault resource. + /// Resource type of the key vault resource. + /// Azure location of the key vault + /// resource. + /// Tags assigned to the key vault resource. + public Resource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) { Id = id; Name = name; @@ -57,48 +56,34 @@ public Resource() partial void CustomInit(); /// - /// Gets the Azure Resource Manager resource ID for the key vault. + /// Gets fully qualified identifier of the key vault resource. /// [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// - /// Gets the name of the key vault. + /// Gets name of the key vault resource. /// [JsonProperty(PropertyName = "name")] public string Name { get; private set; } /// - /// Gets the resource type of the key vault. + /// Gets resource type of the key vault resource. /// [JsonProperty(PropertyName = "type")] public string Type { get; private set; } /// - /// Gets or sets the supported Azure location where the key vault - /// should be created. + /// Gets azure location of the key vault resource. /// [JsonProperty(PropertyName = "location")] - public string Location { get; set; } + public string Location { get; private set; } /// - /// Gets or sets the tags that will be assigned to the key vault. + /// Gets tags assigned to the key vault resource. /// [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } + public IDictionary Tags { get; private set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Location == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Location"); - } - } } } diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Vault.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Vault.cs index ab0b32bfe87d1..9cd7362df5be5 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Vault.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Vault.cs @@ -11,6 +11,7 @@ namespace Microsoft.Azure.Management.KeyVault.Models { using Microsoft.Rest; + using Microsoft.Rest.Azure; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -19,7 +20,7 @@ namespace Microsoft.Azure.Management.KeyVault.Models /// /// Resource information with extended details. /// - public partial class Vault : Resource + public partial class Vault : IResource { /// /// Initializes a new instance of the Vault class. @@ -33,18 +34,21 @@ public Vault() /// /// Initializes a new instance of the Vault class. /// - /// The supported Azure location where the key - /// vault should be created. /// Properties of the vault - /// The Azure Resource Manager resource ID for the key - /// vault. - /// The name of the key vault. - /// The resource type of the key vault. - /// The tags that will be assigned to the key vault. - /// - public Vault(string location, VaultProperties properties, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) - : base(location, id, name, type, tags) + /// Fully qualified identifier of the key vault + /// resource. + /// Name of the key vault resource. + /// Resource type of the key vault resource. + /// Azure location of the key vault + /// resource. + /// Tags assigned to the key vault resource. + public Vault(VaultProperties properties, string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; Properties = properties; CustomInit(); } @@ -54,6 +58,36 @@ public Vault() /// partial void CustomInit(); + /// + /// Gets fully qualified identifier of the key vault resource. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets name of the key vault resource. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type of the key vault resource. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets azure location of the key vault resource. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets tags assigned to the key vault resource. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + /// /// Gets or sets properties of the vault /// @@ -66,9 +100,8 @@ public Vault() /// /// Thrown if validation fails /// - public override void Validate() + public virtual void Validate() { - base.Validate(); if (Properties == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultPatchProperties.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultPatchProperties.cs index 2787a64a38e43..bc32040e4a725 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultPatchProperties.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultPatchProperties.cs @@ -48,8 +48,9 @@ public VaultPatchProperties() /// whether Azure Resource Manager is permitted to retrieve secrets /// from the key vault. /// Property to specify whether the - /// 'soft delete' functionality is enabled for this key vault. It does - /// not accept false value. + /// 'soft delete' functionality is enabled for this key vault. If + /// omitted, assume true as default value. Once set to true, cannot be + /// reverted to false. /// The vault's create mode to indicate /// whether the vault need to be recovered or not. Possible values /// include: 'recover', 'default' @@ -127,8 +128,9 @@ public VaultPatchProperties() /// /// Gets or sets property to specify whether the 'soft delete' - /// functionality is enabled for this key vault. It does not accept - /// false value. + /// functionality is enabled for this key vault. If omitted, assume + /// true as default value. Once set to true, cannot be reverted to + /// false. /// [JsonProperty(PropertyName = "enableSoftDelete")] public bool? EnableSoftDelete { get; set; } diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultProperties.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultProperties.cs index 8eb8fea06f070..f1f4ab3b4d8af 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultProperties.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultProperties.cs @@ -54,8 +54,9 @@ public VaultProperties() /// whether Azure Resource Manager is permitted to retrieve secrets /// from the key vault. /// Property to specify whether the - /// 'soft delete' functionality is enabled for this key vault. It does - /// not accept false value. + /// 'soft delete' functionality is enabled for this key vault. If + /// omitted, assume true as default value. Once set to true, cannot be + /// reverted to false. /// The vault's create mode to indicate /// whether the vault need to be recovered or not. Possible values /// include: 'recover', 'default' @@ -66,9 +67,11 @@ public VaultProperties() /// irrecoverable deletion. The setting is effective only if soft /// delete is also enabled. Enabling this functionality is irreversible /// - that is, the property does not accept false as its value. - /// A collection of rules governing the - /// accessibility of the vault from specific network locations. - public VaultProperties(System.Guid tenantId, Sku sku, IList accessPolicies = default(IList), string vaultUri = default(string), bool? enabledForDeployment = default(bool?), bool? enabledForDiskEncryption = default(bool?), bool? enabledForTemplateDeployment = default(bool?), bool? enableSoftDelete = default(bool?), CreateMode? createMode = default(CreateMode?), bool? enablePurgeProtection = default(bool?), NetworkRuleSet networkAcls = default(NetworkRuleSet)) + /// Rules governing the accessibility of the + /// key vault from specific network locations. + /// List of private endpoint + /// connections associated with the key vault. + public VaultProperties(System.Guid tenantId, Sku sku, IList accessPolicies = default(IList), string vaultUri = default(string), bool? enabledForDeployment = default(bool?), bool? enabledForDiskEncryption = default(bool?), bool? enabledForTemplateDeployment = default(bool?), bool? enableSoftDelete = default(bool?), CreateMode? createMode = default(CreateMode?), bool? enablePurgeProtection = default(bool?), NetworkRuleSet networkAcls = default(NetworkRuleSet), IList privateEndpointConnections = default(IList)) { TenantId = tenantId; Sku = sku; @@ -81,6 +84,7 @@ public VaultProperties() CreateMode = createMode; EnablePurgeProtection = enablePurgeProtection; NetworkAcls = networkAcls; + PrivateEndpointConnections = privateEndpointConnections; CustomInit(); } @@ -143,8 +147,9 @@ public VaultProperties() /// /// Gets or sets property to specify whether the 'soft delete' - /// functionality is enabled for this key vault. It does not accept - /// false value. + /// functionality is enabled for this key vault. If omitted, assume + /// true as default value. Once set to true, cannot be reverted to + /// false. /// [JsonProperty(PropertyName = "enableSoftDelete")] public bool? EnableSoftDelete { get; set; } @@ -170,12 +175,19 @@ public VaultProperties() public bool? EnablePurgeProtection { get; set; } /// - /// Gets or sets a collection of rules governing the accessibility of - /// the vault from specific network locations. + /// Gets or sets rules governing the accessibility of the key vault + /// from specific network locations. /// [JsonProperty(PropertyName = "networkAcls")] public NetworkRuleSet NetworkAcls { get; set; } + /// + /// Gets list of private endpoint connections associated with the key + /// vault. + /// + [JsonProperty(PropertyName = "privateEndpointConnections")] + public IList PrivateEndpointConnections { get; private set; } + /// /// Validate the object. /// diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperations.cs new file mode 100644 index 0000000000000..e064090a5b662 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperations.cs @@ -0,0 +1,759 @@ +// +// 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.KeyVault +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateEndpointConnectionsOperations operations. + /// + internal partial class PrivateEndpointConnectionsOperations : IServiceOperations, IPrivateEndpointConnectionsOperations + { + /// + /// Initializes a new instance of the PrivateEndpointConnectionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the KeyVaultManagementClient + /// + public KeyVaultManagementClient Client { get; private set; } + + /// + /// Gets the specified private endpoint connection associated with the key + /// vault. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// Name of the private endpoint connection associated with the key 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> GetWithHttpMessagesAsync(string resourceGroupName, string vaultName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vaultName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); + } + if (vaultName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(vaultName, "^[a-zA-Z0-9-]{3,24}$")) + { + throw new ValidationException(ValidationRules.Pattern, "vaultName", "^[a-zA-Z0-9-]{3,24}$"); + } + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.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("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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 (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.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 (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.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 = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.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 = 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); + } + return _result; + } + + /// + /// Updates the specified private endpoint connection associated with the key + /// vault. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// Name of the private endpoint connection associated with the key vault. + /// + /// + /// The intended state of private endpoint connection. + /// + /// + /// 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> PutWithHttpMessagesAsync(string resourceGroupName, string vaultName, string privateEndpointConnectionName, PrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vaultName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); + } + if (vaultName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(vaultName, "^[a-zA-Z0-9-]{3,24}$")) + { + throw new ValidationException(ValidationRules.Pattern, "vaultName", "^[a-zA-Z0-9-]{3,24}$"); + } + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "properties"); + } + // 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("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("properties", properties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Put", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.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; + if(properties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(properties, 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) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.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 = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.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 = 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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the specified private endpoint connection associated with the key + /// vault. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// Name of the private endpoint connection associated with the key vault. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string vaultName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, vaultName, privateEndpointConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the specified private endpoint connection associated with the key + /// vault. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// Name of the private endpoint connection associated with the key 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> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vaultName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vaultName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); + } + if (vaultName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(vaultName, "^[a-zA-Z0-9-]{3,24}$")) + { + throw new ValidationException(ValidationRules.Pattern, "vaultName", "^[a-zA-Z0-9-]{3,24}$"); + } + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.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("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.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 (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.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 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.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 = 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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs new file mode 100644 index 0000000000000..1ecff7b253b58 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs @@ -0,0 +1,223 @@ +// +// 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.KeyVault +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PrivateEndpointConnectionsOperations. + /// + public static partial class PrivateEndpointConnectionsOperationsExtensions + { + /// + /// Gets the specified private endpoint connection associated with the key + /// vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// Name of the private endpoint connection associated with the key vault. + /// + public static PrivateEndpointConnection Get(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string vaultName, string privateEndpointConnectionName) + { + return operations.GetAsync(resourceGroupName, vaultName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Gets the specified private endpoint connection associated with the key + /// vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// Name of the private endpoint connection associated with the key vault. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string vaultName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vaultName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the specified private endpoint connection associated with the key + /// vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// Name of the private endpoint connection associated with the key vault. + /// + /// + /// The intended state of private endpoint connection. + /// + public static PrivateEndpointConnection Put(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string vaultName, string privateEndpointConnectionName, PrivateEndpointConnection properties) + { + return operations.PutAsync(resourceGroupName, vaultName, privateEndpointConnectionName, properties).GetAwaiter().GetResult(); + } + + /// + /// Updates the specified private endpoint connection associated with the key + /// vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// Name of the private endpoint connection associated with the key vault. + /// + /// + /// The intended state of private endpoint connection. + /// + /// + /// The cancellation token. + /// + public static async Task PutAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string vaultName, string privateEndpointConnectionName, PrivateEndpointConnection properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PutWithHttpMessagesAsync(resourceGroupName, vaultName, privateEndpointConnectionName, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the specified private endpoint connection associated with the key + /// vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// Name of the private endpoint connection associated with the key vault. + /// + public static PrivateEndpointConnection Delete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string vaultName, string privateEndpointConnectionName) + { + return operations.DeleteAsync(resourceGroupName, vaultName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified private endpoint connection associated with the key + /// vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// Name of the private endpoint connection associated with the key vault. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string vaultName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, vaultName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the specified private endpoint connection associated with the key + /// vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// Name of the private endpoint connection associated with the key vault. + /// + public static PrivateEndpointConnection BeginDelete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string vaultName, string privateEndpointConnectionName) + { + return operations.BeginDeleteAsync(resourceGroupName, vaultName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified private endpoint connection associated with the key + /// vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// Name of the private endpoint connection associated with the key vault. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string vaultName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, vaultName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateLinkResourcesOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateLinkResourcesOperations.cs new file mode 100644 index 0000000000000..b1bde0a13752d --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateLinkResourcesOperations.cs @@ -0,0 +1,257 @@ +// +// 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.KeyVault +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateLinkResourcesOperations operations. + /// + internal partial class PrivateLinkResourcesOperations : IServiceOperations, IPrivateLinkResourcesOperations + { + /// + /// Initializes a new instance of the PrivateLinkResourcesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateLinkResourcesOperations(KeyVaultManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the KeyVaultManagementClient + /// + public KeyVaultManagementClient Client { get; private set; } + + /// + /// Gets the private link resources supported for the key vault. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key 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> ListByVaultWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vaultName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); + } + if (vaultName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(vaultName, "^[a-zA-Z0-9-]{3,24}$")) + { + throw new ValidationException(ValidationRules.Pattern, "vaultName", "^[a-zA-Z0-9-]{3,24}$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.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("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByVault", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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 (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.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 (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.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 = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.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 = 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); + } + return _result; + } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateLinkResourcesOperationsExtensions.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateLinkResourcesOperationsExtensions.cs new file mode 100644 index 0000000000000..593cf3fc800f7 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateLinkResourcesOperationsExtensions.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.KeyVault +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PrivateLinkResourcesOperations. + /// + public static partial class PrivateLinkResourcesOperationsExtensions + { + /// + /// Gets the private link resources supported for the key vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + public static PrivateLinkResourceListResult ListByVault(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string vaultName) + { + return operations.ListByVaultAsync(resourceGroupName, vaultName).GetAwaiter().GetResult(); + } + + /// + /// Gets the private link resources supported for the key vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// The cancellation token. + /// + public static async Task ListByVaultAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByVaultWithHttpMessagesAsync(resourceGroupName, vaultName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SdkInfo_KeyVaultManagementClient.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SdkInfo_KeyVaultManagementClient.cs index c3901fe8b6731..d0b8529435162 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SdkInfo_KeyVaultManagementClient.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SdkInfo_KeyVaultManagementClient.cs @@ -19,9 +19,11 @@ public static IEnumerable> ApiInfo_KeyVaultManagem { return new Tuple[] { - new Tuple("KeyVault", "Operations", "2018-02-14"), - new Tuple("KeyVault", "Vaults", "2018-02-14"), - new Tuple("KeyVaultManagementClient", "Vaults", "2018-02-14"), + new Tuple("KeyVault", "Operations", "2019-09-01"), + new Tuple("KeyVault", "PrivateEndpointConnections", "2019-09-01"), + new Tuple("KeyVault", "PrivateLinkResources", "2019-09-01"), + new Tuple("KeyVault", "Vaults", "2019-09-01"), + new Tuple("KeyVaultManagementClient", "Vaults", "2019-09-01"), }.AsEnumerable(); } }