Skip to content

Commit 0b9e017

Browse files
committed
map license/contact/terms of service for new/set apim api
1 parent 1c67c5c commit 0b9e017

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/ApiManagement/ApiManagement.ServiceManagement/ApiManagementClient.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,36 @@ public PsApiManagementApi ApiCreate(
916916
api.ApiVersion = apiVersion;
917917
}
918918

919+
if (!string.IsNullOrWhiteSpace(apiType))
920+
{
921+
api.ApiType = apiType;
922+
}
923+
924+
if (!string.IsNullOrWhiteSpace(termsOfServiceUrl))
925+
{
926+
api.TermsOfServiceUrl = termsOfServiceUrl;
927+
}
928+
929+
if (!string.IsNullOrWhiteSpace(contactEmail) || !string.IsNullOrWhiteSpace(contactName) || !string.IsNullOrWhiteSpace(contactUrl))
930+
{
931+
api.Contact = new ApiContactInformation
932+
{
933+
Email = contactEmail,
934+
Name = contactName,
935+
Url = contactUrl
936+
};
937+
}
938+
939+
if (!string.IsNullOrWhiteSpace(licenseName) || !string.IsNullOrWhiteSpace(licenseUrl))
940+
{
941+
api.License = new ApiLicenseInformation
942+
{
943+
Name = licenseName,
944+
Url = licenseUrl
945+
};
946+
}
947+
948+
919949
var getResponse = Client.Api.CreateOrUpdate(context.ResourceGroupName, context.ServiceName, id, api, null);
920950

921951
return Mapper.Map<PsApiManagementApi>(getResponse);
@@ -1045,6 +1075,11 @@ public PsApiManagementApi ApiSet(
10451075
api.ApiType = apiType;
10461076
}
10471077

1078+
if (!string.IsNullOrWhiteSpace(termsOfServiceUrl))
1079+
{
1080+
api.TermsOfServiceUrl = termsOfServiceUrl;
1081+
}
1082+
10481083
if (!string.IsNullOrWhiteSpace(contactEmail) || !string.IsNullOrWhiteSpace(contactName) || !string.IsNullOrWhiteSpace(contactUrl))
10491084
{
10501085
api.Contact = new ApiContactInformation

0 commit comments

Comments
 (0)