This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 497
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract ApiManagement service (#760)
* Add ApiMAnagement Service models, client, processor, extractor * Add integration test for ApiManagementService * Update supported resources doc file Co-authored-by: Farhad Alizada <falizada@microsoft.com>
- Loading branch information
Showing
35 changed files
with
813 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/ArmTemplates/Common/API/Clients/Abstractions/IApiManagementServiceClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// -------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// -------------------------------------------------------------------------- | ||
|
||
using System.Threading.Tasks; | ||
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.Templates.ApiManagementService; | ||
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Extractor.Models; | ||
|
||
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.API.Clients.Abstractions | ||
{ | ||
public interface IApiManagementServiceClient | ||
{ | ||
Task<ApiManagementServiceResource> GetApiManagementServiceAsync(ExtractorParameters extractorParameters); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/ArmTemplates/Common/API/Clients/ApiManagementService/ApiManagementServiceClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// -------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// -------------------------------------------------------------------------- | ||
|
||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.API.Clients.Abstractions; | ||
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.Constants; | ||
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.Templates.ApiManagementService; | ||
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Extractor.Models; | ||
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Extractor.Utilities.DataProcessors.Absctraction; | ||
|
||
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.API.Clients.ApiManagementService | ||
{ | ||
public class ApiManagementServiceClient: ApiClientBase, IApiManagementServiceClient | ||
{ | ||
const string GetApiManagementServiceByName = "{0}/subscriptions/{1}/resourceGroups/{2}/providers/Microsoft.ApiManagement/service/{3}?api-version={4}"; | ||
|
||
readonly IApiManagementServiceProcessor apiManagementServiceProcessor; | ||
|
||
public ApiManagementServiceClient( | ||
IHttpClientFactory httpClientFactory, | ||
IApiManagementServiceProcessor apiManagementServiceProcessor): base(httpClientFactory) | ||
{ | ||
this.apiManagementServiceProcessor = apiManagementServiceProcessor; | ||
} | ||
|
||
public async Task<ApiManagementServiceResource> GetApiManagementServiceAsync(ExtractorParameters extractorParameters) | ||
{ | ||
var (azToken, azSubId) = await this.Auth.GetAccessToken(); | ||
|
||
string requestUrl = string.Format(GetApiManagementServiceByName, | ||
this.BaseUrl, azSubId, extractorParameters.ResourceGroup, extractorParameters.SourceApimName, GlobalConstants.ApiVersion); | ||
|
||
var apiManagementServiceResource = await this.GetResponseAsync<ApiManagementServiceResource>(azToken, requestUrl); | ||
this.apiManagementServiceProcessor.ProcessSingleInstanceData(apiManagementServiceResource, extractorParameters); | ||
|
||
return apiManagementServiceResource; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/ArmTemplates/Common/Templates/ApiManagementService/AdditionalLocation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// -------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// -------------------------------------------------------------------------- | ||
|
||
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.Templates.ApiManagementService | ||
{ | ||
public class AdditionalLocation | ||
{ | ||
public string DisableGateway { get; set; } | ||
|
||
public string GatewayRegionalUrl { get; set; } | ||
|
||
public string Location { get; set; } | ||
|
||
public string PlatformVersion { get; set; } | ||
|
||
public string[] PrivateIPAddresses { get; set; } | ||
|
||
public string[] PublicIPAddresses { get; set; } | ||
|
||
public string PublicIpAddressId { get; set; } | ||
|
||
public ApiManagementServiceSkuProperties Sku { get; set; } | ||
|
||
public VirtualNetworkConfiguration VirtualNetworkConfiguration { get; set; } | ||
|
||
public string[] Zones { get; set; } | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/ArmTemplates/Common/Templates/ApiManagementService/ApiManagementServiceIdentity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// -------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// -------------------------------------------------------------------------- | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.Templates.ApiManagementService | ||
{ | ||
public class ApiManagementServiceIdentity | ||
{ | ||
public string PrincipalId { get; set; } | ||
|
||
public string TenantId { get; set; } | ||
|
||
public string Type { get; set; } | ||
|
||
public IDictionary<string, UserIdentityProperties> UserAssignedIdentities { get; set; } | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/ArmTemplates/Common/Templates/ApiManagementService/ApiManagementServiceProperties.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// -------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// -------------------------------------------------------------------------- | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.Templates.ApiManagementService | ||
{ | ||
public class ApiManagementServiceProperties | ||
{ | ||
public AdditionalLocation[] AdditionalLocations { get; set; } | ||
|
||
public ApiVersionConstraint ApiVersionConstraint { get; set; } | ||
|
||
public CertificateConfiguration[] Certificates { get; set; } | ||
|
||
public IDictionary<string, string> CustomProperties { get; set; } | ||
|
||
public bool DisableGateway { get; set; } | ||
|
||
public bool? EnableClientCertificate { get; set; } | ||
|
||
public string NotificationSenderEmail { get; set; } | ||
|
||
public string PlatformVersion { get; set; } | ||
|
||
public RemotePrivateEndpointConnectionWrapper[] PrivateEndpointConnections { get; set; } | ||
|
||
public string[] PrivateIPAddresses { get; set; } | ||
|
||
public string ProvisioningState { get; set; } | ||
|
||
public string PublicIpAddressId { get; set; } | ||
|
||
public string PublicNetworkAccess { get; set; } | ||
|
||
public string PublisherEmail { get; set; } | ||
|
||
public string PublisherName { get; set; } | ||
|
||
public bool Restore { get; set; } | ||
|
||
public string TargetProvisioningState { get; set; } | ||
|
||
public VirtualNetworkConfiguration VirtualNetworkConfiguration { get; set; } | ||
|
||
public string VirtualNetworkType { get; set; } | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/ArmTemplates/Common/Templates/ApiManagementService/ApiManagementServiceResource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// -------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// -------------------------------------------------------------------------- | ||
|
||
using System.Collections.Generic; | ||
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.Templates.Abstractions; | ||
using Newtonsoft.Json; | ||
|
||
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.Templates.ApiManagementService | ||
{ | ||
public class ApiManagementServiceResource : TemplateResource | ||
{ | ||
[JsonIgnore] | ||
public string OriginalName { get; set; } | ||
|
||
public ApiManagementServiceIdentity Identity { get; set; } | ||
|
||
public string Location { get; set; } | ||
|
||
public IDictionary<string, string> Tags { get; set; } | ||
|
||
public string[] Zones { get; set; } | ||
|
||
public ApiManagementServiceSkuProperties Sku { get; set; } | ||
|
||
public ApiManagementServiceProperties Properties { get; set; } | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/ArmTemplates/Common/Templates/ApiManagementService/ApiManagementServiceResources.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// -------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// -------------------------------------------------------------------------- | ||
|
||
using System.Collections.Generic; | ||
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.Extensions; | ||
using Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.Templates.Abstractions; | ||
|
||
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.Templates.ApiManagementService | ||
{ | ||
public class ApiManagementServiceResources: ITemplateResources | ||
{ | ||
public List<ApiManagementServiceResource> ApiManagementServices{ get; set; } = new(); | ||
|
||
public TemplateResource[] BuildTemplateResources() | ||
{ | ||
return this.ApiManagementServices.ToArray(); | ||
} | ||
|
||
public bool HasContent() | ||
{ | ||
return !this.ApiManagementServices.IsNullOrEmpty(); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/ArmTemplates/Common/Templates/ApiManagementService/ApiManagementServiceSkuProperties.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// -------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// -------------------------------------------------------------------------- | ||
|
||
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.Templates.ApiManagementService | ||
{ | ||
public class ApiManagementServiceSkuProperties | ||
{ | ||
public int Capacity { get; set; } | ||
|
||
public string Name { get; set; } | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/ArmTemplates/Common/Templates/ApiManagementService/ApiVersionConstraint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// -------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// -------------------------------------------------------------------------- | ||
|
||
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.Templates.ApiManagementService | ||
{ | ||
public class ApiVersionConstraint | ||
{ | ||
public string MinApiVersion { get; set; } | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/ArmTemplates/Common/Templates/ApiManagementService/ArmIdWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// -------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// -------------------------------------------------------------------------- | ||
|
||
namespace Microsoft.Azure.Management.ApiManagement.ArmTemplates.Common.Templates.ApiManagementService | ||
{ | ||
public class ArmIdWrapper | ||
{ | ||
public string Id { get; set; } | ||
} | ||
} |
Oops, something went wrong.