/
location.ts
93 lines (88 loc) · 3.48 KB
/
location.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* 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.
*/
import * as msRest from "@azure/ms-rest-js";
import * as Models from "../models";
import * as Mappers from "../models/locationMappers";
import * as Parameters from "../models/parameters";
import { AzureMigrateContext } from "../azureMigrateContext";
/** Class representing a Location. */
export class Location {
private readonly client: AzureMigrateContext;
/**
* Create a Location.
* @param {AzureMigrateContext} client Reference to the service client.
*/
constructor(client: AzureMigrateContext) {
this.client = client;
}
/**
* Checks whether the project name is available in the specified region.
* @param locationName The desired region for the name check.
* @param parameters Properties needed to check the availability of a name.
* @param [options] The optional parameters
* @returns Promise<Models.LocationCheckNameAvailabilityResponse>
*/
checkNameAvailability(locationName: string, parameters: Models.CheckNameAvailabilityParameters, options?: msRest.RequestOptionsBase): Promise<Models.LocationCheckNameAvailabilityResponse>;
/**
* @param locationName The desired region for the name check.
* @param parameters Properties needed to check the availability of a name.
* @param callback The callback
*/
checkNameAvailability(locationName: string, parameters: Models.CheckNameAvailabilityParameters, callback: msRest.ServiceCallback<Models.CheckNameAvailabilityResult>): void;
/**
* @param locationName The desired region for the name check.
* @param parameters Properties needed to check the availability of a name.
* @param options The optional parameters
* @param callback The callback
*/
checkNameAvailability(locationName: string, parameters: Models.CheckNameAvailabilityParameters, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.CheckNameAvailabilityResult>): void;
checkNameAvailability(locationName: string, parameters: Models.CheckNameAvailabilityParameters, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.CheckNameAvailabilityResult>, callback?: msRest.ServiceCallback<Models.CheckNameAvailabilityResult>): Promise<Models.LocationCheckNameAvailabilityResponse> {
return this.client.sendOperationRequest(
{
locationName,
parameters,
options
},
checkNameAvailabilityOperationSpec,
callback) as Promise<Models.LocationCheckNameAvailabilityResponse>;
}
}
// Operation Specifications
const serializer = new msRest.Serializer(Mappers);
const checkNameAvailabilityOperationSpec: msRest.OperationSpec = {
httpMethod: "POST",
path: "subscriptions/{subscriptionId}/providers/Microsoft.Migrate/locations/{locationName}/checkNameAvailability",
urlParameters: [
Parameters.locationName,
Parameters.subscriptionId
],
queryParameters: [
Parameters.apiVersion
],
headerParameters: [
Parameters.acceptLanguage
],
requestBody: {
parameterPath: "parameters",
mapper: {
...Mappers.CheckNameAvailabilityParameters,
required: true
}
},
responses: {
200: {
bodyMapper: Mappers.CheckNameAvailabilityResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
serializer
};