зеркало из https://github.com/Azure/BatchExplorer.git
Updated RLC version to 2023-05-01 API version (#2759)
* Updated RLC version to 2023-05-01 API version Reran prettier to fix linting issues Updated RLC version to 2023-05-01 API version * Added comment on running lint to format files * Add RLC generated src files to pretty ignore and regenerated SDK
This commit is contained in:
Родитель
617d5c371f
Коммит
d88ef89f93
|
@ -19,3 +19,4 @@ package-lock.json
|
|||
Localize/out/
|
||||
Localize/packages/
|
||||
/**/resources/
|
||||
packages/arm-batch-rest/src/generated/
|
||||
|
|
|
@ -10,12 +10,12 @@ Before developing against this library, please consult the __Developer Prerequis
|
|||
|
||||
This SDK library is built through autogenerated code by invoking autorest with our Batch Management swagger configuration file hosted at <https://github.com/Azure/azure-rest-api-specs/tree/main/specification/batch/resource-manager/Microsoft.Batch/stable>.
|
||||
|
||||
- `swagger` - This subdirectory contains the swagger configuration file containing documented autorest command options to make the code regeneration process easier to invoke in case there is a need to refresh the rest api input file or other changes. The associated README.md configuration file contains autorest command options such as: package name and version, swagger input file, source code folder path, client authentication customization, etc.
|
||||
- `swagger` - This subdirectory contains the swagger configuration file containing documented autorest command options to make the code regeneration process easier to invoke in case there is a need to refresh the rest api input file or other changes. The associated README.md configuration file contains autorest command options such as: package name and version, swagger input file, source code folder path, client authentication customization, etc. One of the command options within the file is the __input-file__ option which is a link to the openAPI Batch swagger file under the public [Azure Rest API Spec repo](https://github.com/Azure/azure-rest-api-specs). In order to regenerate the SDK to pick up the latest API swagger definitions, you will need to change the input-file path to point to the file denoted under the latest API version.
|
||||
|
||||
To invoke autorest and regenerate the code, run the following from the same directory as this README:
|
||||
To invoke autorest and regenerate the code, run the following from the root of the subproject:
|
||||
|
||||
```shell
|
||||
autorest --typescript swagger/README.md
|
||||
npm run generate:client
|
||||
```
|
||||
|
||||
This will parse the command options from the README and regenerate the SDK code within the src/generated folder.
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
"clean:build": "bux rmrf ./build",
|
||||
"clean:esm": "bux rmrf ./lib",
|
||||
"clean:cjs": "bux rmrf ./lib-cjs",
|
||||
"generate:client": "autorest --typescript swagger/README.md && npm run format",
|
||||
"generate:client": "autorest --typescript swagger/README.md",
|
||||
"lint": "eslint",
|
||||
"test": "jest",
|
||||
"test:all": "npm run test:coverage",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const ARM_API_BASE_URI = "https://management.azure.com";
|
||||
export const BATCH_API_VERSION = "2022-10-01";
|
||||
export const BATCH_API_VERSION = "2023-05-01";
|
||||
|
||||
function getUrlBasePath(subscriptionId: string) {
|
||||
return `${ARM_API_BASE_URI}/subscriptions/${subscriptionId}`;
|
||||
|
|
|
@ -10,35 +10,35 @@ import { BatchManagementClient } from "./clientDefinitions";
|
|||
* @param credentials type: TokenCredential
|
||||
*/
|
||||
export default function createClient(
|
||||
credentials: TokenCredential,
|
||||
options: ClientOptions = {}
|
||||
credentials: TokenCredential,
|
||||
options: ClientOptions = {}
|
||||
): BatchManagementClient {
|
||||
const baseUrl = options.baseUrl ?? `https://management.azure.com`;
|
||||
options.apiVersion = options.apiVersion ?? "2022-10-01";
|
||||
options = {
|
||||
...options,
|
||||
credentials: {
|
||||
scopes: ["https://management.azure.com/.default"],
|
||||
},
|
||||
};
|
||||
const baseUrl = options.baseUrl ?? `https://management.azure.com`;
|
||||
options.apiVersion = options.apiVersion ?? "2023-05-01";
|
||||
options = {
|
||||
...options,
|
||||
credentials: {
|
||||
scopes: ["https://management.azure.com/.default"]
|
||||
}
|
||||
};
|
||||
|
||||
const userAgentInfo = `azsdk-js-arm-batch-rest/1.0.0-beta.1`;
|
||||
const userAgentPrefix =
|
||||
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
||||
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
||||
: `${userAgentInfo}`;
|
||||
options = {
|
||||
...options,
|
||||
userAgentOptions: {
|
||||
userAgentPrefix,
|
||||
},
|
||||
};
|
||||
const userAgentInfo = `azsdk-js-arm-batch-rest/1.0.0-beta.1`;
|
||||
const userAgentPrefix =
|
||||
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
||||
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
||||
: `${userAgentInfo}`;
|
||||
options = {
|
||||
...options,
|
||||
userAgentOptions: {
|
||||
userAgentPrefix
|
||||
}
|
||||
};
|
||||
|
||||
const client = getClient(
|
||||
baseUrl,
|
||||
credentials,
|
||||
options
|
||||
) as BatchManagementClient;
|
||||
const client = getClient(
|
||||
baseUrl,
|
||||
credentials,
|
||||
options
|
||||
) as BatchManagementClient;
|
||||
|
||||
return client;
|
||||
return client;
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -2,14 +2,14 @@
|
|||
// Licensed under the MIT license.
|
||||
|
||||
import {
|
||||
getPagedAsyncIterator,
|
||||
PagedAsyncIterableIterator,
|
||||
PagedResult,
|
||||
getPagedAsyncIterator,
|
||||
PagedAsyncIterableIterator,
|
||||
PagedResult
|
||||
} from "@azure/core-paging";
|
||||
import {
|
||||
Client,
|
||||
createRestError,
|
||||
PathUncheckedResponse,
|
||||
Client,
|
||||
createRestError,
|
||||
PathUncheckedResponse
|
||||
} from "@azure-rest/core-client";
|
||||
|
||||
/**
|
||||
|
@ -21,21 +21,21 @@ export type GetArrayType<T> = T extends Array<infer TData> ? TData : never;
|
|||
* The type of a custom function that defines how to get a page and a link to the next one if any.
|
||||
*/
|
||||
export type GetPage<TPage> = (
|
||||
pageLink: string,
|
||||
maxPageSize?: number
|
||||
pageLink: string,
|
||||
maxPageSize?: number
|
||||
) => Promise<{
|
||||
page: TPage;
|
||||
nextPageLink?: string;
|
||||
page: TPage;
|
||||
nextPageLink?: string;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* Options for the paging helper
|
||||
*/
|
||||
export interface PagingOptions<TResponse> {
|
||||
/**
|
||||
* Custom function to extract pagination details for crating the PagedAsyncIterableIterator
|
||||
*/
|
||||
customGetPage?: GetPage<PaginateReturn<TResponse>[]>;
|
||||
/**
|
||||
* Custom function to extract pagination details for crating the PagedAsyncIterableIterator
|
||||
*/
|
||||
customGetPage?: GetPage<PaginateReturn<TResponse>[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,10 +46,10 @@ export interface PagingOptions<TResponse> {
|
|||
* This type will allow us to provide strongly typed Iterator based on the response we get as second parameter
|
||||
*/
|
||||
export type PaginateReturn<TResult> = TResult extends {
|
||||
body: { value?: infer TPage };
|
||||
body: { value?: infer TPage };
|
||||
}
|
||||
? GetArrayType<TPage>
|
||||
: Array<unknown>;
|
||||
? GetArrayType<TPage>
|
||||
: Array<unknown>;
|
||||
|
||||
/**
|
||||
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
|
||||
|
@ -59,99 +59,96 @@ export type PaginateReturn<TResult> = TResult extends {
|
|||
* @returns - PagedAsyncIterableIterator to iterate the elements
|
||||
*/
|
||||
export function paginate<TResponse extends PathUncheckedResponse>(
|
||||
client: Client,
|
||||
initialResponse: TResponse,
|
||||
options: PagingOptions<TResponse> = {}
|
||||
client: Client,
|
||||
initialResponse: TResponse,
|
||||
options: PagingOptions<TResponse> = {}
|
||||
): PagedAsyncIterableIterator<PaginateReturn<TResponse>> {
|
||||
// Extract element type from initial response
|
||||
type TElement = PaginateReturn<TResponse>;
|
||||
let firstRun = true;
|
||||
const itemName = "value";
|
||||
const nextLinkName = "nextLink";
|
||||
const { customGetPage } = options;
|
||||
const pagedResult: PagedResult<TElement[]> = {
|
||||
firstPageLink: "",
|
||||
getPage:
|
||||
typeof customGetPage === "function"
|
||||
? customGetPage
|
||||
: async (pageLink: string) => {
|
||||
const result = firstRun
|
||||
? initialResponse
|
||||
: await client.pathUnchecked(pageLink).get();
|
||||
firstRun = false;
|
||||
checkPagingRequest(result);
|
||||
const nextLink = getNextLink(result.body, nextLinkName);
|
||||
const values = getElements<TElement>(
|
||||
result.body,
|
||||
itemName
|
||||
);
|
||||
return {
|
||||
page: values,
|
||||
nextPageLink: nextLink,
|
||||
};
|
||||
},
|
||||
};
|
||||
// Extract element type from initial response
|
||||
type TElement = PaginateReturn<TResponse>;
|
||||
let firstRun = true;
|
||||
const itemName = "value";
|
||||
const nextLinkName = "nextLink";
|
||||
const { customGetPage } = options;
|
||||
const pagedResult: PagedResult<TElement[]> = {
|
||||
firstPageLink: "",
|
||||
getPage:
|
||||
typeof customGetPage === "function"
|
||||
? customGetPage
|
||||
: async (pageLink: string) => {
|
||||
const result = firstRun
|
||||
? initialResponse
|
||||
: await client.pathUnchecked(pageLink).get();
|
||||
firstRun = false;
|
||||
checkPagingRequest(result);
|
||||
const nextLink = getNextLink(result.body, nextLinkName);
|
||||
const values = getElements<TElement>(result.body, itemName);
|
||||
return {
|
||||
page: values,
|
||||
nextPageLink: nextLink
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
return getPagedAsyncIterator(pagedResult);
|
||||
return getPagedAsyncIterator(pagedResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets for the value of nextLink in the body
|
||||
*/
|
||||
function getNextLink(body: unknown, nextLinkName?: string): string | undefined {
|
||||
if (!nextLinkName) {
|
||||
return undefined;
|
||||
}
|
||||
if (!nextLinkName) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const nextLink = (body as Record<string, unknown>)[nextLinkName];
|
||||
const nextLink = (body as Record<string, unknown>)[nextLinkName];
|
||||
|
||||
if (typeof nextLink !== "string" && typeof nextLink !== "undefined") {
|
||||
throw new Error(
|
||||
`Body Property ${nextLinkName} should be a string or undefined`
|
||||
);
|
||||
}
|
||||
if (typeof nextLink !== "string" && typeof nextLink !== "undefined") {
|
||||
throw new Error(
|
||||
`Body Property ${nextLinkName} should be a string or undefined`
|
||||
);
|
||||
}
|
||||
|
||||
return nextLink;
|
||||
return nextLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the elements of the current request in the body.
|
||||
*/
|
||||
function getElements<T = unknown>(body: unknown, itemName: string): T[] {
|
||||
const value = (body as Record<string, unknown>)[itemName] as T[];
|
||||
const value = (body as Record<string, unknown>)[itemName] as T[];
|
||||
|
||||
// value has to be an array according to the x-ms-pageable extension.
|
||||
// The fact that this must be an array is used above to calculate the
|
||||
// type of elements in the page in PaginateReturn
|
||||
if (!Array.isArray(value)) {
|
||||
throw new Error(
|
||||
`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`
|
||||
);
|
||||
}
|
||||
// value has to be an array according to the x-ms-pageable extension.
|
||||
// The fact that this must be an array is used above to calculate the
|
||||
// type of elements in the page in PaginateReturn
|
||||
if (!Array.isArray(value)) {
|
||||
throw new Error(
|
||||
`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`
|
||||
);
|
||||
}
|
||||
|
||||
return value ?? [];
|
||||
return value ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a request failed
|
||||
*/
|
||||
function checkPagingRequest(response: PathUncheckedResponse): void {
|
||||
const Http2xxStatusCodes = [
|
||||
"200",
|
||||
"201",
|
||||
"202",
|
||||
"203",
|
||||
"204",
|
||||
"205",
|
||||
"206",
|
||||
"207",
|
||||
"208",
|
||||
"226",
|
||||
];
|
||||
if (!Http2xxStatusCodes.includes(response.status)) {
|
||||
throw createRestError(
|
||||
`Pagination failed with unexpected statusCode ${response.status}`,
|
||||
response
|
||||
);
|
||||
}
|
||||
const Http2xxStatusCodes = [
|
||||
"200",
|
||||
"201",
|
||||
"202",
|
||||
"203",
|
||||
"204",
|
||||
"205",
|
||||
"206",
|
||||
"207",
|
||||
"208",
|
||||
"226"
|
||||
];
|
||||
if (!Http2xxStatusCodes.includes(response.status)) {
|
||||
throw createRestError(
|
||||
`Pagination failed with unexpected statusCode ${response.status}`,
|
||||
response
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,403 +4,396 @@
|
|||
import { RawHttpHeadersInput } from "@azure/core-rest-pipeline";
|
||||
import { RequestParameters } from "@azure-rest/core-client";
|
||||
import {
|
||||
AccountBatchCreateParameters,
|
||||
AccountBatchUpdateParameters,
|
||||
AccountBatchRegenerateKeyParameters,
|
||||
ActivateApplicationPackageParameters,
|
||||
ApplicationPackage,
|
||||
Application,
|
||||
CheckNameAvailabilityParameters,
|
||||
CertificateCreateOrUpdateParameters,
|
||||
PrivateEndpointConnection,
|
||||
Pool,
|
||||
AccountBatchCreateParameters,
|
||||
AccountBatchUpdateParameters,
|
||||
AccountBatchRegenerateKeyParameters,
|
||||
ActivateApplicationPackageParameters,
|
||||
ApplicationPackage,
|
||||
Application,
|
||||
CheckNameAvailabilityParameters,
|
||||
CertificateCreateOrUpdateParameters,
|
||||
PrivateEndpointConnection,
|
||||
Pool
|
||||
} from "./models";
|
||||
|
||||
export interface BatchAccountCreateBodyParam {
|
||||
/** Additional parameters for account creation. */
|
||||
body: AccountBatchCreateParameters;
|
||||
/** Additional parameters for account creation. */
|
||||
body: AccountBatchCreateParameters;
|
||||
}
|
||||
|
||||
export interface BatchAccountCreateMediaTypesParam {
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
}
|
||||
|
||||
export type BatchAccountCreateParameters = BatchAccountCreateMediaTypesParam &
|
||||
BatchAccountCreateBodyParam &
|
||||
RequestParameters;
|
||||
BatchAccountCreateBodyParam &
|
||||
RequestParameters;
|
||||
|
||||
export interface BatchAccountUpdateBodyParam {
|
||||
/** Additional parameters for account update. */
|
||||
body: AccountBatchUpdateParameters;
|
||||
/** Additional parameters for account update. */
|
||||
body: AccountBatchUpdateParameters;
|
||||
}
|
||||
|
||||
export interface BatchAccountUpdateMediaTypesParam {
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
}
|
||||
|
||||
export type BatchAccountUpdateParameters = BatchAccountUpdateMediaTypesParam &
|
||||
BatchAccountUpdateBodyParam &
|
||||
RequestParameters;
|
||||
BatchAccountUpdateBodyParam &
|
||||
RequestParameters;
|
||||
export type BatchAccountDeleteParameters = RequestParameters;
|
||||
export type BatchAccountGetParameters = RequestParameters;
|
||||
export type BatchAccountListParameters = RequestParameters;
|
||||
export type BatchAccountListByResourceGroupParameters = RequestParameters;
|
||||
export type BatchAccountSynchronizeAutoStorageKeysParameters =
|
||||
RequestParameters;
|
||||
export type BatchAccountSynchronizeAutoStorageKeysParameters = RequestParameters;
|
||||
|
||||
export interface BatchAccountRegenerateKeyBodyParam {
|
||||
/** The type of key to regenerate. */
|
||||
body: AccountBatchRegenerateKeyParameters;
|
||||
/** The type of key to regenerate. */
|
||||
body: AccountBatchRegenerateKeyParameters;
|
||||
}
|
||||
|
||||
export interface BatchAccountRegenerateKeyMediaTypesParam {
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
}
|
||||
|
||||
export type BatchAccountRegenerateKeyParameters =
|
||||
BatchAccountRegenerateKeyMediaTypesParam &
|
||||
BatchAccountRegenerateKeyBodyParam &
|
||||
RequestParameters;
|
||||
export type BatchAccountRegenerateKeyParameters = BatchAccountRegenerateKeyMediaTypesParam &
|
||||
BatchAccountRegenerateKeyBodyParam &
|
||||
RequestParameters;
|
||||
export type BatchAccountGetKeysParameters = RequestParameters;
|
||||
export type BatchAccountListDetectorsParameters = RequestParameters;
|
||||
export type BatchAccountGetDetectorParameters = RequestParameters;
|
||||
export type BatchAccountListOutboundNetworkDependenciesEndpointsParameters =
|
||||
RequestParameters;
|
||||
export type BatchAccountListOutboundNetworkDependenciesEndpointsParameters = RequestParameters;
|
||||
|
||||
export interface ApplicationPackageActivateBodyParam {
|
||||
/** The parameters for the request. */
|
||||
body: ActivateApplicationPackageParameters;
|
||||
/** The parameters for the request. */
|
||||
body: ActivateApplicationPackageParameters;
|
||||
}
|
||||
|
||||
export interface ApplicationPackageActivateMediaTypesParam {
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
}
|
||||
|
||||
export type ApplicationPackageActivateParameters =
|
||||
ApplicationPackageActivateMediaTypesParam &
|
||||
ApplicationPackageActivateBodyParam &
|
||||
RequestParameters;
|
||||
export type ApplicationPackageActivateParameters = ApplicationPackageActivateMediaTypesParam &
|
||||
ApplicationPackageActivateBodyParam &
|
||||
RequestParameters;
|
||||
|
||||
export interface ApplicationPackageCreateBodyParam {
|
||||
/** The parameters for the request. */
|
||||
body?: ApplicationPackage;
|
||||
/** The parameters for the request. */
|
||||
body?: ApplicationPackage;
|
||||
}
|
||||
|
||||
export interface ApplicationPackageCreateMediaTypesParam {
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
}
|
||||
|
||||
export type ApplicationPackageCreateParameters =
|
||||
ApplicationPackageCreateMediaTypesParam &
|
||||
ApplicationPackageCreateBodyParam &
|
||||
RequestParameters;
|
||||
export type ApplicationPackageCreateParameters = ApplicationPackageCreateMediaTypesParam &
|
||||
ApplicationPackageCreateBodyParam &
|
||||
RequestParameters;
|
||||
export type ApplicationPackageDeleteParameters = RequestParameters;
|
||||
export type ApplicationPackageGetParameters = RequestParameters;
|
||||
|
||||
export interface ApplicationPackageListQueryParamProperties {
|
||||
/** The maximum number of items to return in the response. */
|
||||
maxresults?: number;
|
||||
/** The maximum number of items to return in the response. */
|
||||
maxresults?: number;
|
||||
}
|
||||
|
||||
export interface ApplicationPackageListQueryParam {
|
||||
queryParameters?: ApplicationPackageListQueryParamProperties;
|
||||
queryParameters?: ApplicationPackageListQueryParamProperties;
|
||||
}
|
||||
|
||||
export type ApplicationPackageListParameters =
|
||||
ApplicationPackageListQueryParam & RequestParameters;
|
||||
export type ApplicationPackageListParameters = ApplicationPackageListQueryParam &
|
||||
RequestParameters;
|
||||
|
||||
export interface ApplicationCreateBodyParam {
|
||||
/** The parameters for the request. */
|
||||
body?: Application;
|
||||
/** The parameters for the request. */
|
||||
body?: Application;
|
||||
}
|
||||
|
||||
export interface ApplicationCreateMediaTypesParam {
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
}
|
||||
|
||||
export type ApplicationCreateParameters = ApplicationCreateMediaTypesParam &
|
||||
ApplicationCreateBodyParam &
|
||||
RequestParameters;
|
||||
ApplicationCreateBodyParam &
|
||||
RequestParameters;
|
||||
export type ApplicationDeleteParameters = RequestParameters;
|
||||
export type ApplicationGetParameters = RequestParameters;
|
||||
|
||||
export interface ApplicationUpdateBodyParam {
|
||||
/** The parameters for the request. */
|
||||
body: Application;
|
||||
/** The parameters for the request. */
|
||||
body: Application;
|
||||
}
|
||||
|
||||
export interface ApplicationUpdateMediaTypesParam {
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
}
|
||||
|
||||
export type ApplicationUpdateParameters = ApplicationUpdateMediaTypesParam &
|
||||
ApplicationUpdateBodyParam &
|
||||
RequestParameters;
|
||||
ApplicationUpdateBodyParam &
|
||||
RequestParameters;
|
||||
|
||||
export interface ApplicationListQueryParamProperties {
|
||||
/** The maximum number of items to return in the response. */
|
||||
maxresults?: number;
|
||||
/** The maximum number of items to return in the response. */
|
||||
maxresults?: number;
|
||||
}
|
||||
|
||||
export interface ApplicationListQueryParam {
|
||||
queryParameters?: ApplicationListQueryParamProperties;
|
||||
queryParameters?: ApplicationListQueryParamProperties;
|
||||
}
|
||||
|
||||
export type ApplicationListParameters = ApplicationListQueryParam &
|
||||
RequestParameters;
|
||||
RequestParameters;
|
||||
export type LocationGetQuotasParameters = RequestParameters;
|
||||
|
||||
export interface LocationListSupportedVirtualMachineSkusQueryParamProperties {
|
||||
/** The maximum number of items to return in the response. */
|
||||
maxresults?: number;
|
||||
/** OData filter expression. Valid properties for filtering are "familyName". */
|
||||
$filter?: string;
|
||||
/** The maximum number of items to return in the response. */
|
||||
maxresults?: number;
|
||||
/** OData filter expression. Valid properties for filtering are "familyName". */
|
||||
$filter?: string;
|
||||
}
|
||||
|
||||
export interface LocationListSupportedVirtualMachineSkusQueryParam {
|
||||
queryParameters?: LocationListSupportedVirtualMachineSkusQueryParamProperties;
|
||||
queryParameters?: LocationListSupportedVirtualMachineSkusQueryParamProperties;
|
||||
}
|
||||
|
||||
export type LocationListSupportedVirtualMachineSkusParameters =
|
||||
LocationListSupportedVirtualMachineSkusQueryParam & RequestParameters;
|
||||
export type LocationListSupportedVirtualMachineSkusParameters = LocationListSupportedVirtualMachineSkusQueryParam &
|
||||
RequestParameters;
|
||||
|
||||
export interface LocationListSupportedCloudServiceSkusQueryParamProperties {
|
||||
/** The maximum number of items to return in the response. */
|
||||
maxresults?: number;
|
||||
/** OData filter expression. Valid properties for filtering are "familyName". */
|
||||
$filter?: string;
|
||||
/** The maximum number of items to return in the response. */
|
||||
maxresults?: number;
|
||||
/** OData filter expression. Valid properties for filtering are "familyName". */
|
||||
$filter?: string;
|
||||
}
|
||||
|
||||
export interface LocationListSupportedCloudServiceSkusQueryParam {
|
||||
queryParameters?: LocationListSupportedCloudServiceSkusQueryParamProperties;
|
||||
queryParameters?: LocationListSupportedCloudServiceSkusQueryParamProperties;
|
||||
}
|
||||
|
||||
export type LocationListSupportedCloudServiceSkusParameters =
|
||||
LocationListSupportedCloudServiceSkusQueryParam & RequestParameters;
|
||||
export type LocationListSupportedCloudServiceSkusParameters = LocationListSupportedCloudServiceSkusQueryParam &
|
||||
RequestParameters;
|
||||
|
||||
export interface LocationCheckNameAvailabilityBodyParam {
|
||||
/** Properties needed to check the availability of a name. */
|
||||
body: CheckNameAvailabilityParameters;
|
||||
/** Properties needed to check the availability of a name. */
|
||||
body: CheckNameAvailabilityParameters;
|
||||
}
|
||||
|
||||
export interface LocationCheckNameAvailabilityMediaTypesParam {
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
}
|
||||
|
||||
export type LocationCheckNameAvailabilityParameters =
|
||||
LocationCheckNameAvailabilityMediaTypesParam &
|
||||
LocationCheckNameAvailabilityBodyParam &
|
||||
RequestParameters;
|
||||
export type LocationCheckNameAvailabilityParameters = LocationCheckNameAvailabilityMediaTypesParam &
|
||||
LocationCheckNameAvailabilityBodyParam &
|
||||
RequestParameters;
|
||||
export type OperationsListParameters = RequestParameters;
|
||||
|
||||
export interface CertificateListByBatchAccountQueryParamProperties {
|
||||
/** The maximum number of items to return in the response. */
|
||||
maxresults?: number;
|
||||
/** Comma separated list of properties that should be returned. e.g. "properties/provisioningState". Only top level properties under properties/ are valid for selection. */
|
||||
$select?: string;
|
||||
/** OData filter expression. Valid properties for filtering are "properties/provisioningState", "properties/provisioningStateTransitionTime", "name". */
|
||||
$filter?: string;
|
||||
/** The maximum number of items to return in the response. */
|
||||
maxresults?: number;
|
||||
/** Comma separated list of properties that should be returned. e.g. "properties/provisioningState". Only top level properties under properties/ are valid for selection. */
|
||||
$select?: string;
|
||||
/** OData filter expression. Valid properties for filtering are "properties/provisioningState", "properties/provisioningStateTransitionTime", "name". */
|
||||
$filter?: string;
|
||||
}
|
||||
|
||||
export interface CertificateListByBatchAccountQueryParam {
|
||||
queryParameters?: CertificateListByBatchAccountQueryParamProperties;
|
||||
queryParameters?: CertificateListByBatchAccountQueryParamProperties;
|
||||
}
|
||||
|
||||
export type CertificateListByBatchAccountParameters =
|
||||
CertificateListByBatchAccountQueryParam & RequestParameters;
|
||||
export type CertificateListByBatchAccountParameters = CertificateListByBatchAccountQueryParam &
|
||||
RequestParameters;
|
||||
|
||||
export interface CertificateCreateHeaders {
|
||||
/** The entity state (ETag) version of the certificate to update. A value of "*" can be used to apply the operation only if the certificate already exists. If omitted, this operation will always be applied. */
|
||||
"If-Match"?: string;
|
||||
/** Set to '*' to allow a new certificate to be created, but to prevent updating an existing certificate. Other values will be ignored. */
|
||||
"If-None-Match"?: string;
|
||||
/** The entity state (ETag) version of the certificate to update. A value of "*" can be used to apply the operation only if the certificate already exists. If omitted, this operation will always be applied. */
|
||||
"If-Match"?: string;
|
||||
/** Set to '*' to allow a new certificate to be created, but to prevent updating an existing certificate. Other values will be ignored. */
|
||||
"If-None-Match"?: string;
|
||||
}
|
||||
|
||||
export interface CertificateCreateBodyParam {
|
||||
/** Additional parameters for certificate creation. */
|
||||
body: CertificateCreateOrUpdateParameters;
|
||||
/** Additional parameters for certificate creation. */
|
||||
body: CertificateCreateOrUpdateParameters;
|
||||
}
|
||||
|
||||
export interface CertificateCreateHeaderParam {
|
||||
headers: RawHttpHeadersInput & CertificateCreateHeaders;
|
||||
headers: RawHttpHeadersInput & CertificateCreateHeaders;
|
||||
}
|
||||
|
||||
export interface CertificateCreateMediaTypesParam {
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
}
|
||||
|
||||
export type CertificateCreateParameters = CertificateCreateHeaderParam &
|
||||
CertificateCreateMediaTypesParam &
|
||||
CertificateCreateBodyParam &
|
||||
RequestParameters;
|
||||
CertificateCreateMediaTypesParam &
|
||||
CertificateCreateBodyParam &
|
||||
RequestParameters;
|
||||
|
||||
export interface CertificateUpdateHeaders {
|
||||
/** The entity state (ETag) version of the certificate to update. This value can be omitted or set to "*" to apply the operation unconditionally. */
|
||||
"If-Match"?: string;
|
||||
/** The entity state (ETag) version of the certificate to update. This value can be omitted or set to "*" to apply the operation unconditionally. */
|
||||
"If-Match"?: string;
|
||||
}
|
||||
|
||||
export interface CertificateUpdateBodyParam {
|
||||
/** Certificate entity to update. */
|
||||
body: CertificateCreateOrUpdateParameters;
|
||||
/** Certificate entity to update. */
|
||||
body: CertificateCreateOrUpdateParameters;
|
||||
}
|
||||
|
||||
export interface CertificateUpdateHeaderParam {
|
||||
headers: RawHttpHeadersInput & CertificateUpdateHeaders;
|
||||
headers: RawHttpHeadersInput & CertificateUpdateHeaders;
|
||||
}
|
||||
|
||||
export interface CertificateUpdateMediaTypesParam {
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
}
|
||||
|
||||
export type CertificateUpdateParameters = CertificateUpdateHeaderParam &
|
||||
CertificateUpdateMediaTypesParam &
|
||||
CertificateUpdateBodyParam &
|
||||
RequestParameters;
|
||||
CertificateUpdateMediaTypesParam &
|
||||
CertificateUpdateBodyParam &
|
||||
RequestParameters;
|
||||
export type CertificateDeleteParameters = RequestParameters;
|
||||
export type CertificateGetParameters = RequestParameters;
|
||||
export type CertificateCancelDeletionParameters = RequestParameters;
|
||||
|
||||
export interface PrivateLinkResourceListByBatchAccountQueryParamProperties {
|
||||
/** The maximum number of items to return in the response. */
|
||||
maxresults?: number;
|
||||
/** The maximum number of items to return in the response. */
|
||||
maxresults?: number;
|
||||
}
|
||||
|
||||
export interface PrivateLinkResourceListByBatchAccountQueryParam {
|
||||
queryParameters?: PrivateLinkResourceListByBatchAccountQueryParamProperties;
|
||||
queryParameters?: PrivateLinkResourceListByBatchAccountQueryParamProperties;
|
||||
}
|
||||
|
||||
export type PrivateLinkResourceListByBatchAccountParameters =
|
||||
PrivateLinkResourceListByBatchAccountQueryParam & RequestParameters;
|
||||
export type PrivateLinkResourceListByBatchAccountParameters = PrivateLinkResourceListByBatchAccountQueryParam &
|
||||
RequestParameters;
|
||||
export type PrivateLinkResourceGetParameters = RequestParameters;
|
||||
|
||||
export interface PrivateEndpointConnectionListByBatchAccountQueryParamProperties {
|
||||
/** The maximum number of items to return in the response. */
|
||||
maxresults?: number;
|
||||
/** The maximum number of items to return in the response. */
|
||||
maxresults?: number;
|
||||
}
|
||||
|
||||
export interface PrivateEndpointConnectionListByBatchAccountQueryParam {
|
||||
queryParameters?: PrivateEndpointConnectionListByBatchAccountQueryParamProperties;
|
||||
queryParameters?: PrivateEndpointConnectionListByBatchAccountQueryParamProperties;
|
||||
}
|
||||
|
||||
export type PrivateEndpointConnectionListByBatchAccountParameters =
|
||||
PrivateEndpointConnectionListByBatchAccountQueryParam & RequestParameters;
|
||||
export type PrivateEndpointConnectionListByBatchAccountParameters = PrivateEndpointConnectionListByBatchAccountQueryParam &
|
||||
RequestParameters;
|
||||
export type PrivateEndpointConnectionGetParameters = RequestParameters;
|
||||
|
||||
export interface PrivateEndpointConnectionUpdateHeaders {
|
||||
/** The state (ETag) version of the private endpoint connection to update. This value can be omitted or set to "*" to apply the operation unconditionally. */
|
||||
"If-Match"?: string;
|
||||
/** The state (ETag) version of the private endpoint connection to update. This value can be omitted or set to "*" to apply the operation unconditionally. */
|
||||
"If-Match"?: string;
|
||||
}
|
||||
|
||||
export interface PrivateEndpointConnectionUpdateBodyParam {
|
||||
/** PrivateEndpointConnection properties that should be updated. Properties that are supplied will be updated, any property not supplied will be unchanged. */
|
||||
body: PrivateEndpointConnection;
|
||||
/** PrivateEndpointConnection properties that should be updated. Properties that are supplied will be updated, any property not supplied will be unchanged. */
|
||||
body: PrivateEndpointConnection;
|
||||
}
|
||||
|
||||
export interface PrivateEndpointConnectionUpdateHeaderParam {
|
||||
headers: RawHttpHeadersInput & PrivateEndpointConnectionUpdateHeaders;
|
||||
headers: RawHttpHeadersInput & PrivateEndpointConnectionUpdateHeaders;
|
||||
}
|
||||
|
||||
export interface PrivateEndpointConnectionUpdateMediaTypesParam {
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
}
|
||||
|
||||
export type PrivateEndpointConnectionUpdateParameters =
|
||||
PrivateEndpointConnectionUpdateHeaderParam &
|
||||
PrivateEndpointConnectionUpdateMediaTypesParam &
|
||||
PrivateEndpointConnectionUpdateBodyParam &
|
||||
RequestParameters;
|
||||
export type PrivateEndpointConnectionUpdateParameters = PrivateEndpointConnectionUpdateHeaderParam &
|
||||
PrivateEndpointConnectionUpdateMediaTypesParam &
|
||||
PrivateEndpointConnectionUpdateBodyParam &
|
||||
RequestParameters;
|
||||
export type PrivateEndpointConnectionDeleteParameters = RequestParameters;
|
||||
|
||||
export interface PoolListByBatchAccountQueryParamProperties {
|
||||
/** The maximum number of items to return in the response. */
|
||||
maxresults?: number;
|
||||
/** Comma separated list of properties that should be returned. e.g. "properties/provisioningState". Only top level properties under properties/ are valid for selection. */
|
||||
$select?: string;
|
||||
/**
|
||||
* OData filter expression. Valid properties for filtering are:
|
||||
*
|
||||
* name
|
||||
* properties/allocationState
|
||||
* properties/allocationStateTransitionTime
|
||||
* properties/creationTime
|
||||
* properties/provisioningState
|
||||
* properties/provisioningStateTransitionTime
|
||||
* properties/lastModified
|
||||
* properties/vmSize
|
||||
* properties/interNodeCommunication
|
||||
* properties/scaleSettings/autoScale
|
||||
* properties/scaleSettings/fixedScale
|
||||
*/
|
||||
$filter?: string;
|
||||
/** The maximum number of items to return in the response. */
|
||||
maxresults?: number;
|
||||
/** Comma separated list of properties that should be returned. e.g. "properties/provisioningState". Only top level properties under properties/ are valid for selection. */
|
||||
$select?: string;
|
||||
/**
|
||||
* OData filter expression. Valid properties for filtering are:
|
||||
*
|
||||
* name
|
||||
* properties/allocationState
|
||||
* properties/allocationStateTransitionTime
|
||||
* properties/creationTime
|
||||
* properties/provisioningState
|
||||
* properties/provisioningStateTransitionTime
|
||||
* properties/lastModified
|
||||
* properties/vmSize
|
||||
* properties/interNodeCommunication
|
||||
* properties/scaleSettings/autoScale
|
||||
* properties/scaleSettings/fixedScale
|
||||
*/
|
||||
$filter?: string;
|
||||
}
|
||||
|
||||
export interface PoolListByBatchAccountQueryParam {
|
||||
queryParameters?: PoolListByBatchAccountQueryParamProperties;
|
||||
queryParameters?: PoolListByBatchAccountQueryParamProperties;
|
||||
}
|
||||
|
||||
export type PoolListByBatchAccountParameters =
|
||||
PoolListByBatchAccountQueryParam & RequestParameters;
|
||||
export type PoolListByBatchAccountParameters = PoolListByBatchAccountQueryParam &
|
||||
RequestParameters;
|
||||
|
||||
export interface PoolCreateHeaders {
|
||||
/** The entity state (ETag) version of the pool to update. A value of "*" can be used to apply the operation only if the pool already exists. If omitted, this operation will always be applied. */
|
||||
"If-Match"?: string;
|
||||
/** Set to '*' to allow a new pool to be created, but to prevent updating an existing pool. Other values will be ignored. */
|
||||
"If-None-Match"?: string;
|
||||
/** The entity state (ETag) version of the pool to update. A value of "*" can be used to apply the operation only if the pool already exists. If omitted, this operation will always be applied. */
|
||||
"If-Match"?: string;
|
||||
/** Set to '*' to allow a new pool to be created, but to prevent updating an existing pool. Other values will be ignored. */
|
||||
"If-None-Match"?: string;
|
||||
}
|
||||
|
||||
export interface PoolCreateBodyParam {
|
||||
/** Additional parameters for pool creation. */
|
||||
body: Pool;
|
||||
/** Additional parameters for pool creation. */
|
||||
body: Pool;
|
||||
}
|
||||
|
||||
export interface PoolCreateHeaderParam {
|
||||
headers: RawHttpHeadersInput & PoolCreateHeaders;
|
||||
headers: RawHttpHeadersInput & PoolCreateHeaders;
|
||||
}
|
||||
|
||||
export interface PoolCreateMediaTypesParam {
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
}
|
||||
|
||||
export type PoolCreateParameters = PoolCreateHeaderParam &
|
||||
PoolCreateMediaTypesParam &
|
||||
PoolCreateBodyParam &
|
||||
RequestParameters;
|
||||
PoolCreateMediaTypesParam &
|
||||
PoolCreateBodyParam &
|
||||
RequestParameters;
|
||||
|
||||
export interface PoolUpdateHeaders {
|
||||
/** The entity state (ETag) version of the pool to update. This value can be omitted or set to "*" to apply the operation unconditionally. */
|
||||
"If-Match"?: string;
|
||||
/** The entity state (ETag) version of the pool to update. This value can be omitted or set to "*" to apply the operation unconditionally. */
|
||||
"If-Match"?: string;
|
||||
}
|
||||
|
||||
export interface PoolUpdateBodyParam {
|
||||
/** Pool properties that should be updated. Properties that are supplied will be updated, any property not supplied will be unchanged. */
|
||||
body: Pool;
|
||||
/** Pool properties that should be updated. Properties that are supplied will be updated, any property not supplied will be unchanged. */
|
||||
body: Pool;
|
||||
}
|
||||
|
||||
export interface PoolUpdateHeaderParam {
|
||||
headers: RawHttpHeadersInput & PoolUpdateHeaders;
|
||||
headers: RawHttpHeadersInput & PoolUpdateHeaders;
|
||||
}
|
||||
|
||||
export interface PoolUpdateMediaTypesParam {
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
/** Request content type */
|
||||
contentType?: "application/json";
|
||||
}
|
||||
|
||||
export type PoolUpdateParameters = PoolUpdateHeaderParam &
|
||||
PoolUpdateMediaTypesParam &
|
||||
PoolUpdateBodyParam &
|
||||
RequestParameters;
|
||||
PoolUpdateMediaTypesParam &
|
||||
PoolUpdateBodyParam &
|
||||
RequestParameters;
|
||||
export type PoolDeleteParameters = RequestParameters;
|
||||
export type PoolGetParameters = RequestParameters;
|
||||
export type PoolDisableAutoScaleParameters = RequestParameters;
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
|
||||
import { Client, HttpResponse } from "@azure-rest/core-client";
|
||||
import {
|
||||
LongRunningOperation,
|
||||
LroEngine,
|
||||
LroEngineOptions,
|
||||
LroResponse,
|
||||
PollerLike,
|
||||
PollOperationState,
|
||||
LongRunningOperation,
|
||||
LroEngine,
|
||||
LroEngineOptions,
|
||||
LroResponse,
|
||||
PollerLike,
|
||||
PollOperationState
|
||||
} from "@azure/core-lro";
|
||||
|
||||
/**
|
||||
|
@ -19,35 +19,35 @@ import {
|
|||
* @returns - A poller object to poll for operation state updates and eventually get the final response.
|
||||
*/
|
||||
export function getLongRunningPoller<TResult extends HttpResponse>(
|
||||
client: Client,
|
||||
initialResponse: TResult,
|
||||
options: LroEngineOptions<TResult, PollOperationState<TResult>> = {}
|
||||
client: Client,
|
||||
initialResponse: TResult,
|
||||
options: LroEngineOptions<TResult, PollOperationState<TResult>> = {}
|
||||
): PollerLike<PollOperationState<TResult>, TResult> {
|
||||
const poller: LongRunningOperation<TResult> = {
|
||||
requestMethod: initialResponse.request.method,
|
||||
requestPath: initialResponse.request.url,
|
||||
sendInitialRequest: async () => {
|
||||
// In the case of Rest Clients we are building the LRO poller object from a response that's the reason
|
||||
// we are not triggering the initial request here, just extracting the information from the
|
||||
// response we were provided.
|
||||
return getLroResponse(initialResponse);
|
||||
},
|
||||
sendPollRequest: async (path) => {
|
||||
// This is the callback that is going to be called to poll the service
|
||||
// to get the latest status. We use the client provided and the polling path
|
||||
// which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location
|
||||
// depending on the lro pattern that the service implements. If non is provided we default to the initial path.
|
||||
const response = await client
|
||||
.pathUnchecked(path ?? initialResponse.request.url)
|
||||
.get();
|
||||
const lroResponse = getLroResponse(response as TResult);
|
||||
lroResponse.rawResponse.headers["x-ms-original-url"] =
|
||||
initialResponse.request.url;
|
||||
return lroResponse;
|
||||
},
|
||||
};
|
||||
const poller: LongRunningOperation<TResult> = {
|
||||
requestMethod: initialResponse.request.method,
|
||||
requestPath: initialResponse.request.url,
|
||||
sendInitialRequest: async () => {
|
||||
// In the case of Rest Clients we are building the LRO poller object from a response that's the reason
|
||||
// we are not triggering the initial request here, just extracting the information from the
|
||||
// response we were provided.
|
||||
return getLroResponse(initialResponse);
|
||||
},
|
||||
sendPollRequest: async (path) => {
|
||||
// This is the callback that is going to be called to poll the service
|
||||
// to get the latest status. We use the client provided and the polling path
|
||||
// which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location
|
||||
// depending on the lro pattern that the service implements. If non is provided we default to the initial path.
|
||||
const response = await client
|
||||
.pathUnchecked(path ?? initialResponse.request.url)
|
||||
.get();
|
||||
const lroResponse = getLroResponse(response as TResult);
|
||||
lroResponse.rawResponse.headers["x-ms-original-url"] =
|
||||
initialResponse.request.url;
|
||||
return lroResponse;
|
||||
}
|
||||
};
|
||||
|
||||
return new LroEngine(poller, options);
|
||||
return new LroEngine(poller, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,20 +56,20 @@ export function getLongRunningPoller<TResult extends HttpResponse>(
|
|||
* @returns - An LRO response that the LRO engine can work with
|
||||
*/
|
||||
function getLroResponse<TResult extends HttpResponse>(
|
||||
response: TResult
|
||||
response: TResult
|
||||
): LroResponse<TResult> {
|
||||
if (Number.isNaN(response.status)) {
|
||||
throw new TypeError(
|
||||
`Status code of the response is not a number. Value: ${response.status}`
|
||||
);
|
||||
}
|
||||
if (Number.isNaN(response.status)) {
|
||||
throw new TypeError(
|
||||
`Status code of the response is not a number. Value: ${response.status}`
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
flatResponse: response,
|
||||
rawResponse: {
|
||||
...response,
|
||||
statusCode: Number.parseInt(response.status),
|
||||
body: response.body,
|
||||
},
|
||||
};
|
||||
return {
|
||||
flatResponse: response,
|
||||
rawResponse: {
|
||||
...response,
|
||||
statusCode: Number.parseInt(response.status),
|
||||
body: response.body
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -14,7 +14,7 @@ generate-sample: false
|
|||
license-header: MICROSOFT_MIT_NO_VERSION
|
||||
output-folder: ../
|
||||
source-code-folder-path: ./src/generated
|
||||
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/BatchManagement.json
|
||||
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/batch/resource-manager/Microsoft.Batch/stable/2023-05-01/BatchManagement.json
|
||||
package-version: 1.0.0-beta.1
|
||||
rest-level-client: true
|
||||
add-credentials: true
|
||||
|
|
Загрузка…
Ссылка в новой задаче