Skip to content

Commit 4d085a9

Browse files
committed
Map TermsOfService back to PsApiManagementApi, and update Set so if no apitype is proved, it doesn't overwrite back to http
1 parent 0b9e017 commit 4d085a9

File tree

3 files changed

+35
-27
lines changed

3 files changed

+35
-27
lines changed

src/ApiManagement/ApiManagement.ServiceManagement.Test/ScenarioTests/ApiManagementTests.ps1

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,11 @@ function Api-CrudGraphQlTest {
207207
Assert-AreEqual $subscriptionKeyQueryStringParamName $newApi.SubscriptionKeyQueryParamName
208208
Assert-AreEqual $newApiType $newApi.ApiType
209209
Assert-AreEqual $newApiTermsOfServiceUrl $newApi.TermsOfServiceUrl
210-
Assert-AreEqual $newApiContactName $newApi.Contact.Name
211-
Assert-AreEqual $newApiContactUrl $newApi.Contact.Url
212-
Assert-AreEqual $newApiContactEmail $newApi.Contact.Email
213-
Assert-AreEqual $newApiLicenseName $newApi.Nicense.Name
214-
Assert-AreEqual $newApiLicenseUrl $newApi.Nicense.Url
210+
Assert-AreEqual $newApiContactName $newApi.ContactName
211+
Assert-AreEqual $newApiContactUrl $newApi.ContactUrl
212+
Assert-AreEqual $newApiContactEmail $newApi.ContactEmail
213+
Assert-AreEqual $newApiLicenseName $newApi.LicenseName
214+
Assert-AreEqual $newApiLicenseUrl $newApi.LicenseUrl
215215

216216
# set api
217217
$newApiName = getAssetName
@@ -248,11 +248,11 @@ function Api-CrudGraphQlTest {
248248
Assert-AreEqual $subscriptionKeyQueryStringParamName $newApi.SubscriptionKeyQueryParamName
249249
Assert-AreEqual $newApiType $newApi.ApiType
250250
Assert-AreEqual $newApiTermsOfServiceUrl $newApi.TermsOfServiceUrl
251-
Assert-AreEqual $newApiContactName $newApi.Contact.Name
252-
Assert-AreEqual $newApiContactUrl $newApi.Contact.Url
253-
Assert-AreEqual $newApiContactEmail $newApi.Contact.Email
254-
Assert-AreEqual $newApiLicenseName $newApi.Nicense.Name
255-
Assert-AreEqual $newApiLicenseUrl $newApi.Nicense.Url
251+
Assert-AreEqual $newApiContactName $newApi.ContactName
252+
Assert-AreEqual $newApiContactUrl $newApi.ContactUrl
253+
Assert-AreEqual $newApiContactEmail $newApi.ContactEmail
254+
Assert-AreEqual $newApiLicenseName $newApi.LicenseName
255+
Assert-AreEqual $newApiLicenseUrl $newApi.LicenseUrl
256256

257257

258258
$product = Get-AzApiManagementProduct -Context $context | Select-Object -First 1
@@ -296,7 +296,7 @@ function Api-CrudWebsocketTest {
296296
$newApiName = getAssetName
297297
$newApiDescription = getAssetName
298298
$newApiPath = getAssetName
299-
$newApiServiceUrl = "http://newechoapi.cloudapp.net/newapi"
299+
$newApiServiceUrl = "ws://newechoapi.cloudapp.net/newapi"
300300
$subscriptionKeyParametersHeader = getAssetName
301301
$subscriptionKeyQueryStringParamName = getAssetName
302302
$newApiType = "websocket"
@@ -319,25 +319,25 @@ function Api-CrudWebsocketTest {
319319
Assert-AreEqual $newApiServiceUrl $newApi.ServiceUrl
320320
Assert-AreEqual $newApiPath $newApi.Path
321321
Assert-AreEqual 2 $newApi.Protocols.Length
322-
Assert-AreEqual http $newApi.Protocols[0]
323-
Assert-AreEqual https $newApi.Protocols[1]
322+
Assert-AreEqual ws $newApi.Protocols[0]
323+
Assert-AreEqual wss $newApi.Protocols[1]
324324
Assert-Null $newApi.AuthorizationServerId
325325
Assert-Null $newApi.AuthorizationScope
326326
Assert-AreEqual $subscriptionKeyParametersHeader $newApi.SubscriptionKeyHeaderName
327327
Assert-AreEqual $subscriptionKeyQueryStringParamName $newApi.SubscriptionKeyQueryParamName
328328
Assert-AreEqual $newApiType $newApi.ApiType
329329
Assert-AreEqual $newApiTermsOfServiceUrl $newApi.TermsOfServiceUrl
330-
Assert-AreEqual $newApiContactName $newApi.Contact.Name
331-
Assert-AreEqual $newApiContactUrl $newApi.Contact.Url
332-
Assert-AreEqual $newApiContactEmail $newApi.Contact.Email
333-
Assert-AreEqual $newApiLicenseName $newApi.Nicense.Name
334-
Assert-AreEqual $newApiLicenseUrl $newApi.Nicense.Url
330+
Assert-AreEqual $newApiContactName $newApi.ContactName
331+
Assert-AreEqual $newApiContactUrl $newApi.ContactUrl
332+
Assert-AreEqual $newApiContactEmail $newApi.ContactEmail
333+
Assert-AreEqual $newApiLicenseName $newApi.LicenseName
334+
Assert-AreEqual $newApiLicenseUrl $newApi.LicenseUrl
335335

336336
# set api
337337
$newApiName = getAssetName
338338
$newApiDescription = getAssetName
339339
$newApiPath = getAssetName
340-
$newApiServiceUrl = "http://newechoapi.cloudapp.net/newapinew"
340+
$newApiServiceUrl = "ws://newechoapi.cloudapp.net/newapinew"
341341
$subscriptionKeyParametersHeader = getAssetName
342342
$subscriptionKeyQueryStringParamName = getAssetName
343343
$newApiType = "websocket"
@@ -361,18 +361,18 @@ function Api-CrudWebsocketTest {
361361
Assert-AreEqual $newApiServiceUrl $newApi.ServiceUrl
362362
Assert-AreEqual $newApiPath $newApi.Path
363363
Assert-AreEqual 1 $newApi.Protocols.Length
364-
Assert-AreEqual https $newApi.Protocols[0]
364+
Assert-AreEqual ws $newApi.Protocols[0]
365365
Assert-Null $newApi.AuthorizationServerId
366366
Assert-Null $newApi.AuthorizationScope
367367
Assert-AreEqual $subscriptionKeyParametersHeader $newApi.SubscriptionKeyHeaderName
368368
Assert-AreEqual $subscriptionKeyQueryStringParamName $newApi.SubscriptionKeyQueryParamName
369369
Assert-AreEqual $newApiType $newApi.ApiType
370370
Assert-AreEqual $newApiTermsOfServiceUrl $newApi.TermsOfServiceUrl
371-
Assert-AreEqual $newApiContactName $newApi.Contact.Name
372-
Assert-AreEqual $newApiContactUrl $newApi.Contact.Url
373-
Assert-AreEqual $newApiContactEmail $newApi.Contact.Email
374-
Assert-AreEqual $newApiLicenseName $newApi.Nicense.Name
375-
Assert-AreEqual $newApiLicenseUrl $newApi.Nicense.Url
371+
Assert-AreEqual $newApiContactName $newApi.ContactName
372+
Assert-AreEqual $newApiContactUrl $newApi.ContactUrl
373+
Assert-AreEqual $newApiContactEmail $newApi.ContactEmail
374+
Assert-AreEqual $newApiLicenseName $newApi.LicenseName
375+
Assert-AreEqual $newApiLicenseUrl $newApi.LicenseUrl
376376

377377

378378
$product = Get-AzApiManagementProduct -Context $context | Select-Object -First 1

src/ApiManagement/ApiManagement.ServiceManagement/ApiManagementClient.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ private static void ConfigureMappings()
128128
.ForMember(dest => dest.IsOnline, opt => opt.MapFrom(src => src.IsOnline ?? false))
129129
.ForMember(dest => dest.ApiVersionSetDescription, opt => opt.MapFrom(src => src.ApiVersionDescription))
130130
.ForMember(dest => dest.Protocols, opt => opt.MapFrom(src => src.Protocols.ToArray()))
131+
.ForMember(dest => dest.TermsOfServiceUrl, opt => opt.MapFrom(src => src.TermsOfServiceUrl))
131132
.ForMember(
132133
dest => dest.AuthorizationServerId,
133134
opt => opt.MapFrom(
@@ -211,6 +212,7 @@ private static void ConfigureMappings()
211212
.ForMember(dest => dest.IsOnline, opt => opt.MapFrom(src => src.IsOnline))
212213
.ForMember(dest => dest.ApiVersionDescription, opt => opt.MapFrom(src => src.ApiVersionSetDescription))
213214
.ForMember(dest => dest.Protocols, opt => opt.MapFrom(src => src.Protocols.ToArray()))
215+
.ForMember(dest => dest.TermsOfServiceUrl, opt => opt.MapFrom(src => src.TermsOfServiceUrl))
214216
.AfterMap((src, dest) =>
215217
dest.AuthenticationSettings = Utils.ToAuthenticationSettings(src))
216218
.AfterMap((src, dest) =>
@@ -233,6 +235,7 @@ private static void ConfigureMappings()
233235
.ForMember(dest => dest.IsOnline, opt => opt.MapFrom(src => src.IsOnline))
234236
.ForMember(dest => dest.ApiVersionDescription, opt => opt.MapFrom(src => src.ApiVersionSetDescription))
235237
.ForMember(dest => dest.Protocols, opt => opt.MapFrom(src => src.Protocols.ToArray()))
238+
.ForMember(dest => dest.TermsOfServiceUrl, opt => opt.MapFrom(src => src.TermsOfServiceUrl))
236239
.AfterMap((src, dest) =>
237240
dest.AuthenticationSettings = Utils.ToAuthenticationSettings(src))
238241
.AfterMap((src, dest) =>
@@ -1070,7 +1073,7 @@ public PsApiManagementApi ApiSet(
10701073
};
10711074
}
10721075

1073-
if (!string.IsNullOrEmpty(apiType))
1076+
if (apiType != null)
10741077
{
10751078
api.ApiType = apiType;
10761079
}

src/ApiManagement/ApiManagement.ServiceManagement/Models/PsApiManagementApi.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,13 @@ public class PsApiManagementApi : PsApiManagementArmResource
132132
public string LicenseName { get; set; }
133133

134134
/// <summary>
135-
/// Gets or sets a URL to the Terms of Service for the API.
135+
/// Gets or sets a URL to the License for the API.
136136
/// </summary>
137137
public string LicenseUrl { get; set; }
138+
139+
/// <summary>
140+
/// Gets or sets a URL to the Terms of Service for the API.
141+
/// </summary>
142+
public string TermsOfServiceUrl { get; set; }
138143
}
139144
}

0 commit comments

Comments
 (0)