From e3a100fd4744b980247e92de45da68c12e322a69 Mon Sep 17 00:00:00 2001 From: Jingshu Pan Date: Tue, 23 Mar 2021 10:36:46 +0800 Subject: [PATCH 1/3] [DataFactory]Added PrivateEndpointConnections apis to DataFactory --- .../datafactory_resource-manager.txt | 4 +- .../src/CHANGELOG.md | 2 + .../Generated/DataFactoryManagementClient.cs | 18 + .../Generated/IDataFactoryManagementClient.cs | 15 + .../IPrivateEndPointConnectionsOperations.cs | 74 ++ .../IPrivateEndpointConnectionOperations.cs | 120 +++ .../IPrivateLinkResourcesOperations.cs | 52 ++ .../src/Generated/Models/ArmIdWrapper.cs | 49 ++ .../PrivateEndpointConnectionResource.cs | 58 ++ .../PrivateLinkConnectionApprovalRequest.cs | 51 ++ ...teLinkConnectionApprovalRequestResource.cs | 58 ++ .../Models/PrivateLinkConnectionState.cs | 69 ++ .../Generated/Models/PrivateLinkResource.cs | 56 ++ .../Models/PrivateLinkResourceProperties.cs | 73 ++ .../Models/PrivateLinkResourcesWrapper.cs | 67 ++ .../Models/RemotePrivateEndpointConnection.cs | 67 ++ .../PrivateEndPointConnectionsOperations.cs | 453 ++++++++++ ...EndPointConnectionsOperationsExtensions.cs | 99 +++ .../PrivateEndpointConnectionOperations.cs | 779 ++++++++++++++++++ ...eEndpointConnectionOperationsExtensions.cs | 184 +++++ .../PrivateLinkResourcesOperations.cs | 280 +++++++ ...rivateLinkResourcesOperationsExtensions.cs | 65 ++ ...rosoft.Azure.Management.DataFactory.csproj | 2 + ...vateEndPointConnections_ListByFactory.json | 39 + .../PrivateEndpointConnection_Create.json | 40 + .../PrivateEndpointConnection_Delete.json | 13 + .../PrivateEndpointConnection_Get.json | 31 + .../TestData/PrivateLinkResources_Get.json | 31 + .../tests/UnitTests/ExamplesUnitTest.cs | 63 +- 29 files changed, 2908 insertions(+), 4 deletions(-) create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IPrivateEndPointConnectionsOperations.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IPrivateEndpointConnectionOperations.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IPrivateLinkResourcesOperations.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ArmIdWrapper.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateEndpointConnectionResource.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkConnectionApprovalRequest.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkConnectionApprovalRequestResource.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkConnectionState.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkResource.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkResourceProperties.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkResourcesWrapper.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/RemotePrivateEndpointConnection.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateEndPointConnectionsOperations.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateEndPointConnectionsOperationsExtensions.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateEndpointConnectionOperations.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateEndpointConnectionOperationsExtensions.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateLinkResourcesOperations.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateLinkResourcesOperationsExtensions.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndPointConnections_ListByFactory.json create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndpointConnection_Create.json create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndpointConnection_Delete.json create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndpointConnection_Get.json create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateLinkResources_Get.json diff --git a/eng/mgmt/mgmtmetadata/datafactory_resource-manager.txt b/eng/mgmt/mgmtmetadata/datafactory_resource-manager.txt index 28abd47c1c2e..69a8f9d6e120 100644 --- a/eng/mgmt/mgmtmetadata/datafactory_resource-manager.txt +++ b/eng/mgmt/mgmtmetadata/datafactory_resource-manager.txt @@ -4,11 +4,11 @@ Commencing code generation Generating CSharp code Executing AutoRest command cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/datafactory/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --tag=package-2018-06 --csharp-sdks-folder=D:\Projects\azure-sdk-for-net\sdk -2021-03-12 02:44:58 UTC +2021-03-23 01:56:11 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: 21c970568229eb388d0fce7097e889411ee0a85f +Commit: f954470d4e330fb6fa042149d09f554c966c984d AutoRest information Requested version: v2 Bootstrapper version: autorest@2.0.4413 diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/CHANGELOG.md b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/CHANGELOG.md index adb179dd62a7..18bbc9ea65e5 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/CHANGELOG.md +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/CHANGELOG.md @@ -8,6 +8,8 @@ - Added AAD auth to CosmosDb LinkedService - Added authHeaders to HTTP/REST/OData LinkedService - Added MultiFactor auth to SFTP LinkedService +- Added UAMI to Identity +- Added privateEndpointConnection apis to DataFactory ## Version 4.15.0 ### Feature Additions diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/DataFactoryManagementClient.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/DataFactoryManagementClient.cs index 46f1baaa95ab..e43dae9a6908 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/DataFactoryManagementClient.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/DataFactoryManagementClient.cs @@ -160,6 +160,21 @@ public partial class DataFactoryManagementClient : ServiceClient public virtual IManagedPrivateEndpointsOperations ManagedPrivateEndpoints { get; private set; } + /// + /// Gets the IPrivateEndPointConnectionsOperations. + /// + public virtual IPrivateEndPointConnectionsOperations PrivateEndPointConnections { get; private set; } + + /// + /// Gets the IPrivateEndpointConnectionOperations. + /// + public virtual IPrivateEndpointConnectionOperations PrivateEndpointConnection { get; private set; } + + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } + /// /// Initializes a new instance of the DataFactoryManagementClient class. /// @@ -418,6 +433,9 @@ private void Initialize() DataFlowDebugSession = new DataFlowDebugSessionOperations(this); ManagedVirtualNetworks = new ManagedVirtualNetworksOperations(this); ManagedPrivateEndpoints = new ManagedPrivateEndpointsOperations(this); + PrivateEndPointConnections = new PrivateEndPointConnectionsOperations(this); + PrivateEndpointConnection = new PrivateEndpointConnectionOperations(this); + PrivateLinkResources = new PrivateLinkResourcesOperations(this); BaseUri = new System.Uri("https://management.azure.com"); ApiVersion = "2018-06-01"; AcceptLanguage = "en-US"; diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IDataFactoryManagementClient.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IDataFactoryManagementClient.cs index 67c86fd83972..70522539d77c 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IDataFactoryManagementClient.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IDataFactoryManagementClient.cs @@ -155,5 +155,20 @@ public partial interface IDataFactoryManagementClient : System.IDisposable /// IManagedPrivateEndpointsOperations ManagedPrivateEndpoints { get; } + /// + /// Gets the IPrivateEndPointConnectionsOperations. + /// + IPrivateEndPointConnectionsOperations PrivateEndPointConnections { get; } + + /// + /// Gets the IPrivateEndpointConnectionOperations. + /// + IPrivateEndpointConnectionOperations PrivateEndpointConnection { get; } + + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + IPrivateLinkResourcesOperations PrivateLinkResources { get; } + } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IPrivateEndPointConnectionsOperations.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IPrivateEndPointConnectionsOperations.cs new file mode 100644 index 000000000000..519ea4335b9c --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IPrivateEndPointConnectionsOperations.cs @@ -0,0 +1,74 @@ +// +// 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.DataFactory +{ + 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 + { + /// + /// Lists Private endpoint connections + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// 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>> ListByFactoryWithHttpMessagesAsync(string resourceGroupName, string factoryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists Private endpoint connections + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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>> ListByFactoryNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IPrivateEndpointConnectionOperations.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IPrivateEndpointConnectionOperations.cs new file mode 100644 index 000000000000..7d86311a78b8 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IPrivateEndpointConnectionOperations.cs @@ -0,0 +1,120 @@ +// +// 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.DataFactory +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateEndpointConnectionOperations operations. + /// + public partial interface IPrivateEndpointConnectionOperations + { + /// + /// Approves or rejects a private endpoint connection + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The private endpoint connection name. + /// + /// + /// + /// + /// ETag of the private endpoint connection entity. Should only be + /// specified for update, for which it should match existing entity or + /// can be * for unconditional update. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string factoryName, string privateEndpointConnectionName, PrivateLinkConnectionApprovalRequestResource privateEndpointWrapper, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a private endpoint connection + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The private endpoint connection name. + /// + /// + /// ETag of the private endpoint connection entity. Should only be + /// specified for get. If the ETag matches the existing entity tag, or + /// if * was provided, then no content will be returned. + /// + /// + /// 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 factoryName, string privateEndpointConnectionName, string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a private endpoint connection + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The private endpoint connection name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string factoryName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IPrivateLinkResourcesOperations.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/IPrivateLinkResourcesOperations.cs new file mode 100644 index 000000000000..c9b2ee046d21 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/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.DataFactory +{ + 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 + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// 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 factoryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ArmIdWrapper.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ArmIdWrapper.cs new file mode 100644 index 000000000000..39ee4e8ed8ed --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ArmIdWrapper.cs @@ -0,0 +1,49 @@ +// +// 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.DataFactory.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A wrapper for an ARM resource id + /// + public partial class ArmIdWrapper + { + /// + /// Initializes a new instance of the ArmIdWrapper class. + /// + public ArmIdWrapper() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ArmIdWrapper class. + /// + public ArmIdWrapper(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateEndpointConnectionResource.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateEndpointConnectionResource.cs new file mode 100644 index 000000000000..b458b38f22c6 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateEndpointConnectionResource.cs @@ -0,0 +1,58 @@ +// +// 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.DataFactory.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Private Endpoint Connection ARM resource. + /// + public partial class PrivateEndpointConnectionResource : SubResource + { + /// + /// Initializes a new instance of the PrivateEndpointConnectionResource + /// class. + /// + public PrivateEndpointConnectionResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpointConnectionResource + /// class. + /// + /// The resource identifier. + /// The resource name. + /// The resource type. + /// Etag identifies change in the resource. + /// Core resource properties + public PrivateEndpointConnectionResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), RemotePrivateEndpointConnection properties = default(RemotePrivateEndpointConnection)) + : base(id, name, type, etag) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets core resource properties + /// + [JsonProperty(PropertyName = "properties")] + public RemotePrivateEndpointConnection Properties { get; set; } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkConnectionApprovalRequest.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkConnectionApprovalRequest.cs new file mode 100644 index 000000000000..8738edfa640e --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkConnectionApprovalRequest.cs @@ -0,0 +1,51 @@ +// +// 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.DataFactory.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A request to approve or reject a private endpoint connection + /// + public partial class PrivateLinkConnectionApprovalRequest + { + /// + /// Initializes a new instance of the + /// PrivateLinkConnectionApprovalRequest class. + /// + public PrivateLinkConnectionApprovalRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PrivateLinkConnectionApprovalRequest class. + /// + public PrivateLinkConnectionApprovalRequest(PrivateLinkConnectionState privateLinkServiceConnectionState = default(PrivateLinkConnectionState)) + { + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "privateLinkServiceConnectionState")] + public PrivateLinkConnectionState PrivateLinkServiceConnectionState { get; set; } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkConnectionApprovalRequestResource.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkConnectionApprovalRequestResource.cs new file mode 100644 index 000000000000..4104026c9a5d --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkConnectionApprovalRequestResource.cs @@ -0,0 +1,58 @@ +// +// 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.DataFactory.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Private Endpoint Connection Approval ARM resource. + /// + public partial class PrivateLinkConnectionApprovalRequestResource : SubResource + { + /// + /// Initializes a new instance of the + /// PrivateLinkConnectionApprovalRequestResource class. + /// + public PrivateLinkConnectionApprovalRequestResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PrivateLinkConnectionApprovalRequestResource class. + /// + /// The resource identifier. + /// The resource name. + /// The resource type. + /// Etag identifies change in the resource. + /// Core resource properties + public PrivateLinkConnectionApprovalRequestResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), PrivateLinkConnectionApprovalRequest properties = default(PrivateLinkConnectionApprovalRequest)) + : base(id, name, type, etag) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets core resource properties + /// + [JsonProperty(PropertyName = "properties")] + public PrivateLinkConnectionApprovalRequest Properties { get; set; } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkConnectionState.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkConnectionState.cs new file mode 100644 index 000000000000..9a7185886b87 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkConnectionState.cs @@ -0,0 +1,69 @@ +// +// 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.DataFactory.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The state of a private link connection + /// + public partial class PrivateLinkConnectionState + { + /// + /// Initializes a new instance of the PrivateLinkConnectionState class. + /// + public PrivateLinkConnectionState() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkConnectionState class. + /// + /// Status of a private link connection + /// Description of a private link + /// connection + /// ActionsRequired for a private link + /// connection + public PrivateLinkConnectionState(string status = default(string), string description = default(string), string actionsRequired = default(string)) + { + Status = status; + Description = description; + ActionsRequired = actionsRequired; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets status of a private link connection + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets description of a private link connection + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets actionsRequired for a private link connection + /// + [JsonProperty(PropertyName = "actionsRequired")] + public string ActionsRequired { get; set; } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkResource.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkResource.cs new file mode 100644 index 000000000000..2436c1b94a89 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkResource.cs @@ -0,0 +1,56 @@ +// +// 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.DataFactory.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A private link resource + /// + public partial class PrivateLinkResource : SubResource + { + /// + /// Initializes a new instance of the PrivateLinkResource class. + /// + public PrivateLinkResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResource class. + /// + /// The resource identifier. + /// The resource name. + /// The resource type. + /// Etag identifies change in the resource. + /// Core resource properties + public PrivateLinkResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), PrivateLinkResourceProperties properties = default(PrivateLinkResourceProperties)) + : base(id, name, type, etag) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets core resource properties + /// + [JsonProperty(PropertyName = "properties")] + public PrivateLinkResourceProperties Properties { get; set; } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkResourceProperties.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkResourceProperties.cs new file mode 100644 index 000000000000..84022fc71962 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkResourceProperties.cs @@ -0,0 +1,73 @@ +// +// 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.DataFactory.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of a private link resource + /// + public partial class PrivateLinkResourceProperties + { + /// + /// Initializes a new instance of the PrivateLinkResourceProperties + /// class. + /// + public PrivateLinkResourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResourceProperties + /// class. + /// + /// GroupId of a private link resource + /// RequiredMembers of a private link + /// resource + /// RequiredZoneNames of a private link + /// resource + public PrivateLinkResourceProperties(string groupId = default(string), IList requiredMembers = default(IList), IList requiredZoneNames = default(IList)) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets groupId of a private link resource + /// + [JsonProperty(PropertyName = "groupId")] + public string GroupId { get; private set; } + + /// + /// Gets requiredMembers of a private link resource + /// + [JsonProperty(PropertyName = "requiredMembers")] + public IList RequiredMembers { get; private set; } + + /// + /// Gets requiredZoneNames of a private link resource + /// + [JsonProperty(PropertyName = "requiredZoneNames")] + public IList RequiredZoneNames { get; private set; } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkResourcesWrapper.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkResourcesWrapper.cs new file mode 100644 index 000000000000..1890108dffe1 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PrivateLinkResourcesWrapper.cs @@ -0,0 +1,67 @@ +// +// 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.DataFactory.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Wrapper for a collection of private link resources + /// + public partial class PrivateLinkResourcesWrapper + { + /// + /// Initializes a new instance of the PrivateLinkResourcesWrapper + /// class. + /// + public PrivateLinkResourcesWrapper() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResourcesWrapper + /// class. + /// + public PrivateLinkResourcesWrapper(IList value) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/RemotePrivateEndpointConnection.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/RemotePrivateEndpointConnection.cs new file mode 100644 index 000000000000..f9fbda79b735 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/RemotePrivateEndpointConnection.cs @@ -0,0 +1,67 @@ +// +// 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.DataFactory.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A remote private endpoint connection + /// + public partial class RemotePrivateEndpointConnection + { + /// + /// Initializes a new instance of the RemotePrivateEndpointConnection + /// class. + /// + public RemotePrivateEndpointConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RemotePrivateEndpointConnection + /// class. + /// + /// PrivateEndpoint of a remote private + /// endpoint connection + public RemotePrivateEndpointConnection(string provisioningState = default(string), ArmIdWrapper privateEndpoint = default(ArmIdWrapper), PrivateLinkConnectionState privateLinkServiceConnectionState = default(PrivateLinkConnectionState)) + { + ProvisioningState = provisioningState; + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets privateEndpoint of a remote private endpoint + /// connection + /// + [JsonProperty(PropertyName = "privateEndpoint")] + public ArmIdWrapper PrivateEndpoint { get; set; } + + /// + /// + [JsonProperty(PropertyName = "privateLinkServiceConnectionState")] + public PrivateLinkConnectionState PrivateLinkServiceConnectionState { get; set; } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateEndPointConnectionsOperations.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateEndPointConnectionsOperations.cs new file mode 100644 index 000000000000..ffedd38c80e4 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateEndPointConnectionsOperations.cs @@ -0,0 +1,453 @@ +// +// 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.DataFactory +{ + 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(DataFactoryManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataFactoryManagementClient + /// + public DataFactoryManagementClient Client { get; private set; } + + /// + /// Lists Private endpoint connections + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// 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>> ListByFactoryWithHttpMessagesAsync(string resourceGroupName, string factoryName, 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 (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (factoryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "factoryName"); + } + if (factoryName != null) + { + if (factoryName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "factoryName", 63); + } + if (factoryName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "factoryName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(factoryName, "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$")) + { + throw new ValidationException(ValidationRules.Pattern, "factoryName", "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$"); + } + } + 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("factoryName", factoryName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByFactory", 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.DataFactory/factories/{factoryName}/privateEndPointConnections").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{factoryName}", System.Uri.EscapeDataString(factoryName)); + 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; + } + + /// + /// Lists Private endpoint connections + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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>> ListByFactoryNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByFactoryNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + 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/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateEndPointConnectionsOperationsExtensions.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateEndPointConnectionsOperationsExtensions.cs new file mode 100644 index 000000000000..52b4908a1e3f --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateEndPointConnectionsOperationsExtensions.cs @@ -0,0 +1,99 @@ +// +// 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.DataFactory +{ + 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 + { + /// + /// Lists Private endpoint connections + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + public static IPage ListByFactory(this IPrivateEndPointConnectionsOperations operations, string resourceGroupName, string factoryName) + { + return operations.ListByFactoryAsync(resourceGroupName, factoryName).GetAwaiter().GetResult(); + } + + /// + /// Lists Private endpoint connections + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByFactoryAsync(this IPrivateEndPointConnectionsOperations operations, string resourceGroupName, string factoryName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByFactoryWithHttpMessagesAsync(resourceGroupName, factoryName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists Private endpoint connections + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByFactoryNext(this IPrivateEndPointConnectionsOperations operations, string nextPageLink) + { + return operations.ListByFactoryNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists Private endpoint connections + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByFactoryNextAsync(this IPrivateEndPointConnectionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByFactoryNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateEndpointConnectionOperations.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateEndpointConnectionOperations.cs new file mode 100644 index 000000000000..09a4dc3b84d1 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateEndpointConnectionOperations.cs @@ -0,0 +1,779 @@ +// +// 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.DataFactory +{ + 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; + + /// + /// PrivateEndpointConnectionOperations operations. + /// + internal partial class PrivateEndpointConnectionOperations : IServiceOperations, IPrivateEndpointConnectionOperations + { + /// + /// Initializes a new instance of the PrivateEndpointConnectionOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateEndpointConnectionOperations(DataFactoryManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataFactoryManagementClient + /// + public DataFactoryManagementClient Client { get; private set; } + + /// + /// Approves or rejects a private endpoint connection + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The private endpoint connection name. + /// + /// + /// + /// + /// ETag of the private endpoint connection entity. Should only be specified + /// for update, for which it should match existing entity or can be * for + /// unconditional update. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string factoryName, string privateEndpointConnectionName, PrivateLinkConnectionApprovalRequestResource privateEndpointWrapper, string ifMatch = default(string), 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 (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (factoryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "factoryName"); + } + if (factoryName != null) + { + if (factoryName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "factoryName", 63); + } + if (factoryName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "factoryName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(factoryName, "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$")) + { + throw new ValidationException(ValidationRules.Pattern, "factoryName", "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$"); + } + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (privateEndpointWrapper == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointWrapper"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("factoryName", factoryName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("privateEndpointWrapper", privateEndpointWrapper); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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.DataFactory/factories/{factoryName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{factoryName}", System.Uri.EscapeDataString(factoryName)); + _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 (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + 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(privateEndpointWrapper != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(privateEndpointWrapper, 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a private endpoint connection + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The private endpoint connection name. + /// + /// + /// ETag of the private endpoint connection entity. Should only be specified + /// for get. If the ETag matches the existing entity tag, or if * was provided, + /// then no content will be returned. + /// + /// + /// 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 factoryName, string privateEndpointConnectionName, string ifNoneMatch = default(string), 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 (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (factoryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "factoryName"); + } + if (factoryName != null) + { + if (factoryName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "factoryName", 63); + } + if (factoryName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "factoryName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(factoryName, "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$")) + { + throw new ValidationException(ValidationRules.Pattern, "factoryName", "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$"); + } + } + 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("factoryName", factoryName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("ifNoneMatch", ifNoneMatch); + 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.DataFactory/factories/{factoryName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{factoryName}", System.Uri.EscapeDataString(factoryName)); + _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 (ifNoneMatch != null) + { + if (_httpRequest.Headers.Contains("If-None-Match")) + { + _httpRequest.Headers.Remove("If-None-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-None-Match", ifNoneMatch); + } + 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; + } + + /// + /// Deletes a private endpoint connection + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The private endpoint connection name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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 DeleteWithHttpMessagesAsync(string resourceGroupName, string factoryName, 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 (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (factoryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "factoryName"); + } + if (factoryName != null) + { + if (factoryName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "factoryName", 63); + } + if (factoryName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "factoryName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(factoryName, "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$")) + { + throw new ValidationException(ValidationRules.Pattern, "factoryName", "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$"); + } + } + 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("factoryName", factoryName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", 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.DataFactory/factories/{factoryName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{factoryName}", System.Uri.EscapeDataString(factoryName)); + _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 != 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateEndpointConnectionOperationsExtensions.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateEndpointConnectionOperationsExtensions.cs new file mode 100644 index 000000000000..e1afbd95ccf2 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateEndpointConnectionOperationsExtensions.cs @@ -0,0 +1,184 @@ +// +// 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.DataFactory +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PrivateEndpointConnectionOperations. + /// + public static partial class PrivateEndpointConnectionOperationsExtensions + { + /// + /// Approves or rejects a private endpoint connection + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The private endpoint connection name. + /// + /// + /// + /// + /// ETag of the private endpoint connection entity. Should only be specified + /// for update, for which it should match existing entity or can be * for + /// unconditional update. + /// + public static PrivateEndpointConnectionResource CreateOrUpdate(this IPrivateEndpointConnectionOperations operations, string resourceGroupName, string factoryName, string privateEndpointConnectionName, PrivateLinkConnectionApprovalRequestResource privateEndpointWrapper, string ifMatch = default(string)) + { + return operations.CreateOrUpdateAsync(resourceGroupName, factoryName, privateEndpointConnectionName, privateEndpointWrapper, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Approves or rejects a private endpoint connection + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The private endpoint connection name. + /// + /// + /// + /// + /// ETag of the private endpoint connection entity. Should only be specified + /// for update, for which it should match existing entity or can be * for + /// unconditional update. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IPrivateEndpointConnectionOperations operations, string resourceGroupName, string factoryName, string privateEndpointConnectionName, PrivateLinkConnectionApprovalRequestResource privateEndpointWrapper, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, factoryName, privateEndpointConnectionName, privateEndpointWrapper, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a private endpoint connection + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The private endpoint connection name. + /// + /// + /// ETag of the private endpoint connection entity. Should only be specified + /// for get. If the ETag matches the existing entity tag, or if * was provided, + /// then no content will be returned. + /// + public static PrivateEndpointConnectionResource Get(this IPrivateEndpointConnectionOperations operations, string resourceGroupName, string factoryName, string privateEndpointConnectionName, string ifNoneMatch = default(string)) + { + return operations.GetAsync(resourceGroupName, factoryName, privateEndpointConnectionName, ifNoneMatch).GetAwaiter().GetResult(); + } + + /// + /// Gets a private endpoint connection + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The private endpoint connection name. + /// + /// + /// ETag of the private endpoint connection entity. Should only be specified + /// for get. If the ETag matches the existing entity tag, or if * was provided, + /// then no content will be returned. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPrivateEndpointConnectionOperations operations, string resourceGroupName, string factoryName, string privateEndpointConnectionName, string ifNoneMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, factoryName, privateEndpointConnectionName, ifNoneMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a private endpoint connection + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The private endpoint connection name. + /// + public static void Delete(this IPrivateEndpointConnectionOperations operations, string resourceGroupName, string factoryName, string privateEndpointConnectionName) + { + operations.DeleteAsync(resourceGroupName, factoryName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a private endpoint connection + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The private endpoint connection name. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IPrivateEndpointConnectionOperations operations, string resourceGroupName, string factoryName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, factoryName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateLinkResourcesOperations.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateLinkResourcesOperations.cs new file mode 100644 index 000000000000..9f60f8af0d7a --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateLinkResourcesOperations.cs @@ -0,0 +1,280 @@ +// +// 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.DataFactory +{ + 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(DataFactoryManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataFactoryManagementClient + /// + public DataFactoryManagementClient Client { get; private set; } + + /// + /// Gets the private link resources + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// 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 factoryName, 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 (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (factoryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "factoryName"); + } + if (factoryName != null) + { + if (factoryName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "factoryName", 63); + } + if (factoryName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "factoryName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(factoryName, "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$")) + { + throw new ValidationException(ValidationRules.Pattern, "factoryName", "^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$"); + } + } + 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("factoryName", factoryName); + 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.DataFactory/factories/{factoryName}/privateLinkResources").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{factoryName}", System.Uri.EscapeDataString(factoryName)); + 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/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateLinkResourcesOperationsExtensions.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/PrivateLinkResourcesOperationsExtensions.cs new file mode 100644 index 000000000000..b2d2795876e3 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/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.DataFactory +{ + 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 + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + public static PrivateLinkResourcesWrapper Get(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string factoryName) + { + return operations.GetAsync(resourceGroupName, factoryName).GetAwaiter().GetResult(); + } + + /// + /// Gets the private link resources + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// The factory name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string factoryName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, factoryName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Microsoft.Azure.Management.DataFactory.csproj b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Microsoft.Azure.Management.DataFactory.csproj index c2accd484a0c..83ad9fb362b9 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Microsoft.Azure.Management.DataFactory.csproj +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Microsoft.Azure.Management.DataFactory.csproj @@ -16,6 +16,8 @@ - Added AAD auth to CosmosDb LinkedService - Added authHeaders to HTTP/REST/OData LinkedService - Added MultiFactor auth to SFTP LinkedService +- Added UAMI to Identity +- Added privateEndpointConnection apis to DataFactory ]]> diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndPointConnections_ListByFactory.json b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndPointConnections_ListByFactory.json new file mode 100644 index 000000000000..e7d8a151708d --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndPointConnections_ListByFactory.json @@ -0,0 +1,39 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-1234-12345678abc", + "resourceGroupName": "exampleResourceGroup", + "factoryName": "exampleFactoryName", + "api-version": "2018-06-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Sat, 16 Jun 2018 00:37:41 GMT", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-subscription-reads": "14908", + "x-ms-request-id": "9e6639e9-bece-4c0c-85de-4cadc30a73a6", + "x-ms-correlation-request-id": "9e6639e9-bece-4c0c-85de-4cadc30a73a6" + }, + "body": { + "value": [ + { + "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName/privateEndpoints/myPrivateEndpoint", + "name": "factories", + "type": "Microsoft.DataFactory/factories/privateEndpointConnections", + "properties": { + "provisioningState": "Succeeded", + "privateEndpoint": { + "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName/managedVirtualNetworks/myPrivateEndpoint" + }, + "privateLinkServiceConnectionState": { + "status": "Approved", + "description": "Approved by admin.", + "actionsRequired": "exampleActionsRequired" + } + } + } + ] + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndpointConnection_Create.json b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndpointConnection_Create.json new file mode 100644 index 000000000000..d1383b20dfcf --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndpointConnection_Create.json @@ -0,0 +1,40 @@ +{ + "parameters": { + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + "resourceGroupName": "exampleResourceGroup", + "factoryName": "exampleFactoryName", + "privateEndpointConnectionName": "connection", + "api-version": "2018-06-01", + "ifMatch": null, + "privateEndpointWrapper": { + "properties": { + "privateLinkServiceConnectionState": { + "status": "Approved", + "description": "Approved by admin.", + "actionsRequired": "" + } + } + } + }, + "responses": { + "200": { + "headers": {}, + "body": { + "name": "exampleFactoryName", + "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName", + "type": "Microsoft.DataFactory/factories/privateEndpointConnections", + "properties": { + "provisioningState": "Succeeded", + "privateEndpoint": { + "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName/privateEndpoints/myPrivateEndpoint" + }, + "privateLinkServiceConnectionState": { + "status": "Approved", + "description": "Approved by admin.", + "actionsRequired": "" + } + } + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndpointConnection_Delete.json b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndpointConnection_Delete.json new file mode 100644 index 000000000000..67eac150e7bc --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndpointConnection_Delete.json @@ -0,0 +1,13 @@ +{ + "parameters": { + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + "resourceGroupName": "exampleResourceGroup", + "factoryName": "exampleFactoryName", + "privateEndpointConnectionName": "connection", + "api-version": "2018-06-01" + }, + "responses": { + "200": {}, + "204": {} + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndpointConnection_Get.json b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndpointConnection_Get.json new file mode 100644 index 000000000000..79c8a974a95a --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndpointConnection_Get.json @@ -0,0 +1,31 @@ +{ + "parameters": { + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + "resourceGroupName": "exampleResourceGroup", + "factoryName": "exampleFactoryName", + "privateEndpointConnectionName": "connection", + "api-version": "2018-06-01", + "ifNoneMatch": "1500504f-0000-0200-0000-5cbe090f0000" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "name": "exampleFactoryName", + "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName", + "type": "Microsoft.DataFactory/factories/privateEndpointConnections", + "properties": { + "provisioningState": "Succeeded", + "privateEndpoint": { + "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName/privateEndpoints/myPrivateEndpoint" + }, + "privateLinkServiceConnectionState": { + "status": "Approved", + "description": "Approved by admin.", + "actionsRequired": "" + } + } + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateLinkResources_Get.json b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateLinkResources_Get.json new file mode 100644 index 000000000000..878c9a564c6d --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateLinkResources_Get.json @@ -0,0 +1,31 @@ +{ + "parameters": { + "subscriptionId": "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + "resourceGroupName": "exampleResourceGroup", + "factoryName": "exampleFactoryName", + "api-version": "2018-06-01" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "value": [ + { + "name": "exampleFactoryName", + "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName", + "type": "Microsoft.DataFactory/factories/privateLinkResources", + "properties": { + "groupId": "dataFactory", + "requiredMembers": [ + "dataFactory" + ], + "requiredZoneNames": [ + "privatelink.datafactory.azure.net" + ] + } + } + ] + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/ExamplesUnitTest.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/ExamplesUnitTest.cs index 03430f6d9572..a375b4e1e835 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/ExamplesUnitTest.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/UnitTests/ExamplesUnitTest.cs @@ -334,7 +334,7 @@ public void LinkedServices_Delete() client.LinkedServices.Delete(RGN(example), FN(example), LSN(example)); }); } - + [Fact] public void Triggers_Create() { @@ -737,6 +737,55 @@ public void ManagedPrivateEndpoint_Delete() }); } + [Fact] + public void PrivateEndpointConnection_Create() + { + RunTest("PrivateEndpointConnection_Create", (example, client, responseCode) => + { + PrivateEndpointConnectionResource resource = client.PrivateEndpointConnection.CreateOrUpdate(RGN(example), FN(example), PEC(example), PLR(example, client)); + CheckResponseBody(example, client, responseCode, resource); + }); + } + + [Fact] + public void PrivateEndpointConnection_ListByFactory() + { + RunTest("PrivateEndpointConnections_ListByFactory", (example, client, responseCode) => + { + IPage resources = client.PrivateEndPointConnections.ListByFactory(RGN(example), FN(example)); + CheckResponseBody(example, client, responseCode, (Page)resources); + }); + } + + [Fact] + public void PrivateEndpointConnection_Get() + { + RunTest("PrivateEndpointConnection_Get", (example, client, responseCode) => + { + PrivateEndpointConnectionResource resource = client.PrivateEndpointConnection.Get(RGN(example), FN(example), PEC(example)); + CheckResponseBody(example, client, responseCode, resource); + }); + } + + [Fact] + public void PrivateEndpointConnection_Delete() + { + RunTest("PrivateEndpointConnection_Delete", (example, client, responseCode) => + { + client.PrivateEndpointConnection.Delete(RGN(example), FN(example), PEC(example)); + }); + } + + [Fact] + public void PrivateLinkResources_Get() + { + RunTest("PrivateLinkResources_Get", (example, client, responseCode) => + { + PrivateLinkResourcesWrapper resource = client.PrivateLinkResources.Get(RGN(example), FN(example)); + CheckResponseBody(example, client, responseCode, resource); + }); + } + private List GetResponses(Example example) { List messages = new List(); @@ -837,7 +886,7 @@ private void CheckResponseBody(Example example, IDataFactoryManagementClient JToken actualJToken = JToken.Parse(actualJson); - Assert.True(JToken.DeepEquals(expectedJToken, actualJToken), + Assert.True(JToken.DeepEquals(expectedJToken, actualJToken), string.Format(CultureInfo.InvariantCulture, "CheckResponseBody failed for example {0} response code {1}", example.Name, responseCode)); } @@ -886,6 +935,11 @@ private string MVN(Example example) return (string)example.Parameters["managedVirtualNetworkName"]; } + private string PEC(Example example) + { + return (string)example.Parameters["privateEndpointConnectionName"]; + } + private T GetTypedObject(IDataFactoryManagementClient client, object objectRaw) { string jsonRaw = SafeJsonConvert.SerializeObject(objectRaw); @@ -948,5 +1002,10 @@ private ManagedVirtualNetworkResource MVR(Example example, IDataFactoryManagemen { return GetTypedParameter(example, client, "managedVirtualNetwork"); } + + private PrivateLinkConnectionApprovalRequestResource PLR(Example example, IDataFactoryManagementClient client) + { + return GetTypedParameter(example, client, "privateEndpointWrapper"); + } } } From b8dc3dc114ddf2f94f66457a4c6d7a77e38e5302 Mon Sep 17 00:00:00 2001 From: Jingshu Pan Date: Thu, 25 Mar 2021 11:16:58 +0800 Subject: [PATCH 2/3] rename --- ...vateEndPointConnections_ListByFactory.json | 39 ------------------- 1 file changed, 39 deletions(-) delete mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndPointConnections_ListByFactory.json diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndPointConnections_ListByFactory.json b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndPointConnections_ListByFactory.json deleted file mode 100644 index e7d8a151708d..000000000000 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndPointConnections_ListByFactory.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "parameters": { - "subscriptionId": "12345678-1234-1234-1234-12345678abc", - "resourceGroupName": "exampleResourceGroup", - "factoryName": "exampleFactoryName", - "api-version": "2018-06-01" - }, - "responses": { - "200": { - "headers": { - "Date": "Sat, 16 Jun 2018 00:37:41 GMT", - "X-Content-Type-Options": "nosniff", - "x-ms-ratelimit-remaining-subscription-reads": "14908", - "x-ms-request-id": "9e6639e9-bece-4c0c-85de-4cadc30a73a6", - "x-ms-correlation-request-id": "9e6639e9-bece-4c0c-85de-4cadc30a73a6" - }, - "body": { - "value": [ - { - "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName/privateEndpoints/myPrivateEndpoint", - "name": "factories", - "type": "Microsoft.DataFactory/factories/privateEndpointConnections", - "properties": { - "provisioningState": "Succeeded", - "privateEndpoint": { - "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName/managedVirtualNetworks/myPrivateEndpoint" - }, - "privateLinkServiceConnectionState": { - "status": "Approved", - "description": "Approved by admin.", - "actionsRequired": "exampleActionsRequired" - } - } - } - ] - } - } - } -} From 79b7c68d871408cd3a728ce658c76d37ce3cf40b Mon Sep 17 00:00:00 2001 From: Jingshu Pan Date: Thu, 25 Mar 2021 11:17:23 +0800 Subject: [PATCH 3/3] add --- ...vateEndpointConnections_ListByFactory.json | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndpointConnections_ListByFactory.json diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndpointConnections_ListByFactory.json b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndpointConnections_ListByFactory.json new file mode 100644 index 000000000000..e7d8a151708d --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/tests/TestData/PrivateEndpointConnections_ListByFactory.json @@ -0,0 +1,39 @@ +{ + "parameters": { + "subscriptionId": "12345678-1234-1234-1234-12345678abc", + "resourceGroupName": "exampleResourceGroup", + "factoryName": "exampleFactoryName", + "api-version": "2018-06-01" + }, + "responses": { + "200": { + "headers": { + "Date": "Sat, 16 Jun 2018 00:37:41 GMT", + "X-Content-Type-Options": "nosniff", + "x-ms-ratelimit-remaining-subscription-reads": "14908", + "x-ms-request-id": "9e6639e9-bece-4c0c-85de-4cadc30a73a6", + "x-ms-correlation-request-id": "9e6639e9-bece-4c0c-85de-4cadc30a73a6" + }, + "body": { + "value": [ + { + "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName/privateEndpoints/myPrivateEndpoint", + "name": "factories", + "type": "Microsoft.DataFactory/factories/privateEndpointConnections", + "properties": { + "provisioningState": "Succeeded", + "privateEndpoint": { + "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName/managedVirtualNetworks/myPrivateEndpoint" + }, + "privateLinkServiceConnectionState": { + "status": "Approved", + "description": "Approved by admin.", + "actionsRequired": "exampleActionsRequired" + } + } + } + ] + } + } + } +}