ZiWei Chen 2024-10-24 14:48:42 +08:00 коммит произвёл GitHub
Родитель 1880a2f475
Коммит cae1265f1a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
68 изменённых файлов: 6648 добавлений и 10678 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,7 +1,7 @@
# Release History
## 1.0.0-beta.1 (2024-07-22)
## 1.0.0 (2024-10-21)
### Features Added
Initial release of the Azure Compute Fleet package
This is the first stable version with the package of @azure/arm-computefleet.

Просмотреть файл

@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "js",
"TagPrefix": "js/computefleet/arm-computefleet",
"Tag": "js/computefleet/arm-computefleet_e84d79a3e6"
"Tag": "js/computefleet/arm-computefleet_d190f033a9"
}

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "@azure/arm-computefleet",
"version": "1.0.0-beta.1",
"version": "1.0.0",
"description": "Azure Fleet Service",
"engines": {
"node": ">=18.0.0"
@ -11,7 +11,6 @@
"exports": {
"./package.json": "./package.json",
".": "./src/index.ts",
"./api": "./src/api/index.ts",
"./models": "./src/models/index.ts"
},
"dialects": [
@ -51,116 +50,112 @@
"//metadata": {
"constantPaths": [
{
"path": "src/rest/azureFleetClient.ts",
"path": "src/api/azureFleetContext.ts",
"prefix": "userAgentInfo"
}
]
},
"dependencies": {
"@azure/core-util": "^1.9.2",
"@azure-rest/core-client": "^2.1.0",
"@azure/abort-controller": "^2.1.2",
"@azure/core-auth": "^1.6.0",
"@azure/core-lro": "^3.0.0",
"@azure/core-paging": "^1.5.0",
"@azure/core-rest-pipeline": "^1.5.0",
"@azure/logger": "^1.0.0",
"tslib": "^2.6.2"
"tslib": "^2.6.2",
"@azure/core-lro": "^3.1.0",
"@azure/abort-controller": "^2.1.2"
},
"devDependencies": {
"@azure-tools/test-credential": "^2.0.0",
"@azure-tools/test-recorder": "^4.0.0",
"@azure/core-util": "^1.0.0",
"@azure/dev-tool": "^1.0.0",
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
"@azure/identity": "^4.2.1",
"dotenv": "^16.0.0",
"@types/node": "^18.0.0",
"eslint": "^8.55.0",
"typescript": "~5.6.2",
"tshy": "^1.11.1",
"@azure/identity": "^4.2.1",
"@vitest/browser": "^2.0.5",
"@vitest/coverage-istanbul": "^2.0.5",
"dotenv": "^16.0.0",
"eslint": "^9.9.0",
"playwright": "^1.41.2",
"prettier": "^3.2.5",
"typescript": "~5.6.2",
"vitest": "^2.0.5"
"vitest": "^2.0.5",
"@azure-tools/test-credential": "^2.0.0",
"@azure-tools/test-recorder": "^4.0.0",
"@azure/dev-tool": "^1.0.0",
"@azure/eslint-plugin-azure-sdk": "^3.0.0"
},
"scripts": {
"audit": "node ../../../common/scripts/rush-audit.js && dev-tool run vendored rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
"build": "npm run clean && dev-tool run build-package && dev-tool run vendored mkdirp ./review && dev-tool run extract-api",
"build:samples": "echo skipped",
"build:test": "npm run clean && dev-tool run build-package && dev-tool run build-test",
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"",
"clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
"execute:samples": "echo skipped",
"extract-api": "dev-tool run vendored rimraf review && dev-tool run vendored mkdirp ./review && dev-tool run extract-api",
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"",
"generate:client": "echo skipped",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"integration-test:browser": "echo skipped",
"integration-test:node": "echo skipped",
"extract-api": "dev-tool run vendored rimraf review && mkdirp ./review && dev-tool run extract-api",
"pack": "npm pack 2>&1",
"lint": "echo skipped",
"lint:fix": "echo skipped",
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js",
"pack": "npm pack 2>&1",
"test": "npm run clean && dev-tool run build-package && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test",
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser",
"test:node": "npm run clean && dev-tool run build-package && npm run unit-test:node && npm run integration-test:node",
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
"unit-test:browser": "npm run build:test && dev-tool run test:vitest --browser",
"unit-test:node": "dev-tool run test:vitest",
"update-snippets": "echo skipped"
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"integration-test:browser": "echo skipped",
"integration-test:node": "echo skipped",
"audit": "node ../../../common/scripts/rush-audit.js && dev-tool run vendored rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
"build:samples": "dev-tool run typecheck --paths samples-dev/*.ts && dev-tool samples publish -f",
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"",
"execute:samples": "dev-tool samples run samples-dev",
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"",
"generate:client": "echo skipped",
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser",
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js",
"build:test": "npm run clean && tshy && dev-tool run build-test",
"build": "npm run clean && tshy && dev-tool run vendored mkdirp ./review && dev-tool run extract-api",
"test:node": "npm run clean && tshy && npm run unit-test:node && npm run integration-test:node",
"test": "npm run clean && tshy && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test"
},
"//sampleConfiguration": {
"productName": "@azure/arm-computefleet",
"productSlugs": [
"azure"
],
"disableDocsMs": true,
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-computefleet?view=azure-node-preview"
},
"exports": {
"./package.json": "./package.json",
".": {
"browser": {
"source": "./src/index.ts",
"types": "./dist/browser/index.d.ts",
"default": "./dist/browser/index.js"
},
"react-native": {
"source": "./src/index.ts",
"types": "./dist/react-native/index.d.ts",
"default": "./dist/react-native/index.js"
},
"import": {
"source": "./src/index.ts",
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"source": "./src/index.ts",
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
},
"./api": {
"browser": {
"types": "./dist/browser/api/index.d.ts",
"default": "./dist/browser/api/index.js"
},
"react-native": {
"types": "./dist/react-native/api/index.d.ts",
"default": "./dist/react-native/api/index.js"
},
"import": {
"types": "./dist/esm/api/index.d.ts",
"default": "./dist/esm/api/index.js"
},
"require": {
"types": "./dist/commonjs/api/index.d.ts",
"default": "./dist/commonjs/api/index.js"
}
},
"./models": {
"browser": {
"source": "./src/models/index.ts",
"types": "./dist/browser/models/index.d.ts",
"default": "./dist/browser/models/index.js"
},
"react-native": {
"source": "./src/models/index.ts",
"types": "./dist/react-native/models/index.d.ts",
"default": "./dist/react-native/models/index.js"
},
"import": {
"source": "./src/models/index.ts",
"types": "./dist/esm/models/index.d.ts",
"default": "./dist/esm/models/index.js"
},
"require": {
"source": "./src/models/index.ts",
"types": "./dist/commonjs/models/index.d.ts",
"default": "./dist/commonjs/models/index.js"
}

Просмотреть файл

@ -4,11 +4,26 @@
```ts
import { OperationOptions } from '@azure-rest/core-client';
// @public
export type AcceleratorManufacturer = string;
// @public
export type AcceleratorType = string;
// @public
export type ActionType = string;
// @public
export interface AdditionalCapabilities {
hibernationEnabled?: boolean;
ultraSSDEnabled?: boolean;
}
// @public
export interface AdditionalLocationsProfile {
locationProfiles: LocationProfile[];
}
// @public
export interface AdditionalUnattendContent {
componentName?: "Microsoft-Windows-Shell-Setup";
@ -43,6 +58,9 @@ export interface ApplicationProfile {
galleryApplications?: VMGalleryApplication[];
}
// @public
export type ArchitectureType = string;
// @public
export interface BaseVirtualMachineProfile {
applicationProfile?: ApplicationProfile;
@ -78,15 +96,14 @@ export interface CapacityReservationProfile {
// @public
export interface ComputeProfile {
additionalVirtualMachineCapabilities?: AdditionalCapabilities;
baseVirtualMachineProfile: BaseVirtualMachineProfile;
computeApiVersion?: string;
platformFaultDomainCount?: number;
}
// @public
export type ContinuablePage<TElement, TPage = TElement[]> = TPage & {
continuationToken?: string;
};
export type CpuManufacturer = string;
// @public
export type CreatedByType = string;
@ -133,26 +150,6 @@ export interface EncryptionIdentity {
userAssignedIdentityResourceId?: string;
}
// @public
export interface ErrorAdditionalInfo {
readonly info?: Record<string, any>;
readonly type?: string;
}
// @public
export interface ErrorDetail {
readonly additionalInfo?: ErrorAdditionalInfo[];
readonly code?: string;
readonly details?: ErrorDetail[];
readonly message?: string;
readonly target?: string;
}
// @public
export interface ErrorResponse {
error?: ErrorDetail;
}
// @public
export type EvictionPolicy = string;
@ -166,46 +163,17 @@ export interface Fleet extends TrackedResource {
// @public
export interface FleetProperties {
additionalLocationsProfile?: AdditionalLocationsProfile;
computeProfile: ComputeProfile;
readonly provisioningState?: ProvisioningState;
regularPriorityProfile?: RegularPriorityProfile;
spotPriorityProfile?: SpotPriorityProfile;
readonly timeCreated?: Date;
readonly uniqueId?: string;
vmAttributes?: VMAttributes;
vmSizesProfile: VmSizeProfile[];
}
// @public
export interface FleetsCreateOrUpdateOptionalParams extends OperationOptions {
updateIntervalInMs?: number;
}
// @public
export interface FleetsDeleteOptionalParams extends OperationOptions {
updateIntervalInMs?: number;
}
// @public
export interface FleetsGetOptionalParams extends OperationOptions {
}
// @public
export interface FleetsListByResourceGroupOptionalParams extends OperationOptions {
}
// @public
export interface FleetsListBySubscriptionOptionalParams extends OperationOptions {
}
// @public
export interface FleetsListVirtualMachineScaleSetsOptionalParams extends OperationOptions {
}
// @public
export interface FleetsUpdateOptionalParams extends OperationOptions {
updateIntervalInMs?: number;
}
// @public
export interface FleetUpdate {
identity?: ManagedServiceIdentityUpdate;
@ -241,11 +209,30 @@ export interface KeyVaultSecretReference {
sourceVault: SubResource;
}
// @public
export enum KnownAcceleratorManufacturer {
AMD = "AMD",
Nvidia = "Nvidia",
Xilinx = "Xilinx"
}
// @public
export enum KnownAcceleratorType {
FPGA = "FPGA",
GPU = "GPU"
}
// @public
export enum KnownActionType {
Internal = "Internal"
}
// @public
export enum KnownArchitectureType {
ARM64 = "ARM64",
X64 = "X64"
}
// @public
export enum KnownCachingTypes {
None = "None",
@ -253,6 +240,14 @@ export enum KnownCachingTypes {
ReadWrite = "ReadWrite"
}
// @public
export enum KnownCpuManufacturer {
AMD = "AMD",
Ampere = "Ampere",
Intel = "Intel",
Microsoft = "Microsoft"
}
// @public
export enum KnownCreatedByType {
Application = "Application",
@ -340,11 +335,17 @@ export enum KnownLinuxVMGuestPatchMode {
ImageDefault = "ImageDefault"
}
// @public
export enum KnownLocalStorageDiskType {
HDD = "HDD",
SSD = "SSD"
}
// @public
export enum KnownManagedServiceIdentityType {
"SystemAssigned,UserAssigned" = "SystemAssigned,UserAssigned",
None = "None",
SystemAssigned = "SystemAssigned",
SystemAssignedUserAssigned = "SystemAssigned,UserAssigned",
UserAssigned = "UserAssigned"
}
@ -356,7 +357,7 @@ export enum KnownMode {
// @public
export enum KnownNetworkApiVersion {
"2020-11-01" = "2020-11-01"
V20201101 = "2020-11-01"
}
// @public
@ -383,9 +384,9 @@ export enum KnownOperatingSystemTypes {
// @public
export enum KnownOrigin {
"user,system" = "user,system",
system = "system",
user = "user"
System = "system",
User = "user",
UserSystem = "user,system"
}
// @public
@ -394,6 +395,17 @@ export enum KnownProtocolTypes {
Https = "Https"
}
// @public
export enum KnownProvisioningState {
Canceled = "Canceled",
Creating = "Creating",
Deleting = "Deleting",
Failed = "Failed",
Migrating = "Migrating",
Succeeded = "Succeeded",
Updating = "Updating"
}
// @public
export enum KnownPublicIPAddressSkuName {
Basic = "Basic",
@ -412,13 +424,6 @@ export enum KnownRegularPriorityAllocationStrategy {
Prioritized = "Prioritized"
}
// @public
export enum KnownResourceProvisioningState {
Canceled = "Canceled",
Failed = "Failed",
Succeeded = "Succeeded"
}
// @public
export enum KnownSecurityEncryptionTypes {
DiskWithVMGuestState = "DiskWithVMGuestState",
@ -447,13 +452,31 @@ export enum KnownSpotAllocationStrategy {
// @public
export enum KnownStorageAccountTypes {
Premium_LRS = "Premium_LRS",
Premium_ZRS = "Premium_ZRS",
PremiumV2_LRS = "PremiumV2_LRS",
Standard_LRS = "Standard_LRS",
StandardSSD_LRS = "StandardSSD_LRS",
StandardSSD_ZRS = "StandardSSD_ZRS",
UltraSSD_LRS = "UltraSSD_LRS"
PremiumLRS = "Premium_LRS",
PremiumV2LRS = "PremiumV2_LRS",
PremiumZRS = "Premium_ZRS",
StandardLRS = "Standard_LRS",
StandardSSDLRS = "StandardSSD_LRS",
StandardSSDZRS = "StandardSSD_ZRS",
UltraSSDLRS = "UltraSSD_LRS"
}
// @public
export enum KnownVMAttributeSupport {
Excluded = "Excluded",
Included = "Included",
Required = "Required"
}
// @public
export enum KnownVMCategory {
ComputeOptimized = "ComputeOptimized",
FpgaAccelerated = "FpgaAccelerated",
GeneralPurpose = "GeneralPurpose",
GpuAccelerated = "GpuAccelerated",
HighPerformanceCompute = "HighPerformanceCompute",
MemoryOptimized = "MemoryOptimized",
StorageOptimized = "StorageOptimized"
}
// @public
@ -508,6 +531,15 @@ export interface LinuxVMGuestPatchAutomaticByPlatformSettings {
// @public
export type LinuxVMGuestPatchMode = string;
// @public
export type LocalStorageDiskType = string;
// @public
export interface LocationProfile {
location: string;
virtualMachineProfileOverride?: BaseVirtualMachineProfile;
}
// @public
export interface ManagedServiceIdentity {
readonly principalId?: string;
@ -557,10 +589,6 @@ export interface OperationDisplay {
readonly resource?: string;
}
// @public
export interface OperationsListOptionalParams extends OperationOptions {
}
// @public
export type Origin = string;
@ -570,18 +598,6 @@ export interface OSImageNotificationProfile {
notBeforeTimeout?: string;
}
// @public
export interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings extends PageSettings = PageSettings> {
[Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;
byPage: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;
next(): Promise<IteratorResult<TElement>>;
}
// @public
export interface PageSettings {
continuationToken?: string;
}
// @public
export interface PatchSettings {
assessmentMode?: WindowsPatchAssessmentMode;
@ -603,7 +619,7 @@ export interface Plan {
export type ProtocolTypes = string;
// @public
export type ProvisioningState = string | ResourceProvisioningState | "Creating" | "Updating" | "Deleting" | "Migrating";
export type ProvisioningState = string;
// @public
export interface ProxyAgentSettings {
@ -651,9 +667,6 @@ export interface ResourcePlanUpdate {
version?: string;
}
// @public
export type ResourceProvisioningState = string;
// @public
export interface ScheduledEventsProfile {
osImageNotificationProfile?: OSImageNotificationProfile;
@ -768,9 +781,6 @@ export interface VaultSecretGroup {
vaultCertificates?: VaultCertificate[];
}
// @public
export type Versions = "2023-11-01-preview" | "2024-05-01-preview";
// @public
export interface VirtualHardDisk {
uri?: string;
@ -956,6 +966,48 @@ export interface VirtualMachineScaleSetStorageProfile {
osDisk?: VirtualMachineScaleSetOSDisk;
}
// @public
export interface VMAttributeMinMaxDouble {
max?: number;
min?: number;
}
// @public
export interface VMAttributeMinMaxInteger {
max?: number;
min?: number;
}
// @public
export interface VMAttributes {
acceleratorCount?: VMAttributeMinMaxInteger;
acceleratorManufacturers?: AcceleratorManufacturer[];
acceleratorSupport?: VMAttributeSupport;
acceleratorTypes?: AcceleratorType[];
architectureTypes?: ArchitectureType[];
burstableSupport?: VMAttributeSupport;
cpuManufacturers?: CpuManufacturer[];
dataDiskCount?: VMAttributeMinMaxInteger;
excludedVMSizes?: string[];
localStorageDiskTypes?: LocalStorageDiskType[];
localStorageInGiB?: VMAttributeMinMaxDouble;
localStorageSupport?: VMAttributeSupport;
memoryInGiB: VMAttributeMinMaxDouble;
memoryInGiBPerVCpu?: VMAttributeMinMaxDouble;
networkBandwidthInMbps?: VMAttributeMinMaxDouble;
networkInterfaceCount?: VMAttributeMinMaxInteger;
rdmaNetworkInterfaceCount?: VMAttributeMinMaxInteger;
rdmaSupport?: VMAttributeSupport;
vCpuCount: VMAttributeMinMaxInteger;
vmCategories?: VMCategory[];
}
// @public
export type VMAttributeSupport = string;
// @public
export type VMCategory = string;
// @public
export interface VMDiskSecurityProfile {
diskEncryptionSet?: DiskEncryptionSetParameters;

Просмотреть файл

@ -13,9 +13,26 @@ import { Pipeline } from '@azure/core-rest-pipeline';
import { PollerLike } from '@azure/core-lro';
import { TokenCredential } from '@azure/core-auth';
// @public
export type AcceleratorManufacturer = string;
// @public
export type AcceleratorType = string;
// @public
export type ActionType = string;
// @public
export interface AdditionalCapabilities {
hibernationEnabled?: boolean;
ultraSSDEnabled?: boolean;
}
// @public
export interface AdditionalLocationsProfile {
locationProfiles: LocationProfile[];
}
// @public
export interface AdditionalUnattendContent {
componentName?: "Microsoft-Windows-Shell-Setup";
@ -50,6 +67,9 @@ export interface ApplicationProfile {
galleryApplications?: VMGalleryApplication[];
}
// @public
export type ArchitectureType = string;
// @public (undocumented)
export class AzureFleetClient {
constructor(credential: TokenCredential, subscriptionId: string, options?: AzureFleetClientOptionalParams);
@ -98,6 +118,7 @@ export interface CapacityReservationProfile {
// @public
export interface ComputeProfile {
additionalVirtualMachineCapabilities?: AdditionalCapabilities;
baseVirtualMachineProfile: BaseVirtualMachineProfile;
computeApiVersion?: string;
platformFaultDomainCount?: number;
@ -108,6 +129,9 @@ export type ContinuablePage<TElement, TPage = TElement[]> = TPage & {
continuationToken?: string;
};
// @public
export type CpuManufacturer = string;
// @public
export type CreatedByType = string;
@ -153,26 +177,6 @@ export interface EncryptionIdentity {
userAssignedIdentityResourceId?: string;
}
// @public
export interface ErrorAdditionalInfo {
readonly info?: Record<string, any>;
readonly type?: string;
}
// @public
export interface ErrorDetail {
readonly additionalInfo?: ErrorAdditionalInfo[];
readonly code?: string;
readonly details?: ErrorDetail[];
readonly message?: string;
readonly target?: string;
}
// @public
export interface ErrorResponse {
error?: ErrorDetail;
}
// @public
export type EvictionPolicy = string;
@ -186,12 +190,14 @@ export interface Fleet extends TrackedResource {
// @public
export interface FleetProperties {
additionalLocationsProfile?: AdditionalLocationsProfile;
computeProfile: ComputeProfile;
readonly provisioningState?: ProvisioningState;
regularPriorityProfile?: RegularPriorityProfile;
spotPriorityProfile?: SpotPriorityProfile;
readonly timeCreated?: Date;
readonly uniqueId?: string;
vmAttributes?: VMAttributes;
vmSizesProfile: VmSizeProfile[];
}
@ -272,11 +278,30 @@ export interface KeyVaultSecretReference {
sourceVault: SubResource;
}
// @public
export enum KnownAcceleratorManufacturer {
AMD = "AMD",
Nvidia = "Nvidia",
Xilinx = "Xilinx"
}
// @public
export enum KnownAcceleratorType {
FPGA = "FPGA",
GPU = "GPU"
}
// @public
export enum KnownActionType {
Internal = "Internal"
}
// @public
export enum KnownArchitectureType {
ARM64 = "ARM64",
X64 = "X64"
}
// @public
export enum KnownCachingTypes {
None = "None",
@ -284,6 +309,14 @@ export enum KnownCachingTypes {
ReadWrite = "ReadWrite"
}
// @public
export enum KnownCpuManufacturer {
AMD = "AMD",
Ampere = "Ampere",
Intel = "Intel",
Microsoft = "Microsoft"
}
// @public
export enum KnownCreatedByType {
Application = "Application",
@ -371,11 +404,17 @@ export enum KnownLinuxVMGuestPatchMode {
ImageDefault = "ImageDefault"
}
// @public
export enum KnownLocalStorageDiskType {
HDD = "HDD",
SSD = "SSD"
}
// @public
export enum KnownManagedServiceIdentityType {
"SystemAssigned,UserAssigned" = "SystemAssigned,UserAssigned",
None = "None",
SystemAssigned = "SystemAssigned",
SystemAssignedUserAssigned = "SystemAssigned,UserAssigned",
UserAssigned = "UserAssigned"
}
@ -387,7 +426,7 @@ export enum KnownMode {
// @public
export enum KnownNetworkApiVersion {
"2020-11-01" = "2020-11-01"
V20201101 = "2020-11-01"
}
// @public
@ -414,9 +453,9 @@ export enum KnownOperatingSystemTypes {
// @public
export enum KnownOrigin {
"user,system" = "user,system",
system = "system",
user = "user"
System = "system",
User = "user",
UserSystem = "user,system"
}
// @public
@ -425,6 +464,17 @@ export enum KnownProtocolTypes {
Https = "Https"
}
// @public
export enum KnownProvisioningState {
Canceled = "Canceled",
Creating = "Creating",
Deleting = "Deleting",
Failed = "Failed",
Migrating = "Migrating",
Succeeded = "Succeeded",
Updating = "Updating"
}
// @public
export enum KnownPublicIPAddressSkuName {
Basic = "Basic",
@ -443,13 +493,6 @@ export enum KnownRegularPriorityAllocationStrategy {
Prioritized = "Prioritized"
}
// @public
export enum KnownResourceProvisioningState {
Canceled = "Canceled",
Failed = "Failed",
Succeeded = "Succeeded"
}
// @public
export enum KnownSecurityEncryptionTypes {
DiskWithVMGuestState = "DiskWithVMGuestState",
@ -478,13 +521,31 @@ export enum KnownSpotAllocationStrategy {
// @public
export enum KnownStorageAccountTypes {
Premium_LRS = "Premium_LRS",
Premium_ZRS = "Premium_ZRS",
PremiumV2_LRS = "PremiumV2_LRS",
Standard_LRS = "Standard_LRS",
StandardSSD_LRS = "StandardSSD_LRS",
StandardSSD_ZRS = "StandardSSD_ZRS",
UltraSSD_LRS = "UltraSSD_LRS"
PremiumLRS = "Premium_LRS",
PremiumV2LRS = "PremiumV2_LRS",
PremiumZRS = "Premium_ZRS",
StandardLRS = "Standard_LRS",
StandardSSDLRS = "StandardSSD_LRS",
StandardSSDZRS = "StandardSSD_ZRS",
UltraSSDLRS = "UltraSSD_LRS"
}
// @public
export enum KnownVMAttributeSupport {
Excluded = "Excluded",
Included = "Included",
Required = "Required"
}
// @public
export enum KnownVMCategory {
ComputeOptimized = "ComputeOptimized",
FpgaAccelerated = "FpgaAccelerated",
GeneralPurpose = "GeneralPurpose",
GpuAccelerated = "GpuAccelerated",
HighPerformanceCompute = "HighPerformanceCompute",
MemoryOptimized = "MemoryOptimized",
StorageOptimized = "StorageOptimized"
}
// @public
@ -539,6 +600,15 @@ export interface LinuxVMGuestPatchAutomaticByPlatformSettings {
// @public
export type LinuxVMGuestPatchMode = string;
// @public
export type LocalStorageDiskType = string;
// @public
export interface LocationProfile {
location: string;
virtualMachineProfileOverride?: BaseVirtualMachineProfile;
}
// @public
export interface ManagedServiceIdentity {
readonly principalId?: string;
@ -639,7 +709,7 @@ export interface Plan {
export type ProtocolTypes = string;
// @public
export type ProvisioningState = string | ResourceProvisioningState | "Creating" | "Updating" | "Deleting" | "Migrating";
export type ProvisioningState = string;
// @public
export interface ProxyAgentSettings {
@ -687,9 +757,6 @@ export interface ResourcePlanUpdate {
version?: string;
}
// @public
export type ResourceProvisioningState = string;
// @public
export function restorePoller<TResponse extends PathUncheckedResponse, TResult>(client: AzureFleetClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike<OperationState<TResult>, TResult>, options?: RestorePollerOptions<TResult>): PollerLike<OperationState<TResult>, TResult>;
@ -814,9 +881,6 @@ export interface VaultSecretGroup {
vaultCertificates?: VaultCertificate[];
}
// @public
export type Versions = "2023-11-01-preview" | "2024-05-01-preview";
// @public
export interface VirtualHardDisk {
uri?: string;
@ -1002,6 +1066,48 @@ export interface VirtualMachineScaleSetStorageProfile {
osDisk?: VirtualMachineScaleSetOSDisk;
}
// @public
export interface VMAttributeMinMaxDouble {
max?: number;
min?: number;
}
// @public
export interface VMAttributeMinMaxInteger {
max?: number;
min?: number;
}
// @public
export interface VMAttributes {
acceleratorCount?: VMAttributeMinMaxInteger;
acceleratorManufacturers?: AcceleratorManufacturer[];
acceleratorSupport?: VMAttributeSupport;
acceleratorTypes?: AcceleratorType[];
architectureTypes?: ArchitectureType[];
burstableSupport?: VMAttributeSupport;
cpuManufacturers?: CpuManufacturer[];
dataDiskCount?: VMAttributeMinMaxInteger;
excludedVMSizes?: string[];
localStorageDiskTypes?: LocalStorageDiskType[];
localStorageInGiB?: VMAttributeMinMaxDouble;
localStorageSupport?: VMAttributeSupport;
memoryInGiB: VMAttributeMinMaxDouble;
memoryInGiBPerVCpu?: VMAttributeMinMaxDouble;
networkBandwidthInMbps?: VMAttributeMinMaxDouble;
networkInterfaceCount?: VMAttributeMinMaxInteger;
rdmaNetworkInterfaceCount?: VMAttributeMinMaxInteger;
rdmaSupport?: VMAttributeSupport;
vCpuCount: VMAttributeMinMaxInteger;
vmCategories?: VMCategory[];
}
// @public
export type VMAttributeSupport = string;
// @public
export type VMCategory = string;
// @public
export interface VMDiskSecurityProfile {
diskEncryptionSet?: DiskEncryptionSetParameters;

Просмотреть файл

@ -0,0 +1 @@
# Feel free to add your own environment variables.

Просмотреть файл

@ -0,0 +1,449 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { AzureFleetClient } from "@azure/arm-computefleet";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to create a Fleet
*
* @summary create a Fleet
* x-ms-original-file: 2024-11-01/Fleets_CreateOrUpdate.json
*/
async function fleetsCreateOrUpdate() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const result = await client.fleets.createOrUpdate("rgazurefleet", "testFleet", {
properties: {
spotPriorityProfile: {
capacity: 20,
minCapacity: 10,
maxPricePerVM: 0.00865,
evictionPolicy: "Delete",
allocationStrategy: "PriceCapacityOptimized",
maintain: true,
},
regularPriorityProfile: {
capacity: 20,
minCapacity: 10,
allocationStrategy: "LowestPrice",
},
vmSizesProfile: [{ name: "Standard_d1_v2", rank: 19225 }],
computeProfile: {
baseVirtualMachineProfile: {
osProfile: {
computerNamePrefix: "o",
adminUsername: "nrgzqciiaaxjrqldbmjbqkyhntp",
adminPassword: "adfbrdxpv",
customData: "xjjib",
windowsConfiguration: {
provisionVMAgent: true,
enableAutomaticUpdates: true,
timeZone: "hlyjiqcfksgrpjrct",
additionalUnattendContent: [
{
passName: "OobeSystem",
componentName: "Microsoft-Windows-Shell-Setup",
settingName: "AutoLogon",
content: "bubmqbxjkj",
},
],
patchSettings: {
patchMode: "Manual",
enableHotpatching: true,
assessmentMode: "ImageDefault",
automaticByPlatformSettings: {
rebootSetting: "Unknown",
bypassPlatformSafetyChecksOnUserSchedule: true,
},
},
winRM: {
listeners: [
{
protocol: "Https",
certificateUrl: "https://myVaultName.vault.azure.net/secrets/myCertName",
},
],
},
enableVMAgentPlatformUpdates: true,
},
linuxConfiguration: {
disablePasswordAuthentication: true,
ssh: {
publicKeys: [{ path: "kmqz", keyData: "kivgsubusvpprwqaqpjcmhsv" }],
},
provisionVMAgent: true,
patchSettings: {
patchMode: "ImageDefault",
assessmentMode: "ImageDefault",
automaticByPlatformSettings: {
rebootSetting: "Unknown",
bypassPlatformSafetyChecksOnUserSchedule: true,
},
},
enableVMAgentPlatformUpdates: true,
},
secrets: [
{
sourceVault: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}",
},
vaultCertificates: [
{
certificateUrl: "https://myVaultName.vault.azure.net/secrets/myCertName",
certificateStore: "nlxrwavpzhueffxsshlun",
},
],
},
],
allowExtensionOperations: true,
requireGuestProvisionSignal: true,
},
storageProfile: {
imageReference: {
publisher: "mqxgwbiyjzmxavhbkd",
offer: "isxgumkarlkomp",
sku: "eojmppqcrnpmxirtp",
version: "wvpcqefgtmqdgltiuz",
sharedGalleryImageId: "kmkgihoxwlawuuhcinfirktdwkmx",
communityGalleryImageId: "vlqe",
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}/versions/{versionName}",
},
osDisk: {
name: "wfttw",
caching: "None",
writeAcceleratorEnabled: true,
createOption: "FromImage",
diffDiskSettings: { option: "Local", placement: "CacheDisk" },
diskSizeGB: 14,
osType: "Windows",
image: {
uri: "https://myStorageAccountName.blob.core.windows.net/myContainerName/myVhdName.vhd",
},
vhdContainers: ["tkzcwddtinkfpnfklatw"],
managedDisk: {
storageAccountType: "Standard_LRS",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
securityProfile: {
securityEncryptionType: "VMGuestStateOnly",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
},
},
deleteOption: "Delete",
},
dataDisks: [
{
name: "eogiykmdmeikswxmigjws",
lun: 14,
caching: "None",
writeAcceleratorEnabled: true,
createOption: "FromImage",
diskSizeGB: 6,
managedDisk: {
storageAccountType: "Standard_LRS",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
securityProfile: {
securityEncryptionType: "VMGuestStateOnly",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
},
},
diskIOPSReadWrite: 27,
diskMBpsReadWrite: 2,
deleteOption: "Delete",
},
],
},
networkProfile: {
healthProbe: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}",
},
networkInterfaceConfigurations: [
{
name: "i",
properties: {
primary: true,
enableAcceleratedNetworking: true,
disableTcpStateTracking: true,
enableFpga: true,
networkSecurityGroup: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}",
},
dnsSettings: { dnsServers: ["nxmmfolhclsesu"] },
ipConfigurations: [
{
name: "oezqhkidfhyywlfzwuotilrpbqnjg",
properties: {
subnet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}",
},
primary: true,
publicIPAddressConfiguration: {
name: "fvpqf",
properties: {
idleTimeoutInMinutes: 9,
dnsSettings: {
domainNameLabel: "ukrddzvmorpmfsczjwtbvp",
domainNameLabelScope: "TenantReuse",
},
ipTags: [
{
ipTagType: "sddgsoemnzgqizale",
tag: "wufmhrjsakbiaetyara",
},
],
publicIPPrefix: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}",
},
publicIPAddressVersion: "IPv4",
deleteOption: "Delete",
},
sku: { name: "Basic", tier: "Regional" },
},
privateIPAddressVersion: "IPv4",
applicationGatewayBackendAddressPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}",
},
],
applicationSecurityGroups: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}",
},
],
loadBalancerBackendAddressPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}",
},
],
loadBalancerInboundNatPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}",
},
],
},
},
],
enableIPForwarding: true,
deleteOption: "Delete",
auxiliaryMode: "None",
auxiliarySku: "None",
},
},
],
networkApiVersion: "2020-11-01",
},
securityProfile: {
uefiSettings: { secureBootEnabled: true, vTpmEnabled: true },
encryptionAtHost: true,
securityType: "TrustedLaunch",
encryptionIdentity: {
userAssignedIdentityResourceId:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}",
},
proxyAgentSettings: {
enabled: true,
mode: "Audit",
keyIncarnationId: 20,
},
},
diagnosticsProfile: {
bootDiagnostics: {
enabled: true,
storageUri: "http://myStorageAccountName.blob.core.windows.net",
},
},
extensionProfile: {
extensions: [
{
name: "bndxuxx",
properties: {
forceUpdateTag: "yhgxw",
publisher: "kpxtirxjfprhs",
type: "pgjilctjjwaa",
typeHandlerVersion: "zevivcoilxmbwlrihhhibq",
autoUpgradeMinorVersion: true,
enableAutomaticUpgrade: true,
settings: {},
protectedSettings: {},
provisionAfterExtensions: ["nftzosroolbcwmpupujzqwqe"],
suppressFailures: true,
protectedSettingsFromKeyVault: {
secretUrl: "https://myvaultName.vault.azure.net/secrets/secret/mySecretName",
sourceVault: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}",
},
},
},
},
],
extensionsTimeBudget: "mbhjahtdygwgyszdwjtvlvtgchdwil",
},
licenseType: "v",
scheduledEventsProfile: {
terminateNotificationProfile: {
notBeforeTimeout: "iljppmmw",
enable: true,
},
osImageNotificationProfile: {
notBeforeTimeout: "olbpadmevekyczfokodtfprxti",
enable: true,
},
},
userData: "s",
capacityReservation: {
capacityReservationGroup: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}",
},
},
applicationProfile: {
galleryApplications: [
{
tags: "eyrqjbib",
order: 5,
packageReferenceId:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{applicationName}/versions/{versionName}",
configurationReference: "ulztmiavpojpbpbddgnuuiimxcpau",
treatFailureAsDeploymentFailure: true,
enableAutomaticUpgrade: true,
},
],
},
hardwareProfile: {
vmSizeProperties: { vCPUsAvailable: 16, vCPUsPerCore: 23 },
},
serviceArtifactReference: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactsName}/vmArtifactsProfiles/{vmArtifactsProfileName}",
},
securityPostureReference: {
id: "/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest",
excludeExtensions: ["{securityPostureVMExtensionName}"],
isOverridable: true,
},
},
computeApiVersion: "2023-07-01",
platformFaultDomainCount: 1,
},
},
zones: ["zone1", "zone2"],
identity: {
type: "UserAssigned",
userAssignedIdentities: { key9851: {} },
},
tags: { key3518: "luvrnuvsgdpbuofdskkcoqhfh" },
location: "westus",
plan: {
name: "jwgrcrnrtfoxn",
publisher: "iozjbiqqckqm",
product: "cgopbyvdyqikahwyxfpzwaqk",
promotionCode: "naglezezplcaruqogtxnuizslqnnbr",
version: "wa",
},
});
console.log(result);
}
/**
* This sample demonstrates how to create a Fleet
*
* @summary create a Fleet
* x-ms-original-file: 2024-11-01/Fleets_CreateOrUpdate_MinimumSet.json
*/
async function fleetsCreateOrUpdateMinimumSet() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const result = await client.fleets.createOrUpdate("rgazurefleet", "testFleet", {
properties: {
spotPriorityProfile: {
capacity: 2,
minCapacity: 1,
evictionPolicy: "Delete",
allocationStrategy: "PriceCapacityOptimized",
maintain: true,
},
regularPriorityProfile: {
capacity: 2,
minCapacity: 1,
allocationStrategy: "LowestPrice",
},
vmSizesProfile: [
{ name: "Standard_D2s_v3" },
{ name: "Standard_D4s_v3" },
{ name: "Standard_E2s_v3" },
],
computeProfile: {
baseVirtualMachineProfile: {
storageProfile: {
imageReference: {
publisher: "canonical",
offer: "0001-com-ubuntu-server-focal",
sku: "20_04-lts-gen2",
version: "latest",
},
osDisk: {
caching: "ReadWrite",
createOption: "FromImage",
osType: "Linux",
managedDisk: { storageAccountType: "Standard_LRS" },
},
},
osProfile: {
computerNamePrefix: "prefix",
adminUsername: "azureuser",
adminPassword: "TestPassword$0",
linuxConfiguration: { disablePasswordAuthentication: false },
},
networkProfile: {
networkInterfaceConfigurations: [
{
name: "vmNameTest",
properties: {
primary: true,
enableAcceleratedNetworking: false,
ipConfigurations: [
{
name: "vmNameTest",
properties: {
subnet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}",
},
primary: true,
loadBalancerBackendAddressPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}",
},
],
},
},
],
enableIPForwarding: true,
},
},
],
},
},
computeApiVersion: "2023-09-01",
platformFaultDomainCount: 1,
},
},
tags: { key: "fleets-test" },
location: "eastus2euap",
});
console.log(result);
}
async function main() {
fleetsCreateOrUpdate();
fleetsCreateOrUpdateMinimumSet();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,24 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { AzureFleetClient } from "@azure/arm-computefleet";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to delete a Fleet
*
* @summary delete a Fleet
* x-ms-original-file: 2024-11-01/Fleets_Delete.json
*/
async function fleetsDelete() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
await client.fleets.delete("rgazurefleet", "testFleet");
}
async function main() {
fleetsDelete();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { AzureFleetClient } from "@azure/arm-computefleet";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to get a Fleet
*
* @summary get a Fleet
* x-ms-original-file: 2024-11-01/Fleets_Get.json
*/
async function fleetsGet() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const result = await client.fleets.get("rgazurefleet", "testFleet");
console.log(result);
}
async function main() {
fleetsGet();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { AzureFleetClient } from "@azure/arm-computefleet";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to list Fleet resources by resource group
*
* @summary list Fleet resources by resource group
* x-ms-original-file: 2024-11-01/Fleets_ListByResourceGroup.json
*/
async function fleetsListByResourceGroup() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.fleets.listByResourceGroup("rgazurefleet")) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
fleetsListByResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { AzureFleetClient } from "@azure/arm-computefleet";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to list Fleet resources by subscription ID
*
* @summary list Fleet resources by subscription ID
* x-ms-original-file: 2024-11-01/Fleets_ListBySubscription.json
*/
async function fleetsListBySubscription() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.fleets.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
fleetsListBySubscription();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { AzureFleetClient } from "@azure/arm-computefleet";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to list VirtualMachineScaleSet resources by Fleet
*
* @summary list VirtualMachineScaleSet resources by Fleet
* x-ms-original-file: 2024-11-01/Fleets_ListVirtualMachineScaleSets.json
*/
async function fleetsListVirtualMachineScaleSets() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.fleets.listVirtualMachineScaleSets("rgazurefleet", "myFleet")) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
fleetsListVirtualMachineScaleSets();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,353 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { AzureFleetClient } from "@azure/arm-computefleet";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to update a Fleet
*
* @summary update a Fleet
* x-ms-original-file: 2024-11-01/Fleets_Update.json
*/
async function fleetsUpdate() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const result = await client.fleets.update("rgazurefleet", "testFleet", {
identity: { type: "UserAssigned", userAssignedIdentities: {} },
tags: {},
properties: {
spotPriorityProfile: {
capacity: 20,
minCapacity: 10,
maxPricePerVM: 0.00865,
evictionPolicy: "Delete",
allocationStrategy: "PriceCapacityOptimized",
maintain: true,
},
regularPriorityProfile: {
capacity: 20,
minCapacity: 10,
allocationStrategy: "LowestPrice",
},
vmSizesProfile: [{ name: "Standard_d1_v2", rank: 19225 }],
computeProfile: {
baseVirtualMachineProfile: {
osProfile: {
computerNamePrefix: "o",
adminUsername: "nrgzqciiaaxjrqldbmjbqkyhntp",
adminPassword: "adfbrdxpv",
customData: "xjjib",
windowsConfiguration: {
provisionVMAgent: true,
enableAutomaticUpdates: true,
timeZone: "hlyjiqcfksgrpjrct",
additionalUnattendContent: [
{
passName: "OobeSystem",
componentName: "Microsoft-Windows-Shell-Setup",
settingName: "AutoLogon",
content: "bubmqbxjkj",
},
],
patchSettings: {
patchMode: "Manual",
enableHotpatching: true,
assessmentMode: "ImageDefault",
automaticByPlatformSettings: {
rebootSetting: "Unknown",
bypassPlatformSafetyChecksOnUserSchedule: true,
},
},
winRM: {
listeners: [
{
protocol: "Http",
certificateUrl: "https://myVaultName.vault.azure.net/secrets/myCertName",
},
],
},
enableVMAgentPlatformUpdates: true,
},
linuxConfiguration: {
disablePasswordAuthentication: true,
ssh: {
publicKeys: [{ path: "kmqz", keyData: "kivgsubusvpprwqaqpjcmhsv" }],
},
provisionVMAgent: true,
patchSettings: {
patchMode: "ImageDefault",
assessmentMode: "ImageDefault",
automaticByPlatformSettings: {
rebootSetting: "Unknown",
bypassPlatformSafetyChecksOnUserSchedule: true,
},
},
enableVMAgentPlatformUpdates: true,
},
secrets: [
{
sourceVault: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}",
},
vaultCertificates: [
{
certificateUrl: "https://myVaultName.vault.azure.net/secrets/myCertName",
certificateStore: "nlxrwavpzhueffxsshlun",
},
],
},
],
allowExtensionOperations: true,
requireGuestProvisionSignal: true,
},
storageProfile: {
imageReference: {
publisher: "mqxgwbiyjzmxavhbkd",
offer: "isxgumkarlkomp",
sku: "eojmppqcrnpmxirtp",
version: "wvpcqefgtmqdgltiuz",
sharedGalleryImageId: "kmkgihoxwlawuuhcinfirktdwkmx",
communityGalleryImageId: "vlqe",
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}/versions/{versionName}",
},
osDisk: {
name: "wfttw",
caching: "None",
writeAcceleratorEnabled: true,
createOption: "FromImage",
diffDiskSettings: { option: "Local", placement: "CacheDisk" },
diskSizeGB: 14,
osType: "Windows",
image: {
uri: "https://myStorageAccountName.blob.core.windows.net/myContainerName/myVhdName.vhd",
},
vhdContainers: ["tkzcwddtinkfpnfklatw"],
managedDisk: {
storageAccountType: "Standard_LRS",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
securityProfile: {
securityEncryptionType: "VMGuestStateOnly",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
},
},
deleteOption: "Delete",
},
dataDisks: [
{
name: "eogiykmdmeikswxmigjws",
lun: 14,
caching: "None",
writeAcceleratorEnabled: true,
createOption: "FromImage",
diskSizeGB: 6,
managedDisk: {
storageAccountType: "Standard_LRS",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
securityProfile: {
securityEncryptionType: "VMGuestStateOnly",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
},
},
diskIOPSReadWrite: 27,
diskMBpsReadWrite: 2,
deleteOption: "Delete",
},
],
},
networkProfile: {
healthProbe: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}",
},
networkInterfaceConfigurations: [
{
name: "i",
properties: {
primary: true,
enableAcceleratedNetworking: true,
disableTcpStateTracking: true,
enableFpga: true,
networkSecurityGroup: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}",
},
dnsSettings: { dnsServers: ["nxmmfolhclsesu"] },
ipConfigurations: [
{
name: "oezqhkidfhyywlfzwuotilrpbqnjg",
properties: {
subnet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}",
},
primary: true,
publicIPAddressConfiguration: {
name: "fvpqf",
properties: {
idleTimeoutInMinutes: 9,
dnsSettings: {
domainNameLabel: "ukrddzvmorpmfsczjwtbvp",
domainNameLabelScope: "TenantReuse",
},
ipTags: [
{
ipTagType: "sddgsoemnzgqizale",
tag: "wufmhrjsakbiaetyara",
},
],
publicIPPrefix: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}",
},
publicIPAddressVersion: "IPv4",
deleteOption: "Delete",
},
sku: { name: "Basic", tier: "Regional" },
},
privateIPAddressVersion: "IPv4",
applicationGatewayBackendAddressPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}",
},
],
applicationSecurityGroups: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}",
},
],
loadBalancerBackendAddressPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}",
},
],
loadBalancerInboundNatPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}",
},
],
},
},
],
enableIPForwarding: true,
deleteOption: "Delete",
auxiliaryMode: "None",
auxiliarySku: "None",
},
},
],
networkApiVersion: "2020-11-01",
},
securityProfile: {
uefiSettings: { secureBootEnabled: true, vTpmEnabled: true },
encryptionAtHost: true,
securityType: "TrustedLaunch",
encryptionIdentity: {
userAssignedIdentityResourceId:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}",
},
proxyAgentSettings: {
enabled: true,
mode: "Audit",
keyIncarnationId: 20,
},
},
diagnosticsProfile: {
bootDiagnostics: {
enabled: true,
storageUri: "http://myStorageAccountName.blob.core.windows.net",
},
},
extensionProfile: {
extensions: [
{
name: "bndxuxx",
properties: {
forceUpdateTag: "yhgxw",
publisher: "kpxtirxjfprhs",
type: "pgjilctjjwaa",
typeHandlerVersion: "zevivcoilxmbwlrihhhibq",
autoUpgradeMinorVersion: true,
enableAutomaticUpgrade: true,
settings: {},
protectedSettings: {},
provisionAfterExtensions: ["nftzosroolbcwmpupujzqwqe"],
suppressFailures: true,
protectedSettingsFromKeyVault: {
secretUrl: "https://myVaultName.vault.azure.net/secrets/secret/mySecretName",
sourceVault: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}",
},
},
},
},
],
extensionsTimeBudget: "mbhjahtdygwgyszdwjtvlvtgchdwil",
},
licenseType: "v",
scheduledEventsProfile: {
terminateNotificationProfile: {
notBeforeTimeout: "iljppmmw",
enable: true,
},
osImageNotificationProfile: {
notBeforeTimeout: "olbpadmevekyczfokodtfprxti",
enable: true,
},
},
userData: "s",
capacityReservation: {
capacityReservationGroup: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}",
},
},
applicationProfile: {
galleryApplications: [
{
tags: "eyrqjbib",
order: 5,
packageReferenceId:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{applicationName}/versions/{versionName}",
configurationReference: "ulztmiavpojpbpbddgnuuiimxcpau",
treatFailureAsDeploymentFailure: true,
enableAutomaticUpgrade: true,
},
],
},
hardwareProfile: {
vmSizeProperties: { vCPUsAvailable: 16, vCPUsPerCore: 23 },
},
serviceArtifactReference: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactsName}/vmArtifactsProfiles/{vmArtifactsProfileName}",
},
securityPostureReference: {
id: "/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest",
excludeExtensions: ["{securityPostureVMExtensionName}"],
isOverridable: true,
},
},
computeApiVersion: "2023-07-01",
platformFaultDomainCount: 1,
},
},
plan: {
name: "jwgrcrnrtfoxn",
publisher: "iozjbiqqckqm",
product: "cgopbyvdyqikahwyxfpzwaqk",
promotionCode: "naglezezplcaruqogtxnuizslqnnbr",
version: "wa",
},
});
console.log(result);
}
async function main() {
fleetsUpdate();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { AzureFleetClient } from "@azure/arm-computefleet";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to list the operations for the provider
*
* @summary list the operations for the provider
* x-ms-original-file: 2024-11-01/Operations_List.json
*/
async function operationsList() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-00000000000";
const client = new AzureFleetClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
operationsList();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,64 @@
# @azure/arm-computefleet client library samples for JavaScript
These sample programs show how to use the JavaScript client libraries for @azure/arm-computefleet in some common scenarios.
| **File Name** | **Description** |
| ------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| [fleetsCreateOrUpdateSample.js][fleetscreateorupdatesample] | create a Fleet x-ms-original-file: 2024-11-01/Fleets_CreateOrUpdate.json |
| [fleetsDeleteSample.js][fleetsdeletesample] | delete a Fleet x-ms-original-file: 2024-11-01/Fleets_Delete.json |
| [fleetsGetSample.js][fleetsgetsample] | get a Fleet x-ms-original-file: 2024-11-01/Fleets_Get.json |
| [fleetsListByResourceGroupSample.js][fleetslistbyresourcegroupsample] | list Fleet resources by resource group x-ms-original-file: 2024-11-01/Fleets_ListByResourceGroup.json |
| [fleetsListBySubscriptionSample.js][fleetslistbysubscriptionsample] | list Fleet resources by subscription ID x-ms-original-file: 2024-11-01/Fleets_ListBySubscription.json |
| [fleetsListVirtualMachineScaleSetsSample.js][fleetslistvirtualmachinescalesetssample] | list VirtualMachineScaleSet resources by Fleet x-ms-original-file: 2024-11-01/Fleets_ListVirtualMachineScaleSets.json |
| [fleetsUpdateSample.js][fleetsupdatesample] | update a Fleet x-ms-original-file: 2024-11-01/Fleets_Update.json |
| [operationsListSample.js][operationslistsample] | list the operations for the provider x-ms-original-file: 2024-11-01/Operations_List.json |
## Prerequisites
The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule).
You need [an Azure subscription][freesub] to run these sample programs.
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
## Setup
To run the samples using the published version of the package:
1. Install the dependencies using `npm`:
```bash
npm install
```
2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
3. Run whichever samples you like (note that some samples may require additional setup, see the table above):
```bash
node fleetsCreateOrUpdateSample.js
```
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
```bash
npx cross-env node fleetsCreateOrUpdateSample.js
```
## Next Steps
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
[fleetscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computefleet/arm-computefleet/samples/v1/javascript/fleetsCreateOrUpdateSample.js
[fleetsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computefleet/arm-computefleet/samples/v1/javascript/fleetsDeleteSample.js
[fleetsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computefleet/arm-computefleet/samples/v1/javascript/fleetsGetSample.js
[fleetslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computefleet/arm-computefleet/samples/v1/javascript/fleetsListByResourceGroupSample.js
[fleetslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computefleet/arm-computefleet/samples/v1/javascript/fleetsListBySubscriptionSample.js
[fleetslistvirtualmachinescalesetssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computefleet/arm-computefleet/samples/v1/javascript/fleetsListVirtualMachineScaleSetsSample.js
[fleetsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computefleet/arm-computefleet/samples/v1/javascript/fleetsUpdateSample.js
[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computefleet/arm-computefleet/samples/v1/javascript/operationsListSample.js
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-computefleet?view=azure-node-preview
[freesub]: https://azure.microsoft.com/free/
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/computefleet/arm-computefleet/README.md

Просмотреть файл

@ -0,0 +1,449 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { AzureFleetClient } = require("@azure/arm-computefleet");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to create a Fleet
*
* @summary create a Fleet
* x-ms-original-file: 2024-11-01/Fleets_CreateOrUpdate.json
*/
async function fleetsCreateOrUpdate() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const result = await client.fleets.createOrUpdate("rgazurefleet", "testFleet", {
properties: {
spotPriorityProfile: {
capacity: 20,
minCapacity: 10,
maxPricePerVM: 0.00865,
evictionPolicy: "Delete",
allocationStrategy: "PriceCapacityOptimized",
maintain: true,
},
regularPriorityProfile: {
capacity: 20,
minCapacity: 10,
allocationStrategy: "LowestPrice",
},
vmSizesProfile: [{ name: "Standard_d1_v2", rank: 19225 }],
computeProfile: {
baseVirtualMachineProfile: {
osProfile: {
computerNamePrefix: "o",
adminUsername: "nrgzqciiaaxjrqldbmjbqkyhntp",
adminPassword: "adfbrdxpv",
customData: "xjjib",
windowsConfiguration: {
provisionVMAgent: true,
enableAutomaticUpdates: true,
timeZone: "hlyjiqcfksgrpjrct",
additionalUnattendContent: [
{
passName: "OobeSystem",
componentName: "Microsoft-Windows-Shell-Setup",
settingName: "AutoLogon",
content: "bubmqbxjkj",
},
],
patchSettings: {
patchMode: "Manual",
enableHotpatching: true,
assessmentMode: "ImageDefault",
automaticByPlatformSettings: {
rebootSetting: "Unknown",
bypassPlatformSafetyChecksOnUserSchedule: true,
},
},
winRM: {
listeners: [
{
protocol: "Https",
certificateUrl: "https://myVaultName.vault.azure.net/secrets/myCertName",
},
],
},
enableVMAgentPlatformUpdates: true,
},
linuxConfiguration: {
disablePasswordAuthentication: true,
ssh: {
publicKeys: [{ path: "kmqz", keyData: "kivgsubusvpprwqaqpjcmhsv" }],
},
provisionVMAgent: true,
patchSettings: {
patchMode: "ImageDefault",
assessmentMode: "ImageDefault",
automaticByPlatformSettings: {
rebootSetting: "Unknown",
bypassPlatformSafetyChecksOnUserSchedule: true,
},
},
enableVMAgentPlatformUpdates: true,
},
secrets: [
{
sourceVault: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}",
},
vaultCertificates: [
{
certificateUrl: "https://myVaultName.vault.azure.net/secrets/myCertName",
certificateStore: "nlxrwavpzhueffxsshlun",
},
],
},
],
allowExtensionOperations: true,
requireGuestProvisionSignal: true,
},
storageProfile: {
imageReference: {
publisher: "mqxgwbiyjzmxavhbkd",
offer: "isxgumkarlkomp",
sku: "eojmppqcrnpmxirtp",
version: "wvpcqefgtmqdgltiuz",
sharedGalleryImageId: "kmkgihoxwlawuuhcinfirktdwkmx",
communityGalleryImageId: "vlqe",
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}/versions/{versionName}",
},
osDisk: {
name: "wfttw",
caching: "None",
writeAcceleratorEnabled: true,
createOption: "FromImage",
diffDiskSettings: { option: "Local", placement: "CacheDisk" },
diskSizeGB: 14,
osType: "Windows",
image: {
uri: "https://myStorageAccountName.blob.core.windows.net/myContainerName/myVhdName.vhd",
},
vhdContainers: ["tkzcwddtinkfpnfklatw"],
managedDisk: {
storageAccountType: "Standard_LRS",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
securityProfile: {
securityEncryptionType: "VMGuestStateOnly",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
},
},
deleteOption: "Delete",
},
dataDisks: [
{
name: "eogiykmdmeikswxmigjws",
lun: 14,
caching: "None",
writeAcceleratorEnabled: true,
createOption: "FromImage",
diskSizeGB: 6,
managedDisk: {
storageAccountType: "Standard_LRS",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
securityProfile: {
securityEncryptionType: "VMGuestStateOnly",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
},
},
diskIOPSReadWrite: 27,
diskMBpsReadWrite: 2,
deleteOption: "Delete",
},
],
},
networkProfile: {
healthProbe: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}",
},
networkInterfaceConfigurations: [
{
name: "i",
properties: {
primary: true,
enableAcceleratedNetworking: true,
disableTcpStateTracking: true,
enableFpga: true,
networkSecurityGroup: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}",
},
dnsSettings: { dnsServers: ["nxmmfolhclsesu"] },
ipConfigurations: [
{
name: "oezqhkidfhyywlfzwuotilrpbqnjg",
properties: {
subnet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}",
},
primary: true,
publicIPAddressConfiguration: {
name: "fvpqf",
properties: {
idleTimeoutInMinutes: 9,
dnsSettings: {
domainNameLabel: "ukrddzvmorpmfsczjwtbvp",
domainNameLabelScope: "TenantReuse",
},
ipTags: [
{
ipTagType: "sddgsoemnzgqizale",
tag: "wufmhrjsakbiaetyara",
},
],
publicIPPrefix: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}",
},
publicIPAddressVersion: "IPv4",
deleteOption: "Delete",
},
sku: { name: "Basic", tier: "Regional" },
},
privateIPAddressVersion: "IPv4",
applicationGatewayBackendAddressPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}",
},
],
applicationSecurityGroups: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}",
},
],
loadBalancerBackendAddressPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}",
},
],
loadBalancerInboundNatPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}",
},
],
},
},
],
enableIPForwarding: true,
deleteOption: "Delete",
auxiliaryMode: "None",
auxiliarySku: "None",
},
},
],
networkApiVersion: "2020-11-01",
},
securityProfile: {
uefiSettings: { secureBootEnabled: true, vTpmEnabled: true },
encryptionAtHost: true,
securityType: "TrustedLaunch",
encryptionIdentity: {
userAssignedIdentityResourceId:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}",
},
proxyAgentSettings: {
enabled: true,
mode: "Audit",
keyIncarnationId: 20,
},
},
diagnosticsProfile: {
bootDiagnostics: {
enabled: true,
storageUri: "http://myStorageAccountName.blob.core.windows.net",
},
},
extensionProfile: {
extensions: [
{
name: "bndxuxx",
properties: {
forceUpdateTag: "yhgxw",
publisher: "kpxtirxjfprhs",
type: "pgjilctjjwaa",
typeHandlerVersion: "zevivcoilxmbwlrihhhibq",
autoUpgradeMinorVersion: true,
enableAutomaticUpgrade: true,
settings: {},
protectedSettings: {},
provisionAfterExtensions: ["nftzosroolbcwmpupujzqwqe"],
suppressFailures: true,
protectedSettingsFromKeyVault: {
secretUrl: "https://myvaultName.vault.azure.net/secrets/secret/mySecretName",
sourceVault: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}",
},
},
},
},
],
extensionsTimeBudget: "mbhjahtdygwgyszdwjtvlvtgchdwil",
},
licenseType: "v",
scheduledEventsProfile: {
terminateNotificationProfile: {
notBeforeTimeout: "iljppmmw",
enable: true,
},
osImageNotificationProfile: {
notBeforeTimeout: "olbpadmevekyczfokodtfprxti",
enable: true,
},
},
userData: "s",
capacityReservation: {
capacityReservationGroup: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}",
},
},
applicationProfile: {
galleryApplications: [
{
tags: "eyrqjbib",
order: 5,
packageReferenceId:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{applicationName}/versions/{versionName}",
configurationReference: "ulztmiavpojpbpbddgnuuiimxcpau",
treatFailureAsDeploymentFailure: true,
enableAutomaticUpgrade: true,
},
],
},
hardwareProfile: {
vmSizeProperties: { vCPUsAvailable: 16, vCPUsPerCore: 23 },
},
serviceArtifactReference: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactsName}/vmArtifactsProfiles/{vmArtifactsProfileName}",
},
securityPostureReference: {
id: "/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest",
excludeExtensions: ["{securityPostureVMExtensionName}"],
isOverridable: true,
},
},
computeApiVersion: "2023-07-01",
platformFaultDomainCount: 1,
},
},
zones: ["zone1", "zone2"],
identity: {
type: "UserAssigned",
userAssignedIdentities: { key9851: {} },
},
tags: { key3518: "luvrnuvsgdpbuofdskkcoqhfh" },
location: "westus",
plan: {
name: "jwgrcrnrtfoxn",
publisher: "iozjbiqqckqm",
product: "cgopbyvdyqikahwyxfpzwaqk",
promotionCode: "naglezezplcaruqogtxnuizslqnnbr",
version: "wa",
},
});
console.log(result);
}
/**
* This sample demonstrates how to create a Fleet
*
* @summary create a Fleet
* x-ms-original-file: 2024-11-01/Fleets_CreateOrUpdate_MinimumSet.json
*/
async function fleetsCreateOrUpdateMinimumSet() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const result = await client.fleets.createOrUpdate("rgazurefleet", "testFleet", {
properties: {
spotPriorityProfile: {
capacity: 2,
minCapacity: 1,
evictionPolicy: "Delete",
allocationStrategy: "PriceCapacityOptimized",
maintain: true,
},
regularPriorityProfile: {
capacity: 2,
minCapacity: 1,
allocationStrategy: "LowestPrice",
},
vmSizesProfile: [
{ name: "Standard_D2s_v3" },
{ name: "Standard_D4s_v3" },
{ name: "Standard_E2s_v3" },
],
computeProfile: {
baseVirtualMachineProfile: {
storageProfile: {
imageReference: {
publisher: "canonical",
offer: "0001-com-ubuntu-server-focal",
sku: "20_04-lts-gen2",
version: "latest",
},
osDisk: {
caching: "ReadWrite",
createOption: "FromImage",
osType: "Linux",
managedDisk: { storageAccountType: "Standard_LRS" },
},
},
osProfile: {
computerNamePrefix: "prefix",
adminUsername: "azureuser",
adminPassword: "TestPassword$0",
linuxConfiguration: { disablePasswordAuthentication: false },
},
networkProfile: {
networkInterfaceConfigurations: [
{
name: "vmNameTest",
properties: {
primary: true,
enableAcceleratedNetworking: false,
ipConfigurations: [
{
name: "vmNameTest",
properties: {
subnet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}",
},
primary: true,
loadBalancerBackendAddressPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}",
},
],
},
},
],
enableIPForwarding: true,
},
},
],
},
},
computeApiVersion: "2023-09-01",
platformFaultDomainCount: 1,
},
},
tags: { key: "fleets-test" },
location: "eastus2euap",
});
console.log(result);
}
async function main() {
fleetsCreateOrUpdate();
fleetsCreateOrUpdateMinimumSet();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,24 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { AzureFleetClient } = require("@azure/arm-computefleet");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to delete a Fleet
*
* @summary delete a Fleet
* x-ms-original-file: 2024-11-01/Fleets_Delete.json
*/
async function fleetsDelete() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
await client.fleets.delete("rgazurefleet", "testFleet");
}
async function main() {
fleetsDelete();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { AzureFleetClient } = require("@azure/arm-computefleet");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to get a Fleet
*
* @summary get a Fleet
* x-ms-original-file: 2024-11-01/Fleets_Get.json
*/
async function fleetsGet() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const result = await client.fleets.get("rgazurefleet", "testFleet");
console.log(result);
}
async function main() {
fleetsGet();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { AzureFleetClient } = require("@azure/arm-computefleet");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to list Fleet resources by resource group
*
* @summary list Fleet resources by resource group
* x-ms-original-file: 2024-11-01/Fleets_ListByResourceGroup.json
*/
async function fleetsListByResourceGroup() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.fleets.listByResourceGroup("rgazurefleet")) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
fleetsListByResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { AzureFleetClient } = require("@azure/arm-computefleet");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to list Fleet resources by subscription ID
*
* @summary list Fleet resources by subscription ID
* x-ms-original-file: 2024-11-01/Fleets_ListBySubscription.json
*/
async function fleetsListBySubscription() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.fleets.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
fleetsListBySubscription();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { AzureFleetClient } = require("@azure/arm-computefleet");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to list VirtualMachineScaleSet resources by Fleet
*
* @summary list VirtualMachineScaleSet resources by Fleet
* x-ms-original-file: 2024-11-01/Fleets_ListVirtualMachineScaleSets.json
*/
async function fleetsListVirtualMachineScaleSets() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.fleets.listVirtualMachineScaleSets("rgazurefleet", "myFleet")) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
fleetsListVirtualMachineScaleSets();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,353 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { AzureFleetClient } = require("@azure/arm-computefleet");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to update a Fleet
*
* @summary update a Fleet
* x-ms-original-file: 2024-11-01/Fleets_Update.json
*/
async function fleetsUpdate() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const result = await client.fleets.update("rgazurefleet", "testFleet", {
identity: { type: "UserAssigned", userAssignedIdentities: {} },
tags: {},
properties: {
spotPriorityProfile: {
capacity: 20,
minCapacity: 10,
maxPricePerVM: 0.00865,
evictionPolicy: "Delete",
allocationStrategy: "PriceCapacityOptimized",
maintain: true,
},
regularPriorityProfile: {
capacity: 20,
minCapacity: 10,
allocationStrategy: "LowestPrice",
},
vmSizesProfile: [{ name: "Standard_d1_v2", rank: 19225 }],
computeProfile: {
baseVirtualMachineProfile: {
osProfile: {
computerNamePrefix: "o",
adminUsername: "nrgzqciiaaxjrqldbmjbqkyhntp",
adminPassword: "adfbrdxpv",
customData: "xjjib",
windowsConfiguration: {
provisionVMAgent: true,
enableAutomaticUpdates: true,
timeZone: "hlyjiqcfksgrpjrct",
additionalUnattendContent: [
{
passName: "OobeSystem",
componentName: "Microsoft-Windows-Shell-Setup",
settingName: "AutoLogon",
content: "bubmqbxjkj",
},
],
patchSettings: {
patchMode: "Manual",
enableHotpatching: true,
assessmentMode: "ImageDefault",
automaticByPlatformSettings: {
rebootSetting: "Unknown",
bypassPlatformSafetyChecksOnUserSchedule: true,
},
},
winRM: {
listeners: [
{
protocol: "Http",
certificateUrl: "https://myVaultName.vault.azure.net/secrets/myCertName",
},
],
},
enableVMAgentPlatformUpdates: true,
},
linuxConfiguration: {
disablePasswordAuthentication: true,
ssh: {
publicKeys: [{ path: "kmqz", keyData: "kivgsubusvpprwqaqpjcmhsv" }],
},
provisionVMAgent: true,
patchSettings: {
patchMode: "ImageDefault",
assessmentMode: "ImageDefault",
automaticByPlatformSettings: {
rebootSetting: "Unknown",
bypassPlatformSafetyChecksOnUserSchedule: true,
},
},
enableVMAgentPlatformUpdates: true,
},
secrets: [
{
sourceVault: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}",
},
vaultCertificates: [
{
certificateUrl: "https://myVaultName.vault.azure.net/secrets/myCertName",
certificateStore: "nlxrwavpzhueffxsshlun",
},
],
},
],
allowExtensionOperations: true,
requireGuestProvisionSignal: true,
},
storageProfile: {
imageReference: {
publisher: "mqxgwbiyjzmxavhbkd",
offer: "isxgumkarlkomp",
sku: "eojmppqcrnpmxirtp",
version: "wvpcqefgtmqdgltiuz",
sharedGalleryImageId: "kmkgihoxwlawuuhcinfirktdwkmx",
communityGalleryImageId: "vlqe",
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}/versions/{versionName}",
},
osDisk: {
name: "wfttw",
caching: "None",
writeAcceleratorEnabled: true,
createOption: "FromImage",
diffDiskSettings: { option: "Local", placement: "CacheDisk" },
diskSizeGB: 14,
osType: "Windows",
image: {
uri: "https://myStorageAccountName.blob.core.windows.net/myContainerName/myVhdName.vhd",
},
vhdContainers: ["tkzcwddtinkfpnfklatw"],
managedDisk: {
storageAccountType: "Standard_LRS",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
securityProfile: {
securityEncryptionType: "VMGuestStateOnly",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
},
},
deleteOption: "Delete",
},
dataDisks: [
{
name: "eogiykmdmeikswxmigjws",
lun: 14,
caching: "None",
writeAcceleratorEnabled: true,
createOption: "FromImage",
diskSizeGB: 6,
managedDisk: {
storageAccountType: "Standard_LRS",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
securityProfile: {
securityEncryptionType: "VMGuestStateOnly",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
},
},
diskIOPSReadWrite: 27,
diskMBpsReadWrite: 2,
deleteOption: "Delete",
},
],
},
networkProfile: {
healthProbe: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}",
},
networkInterfaceConfigurations: [
{
name: "i",
properties: {
primary: true,
enableAcceleratedNetworking: true,
disableTcpStateTracking: true,
enableFpga: true,
networkSecurityGroup: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}",
},
dnsSettings: { dnsServers: ["nxmmfolhclsesu"] },
ipConfigurations: [
{
name: "oezqhkidfhyywlfzwuotilrpbqnjg",
properties: {
subnet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}",
},
primary: true,
publicIPAddressConfiguration: {
name: "fvpqf",
properties: {
idleTimeoutInMinutes: 9,
dnsSettings: {
domainNameLabel: "ukrddzvmorpmfsczjwtbvp",
domainNameLabelScope: "TenantReuse",
},
ipTags: [
{
ipTagType: "sddgsoemnzgqizale",
tag: "wufmhrjsakbiaetyara",
},
],
publicIPPrefix: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}",
},
publicIPAddressVersion: "IPv4",
deleteOption: "Delete",
},
sku: { name: "Basic", tier: "Regional" },
},
privateIPAddressVersion: "IPv4",
applicationGatewayBackendAddressPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}",
},
],
applicationSecurityGroups: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}",
},
],
loadBalancerBackendAddressPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}",
},
],
loadBalancerInboundNatPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}",
},
],
},
},
],
enableIPForwarding: true,
deleteOption: "Delete",
auxiliaryMode: "None",
auxiliarySku: "None",
},
},
],
networkApiVersion: "2020-11-01",
},
securityProfile: {
uefiSettings: { secureBootEnabled: true, vTpmEnabled: true },
encryptionAtHost: true,
securityType: "TrustedLaunch",
encryptionIdentity: {
userAssignedIdentityResourceId:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}",
},
proxyAgentSettings: {
enabled: true,
mode: "Audit",
keyIncarnationId: 20,
},
},
diagnosticsProfile: {
bootDiagnostics: {
enabled: true,
storageUri: "http://myStorageAccountName.blob.core.windows.net",
},
},
extensionProfile: {
extensions: [
{
name: "bndxuxx",
properties: {
forceUpdateTag: "yhgxw",
publisher: "kpxtirxjfprhs",
type: "pgjilctjjwaa",
typeHandlerVersion: "zevivcoilxmbwlrihhhibq",
autoUpgradeMinorVersion: true,
enableAutomaticUpgrade: true,
settings: {},
protectedSettings: {},
provisionAfterExtensions: ["nftzosroolbcwmpupujzqwqe"],
suppressFailures: true,
protectedSettingsFromKeyVault: {
secretUrl: "https://myVaultName.vault.azure.net/secrets/secret/mySecretName",
sourceVault: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}",
},
},
},
},
],
extensionsTimeBudget: "mbhjahtdygwgyszdwjtvlvtgchdwil",
},
licenseType: "v",
scheduledEventsProfile: {
terminateNotificationProfile: {
notBeforeTimeout: "iljppmmw",
enable: true,
},
osImageNotificationProfile: {
notBeforeTimeout: "olbpadmevekyczfokodtfprxti",
enable: true,
},
},
userData: "s",
capacityReservation: {
capacityReservationGroup: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}",
},
},
applicationProfile: {
galleryApplications: [
{
tags: "eyrqjbib",
order: 5,
packageReferenceId:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{applicationName}/versions/{versionName}",
configurationReference: "ulztmiavpojpbpbddgnuuiimxcpau",
treatFailureAsDeploymentFailure: true,
enableAutomaticUpgrade: true,
},
],
},
hardwareProfile: {
vmSizeProperties: { vCPUsAvailable: 16, vCPUsPerCore: 23 },
},
serviceArtifactReference: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactsName}/vmArtifactsProfiles/{vmArtifactsProfileName}",
},
securityPostureReference: {
id: "/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest",
excludeExtensions: ["{securityPostureVMExtensionName}"],
isOverridable: true,
},
},
computeApiVersion: "2023-07-01",
platformFaultDomainCount: 1,
},
},
plan: {
name: "jwgrcrnrtfoxn",
publisher: "iozjbiqqckqm",
product: "cgopbyvdyqikahwyxfpzwaqk",
promotionCode: "naglezezplcaruqogtxnuizslqnnbr",
version: "wa",
},
});
console.log(result);
}
async function main() {
fleetsUpdate();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { AzureFleetClient } = require("@azure/arm-computefleet");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to list the operations for the provider
*
* @summary list the operations for the provider
* x-ms-original-file: 2024-11-01/Operations_List.json
*/
async function operationsList() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-00000000000";
const client = new AzureFleetClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
operationsList();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,33 @@
{
"name": "@azure-samples/arm-computefleet-js",
"private": true,
"version": "1.0.0",
"description": "@azure/arm-computefleet client library samples for JavaScript",
"engines": {
"node": ">=18.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
"directory": "sdk/computefleet/arm-computefleet"
},
"keywords": [
"node",
"azure",
"cloud",
"typescript",
"browser",
"isomorphic"
],
"author": "Microsoft Corporation",
"license": "MIT",
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/computefleet/arm-computefleet",
"dependencies": {
"@azure/arm-computefleet": "latest",
"dotenv": "latest",
"@azure/identity": "^4.2.1"
}
}

Просмотреть файл

@ -0,0 +1 @@
# Feel free to add your own environment variables.

Просмотреть файл

@ -0,0 +1,77 @@
# @azure/arm-computefleet client library samples for TypeScript
These sample programs show how to use the TypeScript client libraries for @azure/arm-computefleet in some common scenarios.
| **File Name** | **Description** |
| ------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| [fleetsCreateOrUpdateSample.ts][fleetscreateorupdatesample] | create a Fleet x-ms-original-file: 2024-11-01/Fleets_CreateOrUpdate.json |
| [fleetsDeleteSample.ts][fleetsdeletesample] | delete a Fleet x-ms-original-file: 2024-11-01/Fleets_Delete.json |
| [fleetsGetSample.ts][fleetsgetsample] | get a Fleet x-ms-original-file: 2024-11-01/Fleets_Get.json |
| [fleetsListByResourceGroupSample.ts][fleetslistbyresourcegroupsample] | list Fleet resources by resource group x-ms-original-file: 2024-11-01/Fleets_ListByResourceGroup.json |
| [fleetsListBySubscriptionSample.ts][fleetslistbysubscriptionsample] | list Fleet resources by subscription ID x-ms-original-file: 2024-11-01/Fleets_ListBySubscription.json |
| [fleetsListVirtualMachineScaleSetsSample.ts][fleetslistvirtualmachinescalesetssample] | list VirtualMachineScaleSet resources by Fleet x-ms-original-file: 2024-11-01/Fleets_ListVirtualMachineScaleSets.json |
| [fleetsUpdateSample.ts][fleetsupdatesample] | update a Fleet x-ms-original-file: 2024-11-01/Fleets_Update.json |
| [operationsListSample.ts][operationslistsample] | list the operations for the provider x-ms-original-file: 2024-11-01/Operations_List.json |
## Prerequisites
The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule).
Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using:
```bash
npm install -g typescript
```
You need [an Azure subscription][freesub] to run these sample programs.
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
## Setup
To run the samples using the published version of the package:
1. Install the dependencies using `npm`:
```bash
npm install
```
2. Compile the samples:
```bash
npm run build
```
3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
4. Run whichever samples you like (note that some samples may require additional setup, see the table above):
```bash
node dist/fleetsCreateOrUpdateSample.js
```
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
```bash
npx cross-env node dist/fleetsCreateOrUpdateSample.js
```
## Next Steps
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
[fleetscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computefleet/arm-computefleet/samples/v1/typescript/src/fleetsCreateOrUpdateSample.ts
[fleetsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computefleet/arm-computefleet/samples/v1/typescript/src/fleetsDeleteSample.ts
[fleetsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computefleet/arm-computefleet/samples/v1/typescript/src/fleetsGetSample.ts
[fleetslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computefleet/arm-computefleet/samples/v1/typescript/src/fleetsListByResourceGroupSample.ts
[fleetslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computefleet/arm-computefleet/samples/v1/typescript/src/fleetsListBySubscriptionSample.ts
[fleetslistvirtualmachinescalesetssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computefleet/arm-computefleet/samples/v1/typescript/src/fleetsListVirtualMachineScaleSetsSample.ts
[fleetsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computefleet/arm-computefleet/samples/v1/typescript/src/fleetsUpdateSample.ts
[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/computefleet/arm-computefleet/samples/v1/typescript/src/operationsListSample.ts
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-computefleet?view=azure-node-preview
[freesub]: https://azure.microsoft.com/free/
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/computefleet/arm-computefleet/README.md
[typescript]: https://www.typescriptlang.org/docs/home.html

Просмотреть файл

@ -0,0 +1,42 @@
{
"name": "@azure-samples/arm-computefleet-ts",
"private": true,
"version": "1.0.0",
"description": "@azure/arm-computefleet client library samples for TypeScript",
"engines": {
"node": ">=18.0.0"
},
"scripts": {
"build": "tsc",
"prebuild": "rimraf dist/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
"directory": "sdk/computefleet/arm-computefleet"
},
"keywords": [
"node",
"azure",
"cloud",
"typescript",
"browser",
"isomorphic"
],
"author": "Microsoft Corporation",
"license": "MIT",
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/computefleet/arm-computefleet",
"dependencies": {
"@azure/arm-computefleet": "latest",
"dotenv": "latest",
"@azure/identity": "^4.2.1"
},
"devDependencies": {
"@types/node": "^18.0.0",
"typescript": "~5.6.2",
"rimraf": "latest"
}
}

Просмотреть файл

@ -0,0 +1 @@
# Feel free to add your own environment variables.

Просмотреть файл

@ -0,0 +1,462 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { AzureFleetClient } from "@azure/arm-computefleet";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to create a Fleet
*
* @summary create a Fleet
* x-ms-original-file: 2024-11-01/Fleets_CreateOrUpdate.json
*/
async function fleetsCreateOrUpdate() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const result = await client.fleets.createOrUpdate(
"rgazurefleet",
"testFleet",
{
properties: {
spotPriorityProfile: {
capacity: 20,
minCapacity: 10,
maxPricePerVM: 0.00865,
evictionPolicy: "Delete",
allocationStrategy: "PriceCapacityOptimized",
maintain: true,
},
regularPriorityProfile: {
capacity: 20,
minCapacity: 10,
allocationStrategy: "LowestPrice",
},
vmSizesProfile: [{ name: "Standard_d1_v2", rank: 19225 }],
computeProfile: {
baseVirtualMachineProfile: {
osProfile: {
computerNamePrefix: "o",
adminUsername: "nrgzqciiaaxjrqldbmjbqkyhntp",
adminPassword: "adfbrdxpv",
customData: "xjjib",
windowsConfiguration: {
provisionVMAgent: true,
enableAutomaticUpdates: true,
timeZone: "hlyjiqcfksgrpjrct",
additionalUnattendContent: [
{
passName: "OobeSystem",
componentName: "Microsoft-Windows-Shell-Setup",
settingName: "AutoLogon",
content: "bubmqbxjkj",
},
],
patchSettings: {
patchMode: "Manual",
enableHotpatching: true,
assessmentMode: "ImageDefault",
automaticByPlatformSettings: {
rebootSetting: "Unknown",
bypassPlatformSafetyChecksOnUserSchedule: true,
},
},
winRM: {
listeners: [
{
protocol: "Https",
certificateUrl:
"https://myVaultName.vault.azure.net/secrets/myCertName",
},
],
},
enableVMAgentPlatformUpdates: true,
},
linuxConfiguration: {
disablePasswordAuthentication: true,
ssh: {
publicKeys: [
{ path: "kmqz", keyData: "kivgsubusvpprwqaqpjcmhsv" },
],
},
provisionVMAgent: true,
patchSettings: {
patchMode: "ImageDefault",
assessmentMode: "ImageDefault",
automaticByPlatformSettings: {
rebootSetting: "Unknown",
bypassPlatformSafetyChecksOnUserSchedule: true,
},
},
enableVMAgentPlatformUpdates: true,
},
secrets: [
{
sourceVault: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}",
},
vaultCertificates: [
{
certificateUrl:
"https://myVaultName.vault.azure.net/secrets/myCertName",
certificateStore: "nlxrwavpzhueffxsshlun",
},
],
},
],
allowExtensionOperations: true,
requireGuestProvisionSignal: true,
},
storageProfile: {
imageReference: {
publisher: "mqxgwbiyjzmxavhbkd",
offer: "isxgumkarlkomp",
sku: "eojmppqcrnpmxirtp",
version: "wvpcqefgtmqdgltiuz",
sharedGalleryImageId: "kmkgihoxwlawuuhcinfirktdwkmx",
communityGalleryImageId: "vlqe",
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}/versions/{versionName}",
},
osDisk: {
name: "wfttw",
caching: "None",
writeAcceleratorEnabled: true,
createOption: "FromImage",
diffDiskSettings: { option: "Local", placement: "CacheDisk" },
diskSizeGB: 14,
osType: "Windows",
image: {
uri: "https://myStorageAccountName.blob.core.windows.net/myContainerName/myVhdName.vhd",
},
vhdContainers: ["tkzcwddtinkfpnfklatw"],
managedDisk: {
storageAccountType: "Standard_LRS",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
securityProfile: {
securityEncryptionType: "VMGuestStateOnly",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
},
},
deleteOption: "Delete",
},
dataDisks: [
{
name: "eogiykmdmeikswxmigjws",
lun: 14,
caching: "None",
writeAcceleratorEnabled: true,
createOption: "FromImage",
diskSizeGB: 6,
managedDisk: {
storageAccountType: "Standard_LRS",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
securityProfile: {
securityEncryptionType: "VMGuestStateOnly",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
},
},
diskIOPSReadWrite: 27,
diskMBpsReadWrite: 2,
deleteOption: "Delete",
},
],
},
networkProfile: {
healthProbe: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}",
},
networkInterfaceConfigurations: [
{
name: "i",
properties: {
primary: true,
enableAcceleratedNetworking: true,
disableTcpStateTracking: true,
enableFpga: true,
networkSecurityGroup: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}",
},
dnsSettings: { dnsServers: ["nxmmfolhclsesu"] },
ipConfigurations: [
{
name: "oezqhkidfhyywlfzwuotilrpbqnjg",
properties: {
subnet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}",
},
primary: true,
publicIPAddressConfiguration: {
name: "fvpqf",
properties: {
idleTimeoutInMinutes: 9,
dnsSettings: {
domainNameLabel: "ukrddzvmorpmfsczjwtbvp",
domainNameLabelScope: "TenantReuse",
},
ipTags: [
{
ipTagType: "sddgsoemnzgqizale",
tag: "wufmhrjsakbiaetyara",
},
],
publicIPPrefix: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}",
},
publicIPAddressVersion: "IPv4",
deleteOption: "Delete",
},
sku: { name: "Basic", tier: "Regional" },
},
privateIPAddressVersion: "IPv4",
applicationGatewayBackendAddressPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}",
},
],
applicationSecurityGroups: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}",
},
],
loadBalancerBackendAddressPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}",
},
],
loadBalancerInboundNatPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}",
},
],
},
},
],
enableIPForwarding: true,
deleteOption: "Delete",
auxiliaryMode: "None",
auxiliarySku: "None",
},
},
],
networkApiVersion: "2020-11-01",
},
securityProfile: {
uefiSettings: { secureBootEnabled: true, vTpmEnabled: true },
encryptionAtHost: true,
securityType: "TrustedLaunch",
encryptionIdentity: {
userAssignedIdentityResourceId:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}",
},
proxyAgentSettings: {
enabled: true,
mode: "Audit",
keyIncarnationId: 20,
},
},
diagnosticsProfile: {
bootDiagnostics: {
enabled: true,
storageUri: "http://myStorageAccountName.blob.core.windows.net",
},
},
extensionProfile: {
extensions: [
{
name: "bndxuxx",
properties: {
forceUpdateTag: "yhgxw",
publisher: "kpxtirxjfprhs",
type: "pgjilctjjwaa",
typeHandlerVersion: "zevivcoilxmbwlrihhhibq",
autoUpgradeMinorVersion: true,
enableAutomaticUpgrade: true,
settings: {},
protectedSettings: {},
provisionAfterExtensions: ["nftzosroolbcwmpupujzqwqe"],
suppressFailures: true,
protectedSettingsFromKeyVault: {
secretUrl:
"https://myvaultName.vault.azure.net/secrets/secret/mySecretName",
sourceVault: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}",
},
},
},
},
],
extensionsTimeBudget: "mbhjahtdygwgyszdwjtvlvtgchdwil",
},
licenseType: "v",
scheduledEventsProfile: {
terminateNotificationProfile: {
notBeforeTimeout: "iljppmmw",
enable: true,
},
osImageNotificationProfile: {
notBeforeTimeout: "olbpadmevekyczfokodtfprxti",
enable: true,
},
},
userData: "s",
capacityReservation: {
capacityReservationGroup: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}",
},
},
applicationProfile: {
galleryApplications: [
{
tags: "eyrqjbib",
order: 5,
packageReferenceId:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{applicationName}/versions/{versionName}",
configurationReference: "ulztmiavpojpbpbddgnuuiimxcpau",
treatFailureAsDeploymentFailure: true,
enableAutomaticUpgrade: true,
},
],
},
hardwareProfile: {
vmSizeProperties: { vCPUsAvailable: 16, vCPUsPerCore: 23 },
},
serviceArtifactReference: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactsName}/vmArtifactsProfiles/{vmArtifactsProfileName}",
},
securityPostureReference: {
id: "/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest",
excludeExtensions: ["{securityPostureVMExtensionName}"],
isOverridable: true,
},
},
computeApiVersion: "2023-07-01",
platformFaultDomainCount: 1,
},
},
zones: ["zone1", "zone2"],
identity: {
type: "UserAssigned",
userAssignedIdentities: { key9851: {} },
},
tags: { key3518: "luvrnuvsgdpbuofdskkcoqhfh" },
location: "westus",
plan: {
name: "jwgrcrnrtfoxn",
publisher: "iozjbiqqckqm",
product: "cgopbyvdyqikahwyxfpzwaqk",
promotionCode: "naglezezplcaruqogtxnuizslqnnbr",
version: "wa",
},
},
);
console.log(result);
}
/**
* This sample demonstrates how to create a Fleet
*
* @summary create a Fleet
* x-ms-original-file: 2024-11-01/Fleets_CreateOrUpdate_MinimumSet.json
*/
async function fleetsCreateOrUpdateMinimumSet() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const result = await client.fleets.createOrUpdate(
"rgazurefleet",
"testFleet",
{
properties: {
spotPriorityProfile: {
capacity: 2,
minCapacity: 1,
evictionPolicy: "Delete",
allocationStrategy: "PriceCapacityOptimized",
maintain: true,
},
regularPriorityProfile: {
capacity: 2,
minCapacity: 1,
allocationStrategy: "LowestPrice",
},
vmSizesProfile: [
{ name: "Standard_D2s_v3" },
{ name: "Standard_D4s_v3" },
{ name: "Standard_E2s_v3" },
],
computeProfile: {
baseVirtualMachineProfile: {
storageProfile: {
imageReference: {
publisher: "canonical",
offer: "0001-com-ubuntu-server-focal",
sku: "20_04-lts-gen2",
version: "latest",
},
osDisk: {
caching: "ReadWrite",
createOption: "FromImage",
osType: "Linux",
managedDisk: { storageAccountType: "Standard_LRS" },
},
},
osProfile: {
computerNamePrefix: "prefix",
adminUsername: "azureuser",
adminPassword: "TestPassword$0",
linuxConfiguration: { disablePasswordAuthentication: false },
},
networkProfile: {
networkInterfaceConfigurations: [
{
name: "vmNameTest",
properties: {
primary: true,
enableAcceleratedNetworking: false,
ipConfigurations: [
{
name: "vmNameTest",
properties: {
subnet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}",
},
primary: true,
loadBalancerBackendAddressPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}",
},
],
},
},
],
enableIPForwarding: true,
},
},
],
},
},
computeApiVersion: "2023-09-01",
platformFaultDomainCount: 1,
},
},
tags: { key: "fleets-test" },
location: "eastus2euap",
},
);
console.log(result);
}
async function main() {
fleetsCreateOrUpdate();
fleetsCreateOrUpdateMinimumSet();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,24 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { AzureFleetClient } from "@azure/arm-computefleet";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to delete a Fleet
*
* @summary delete a Fleet
* x-ms-original-file: 2024-11-01/Fleets_Delete.json
*/
async function fleetsDelete() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
await client.fleets.delete("rgazurefleet", "testFleet");
}
async function main() {
fleetsDelete();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { AzureFleetClient } from "@azure/arm-computefleet";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to get a Fleet
*
* @summary get a Fleet
* x-ms-original-file: 2024-11-01/Fleets_Get.json
*/
async function fleetsGet() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const result = await client.fleets.get("rgazurefleet", "testFleet");
console.log(result);
}
async function main() {
fleetsGet();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { AzureFleetClient } from "@azure/arm-computefleet";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to list Fleet resources by resource group
*
* @summary list Fleet resources by resource group
* x-ms-original-file: 2024-11-01/Fleets_ListByResourceGroup.json
*/
async function fleetsListByResourceGroup() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.fleets.listByResourceGroup("rgazurefleet")) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
fleetsListByResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { AzureFleetClient } from "@azure/arm-computefleet";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to list Fleet resources by subscription ID
*
* @summary list Fleet resources by subscription ID
* x-ms-original-file: 2024-11-01/Fleets_ListBySubscription.json
*/
async function fleetsListBySubscription() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.fleets.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
fleetsListBySubscription();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,32 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { AzureFleetClient } from "@azure/arm-computefleet";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to list VirtualMachineScaleSet resources by Fleet
*
* @summary list VirtualMachineScaleSet resources by Fleet
* x-ms-original-file: 2024-11-01/Fleets_ListVirtualMachineScaleSets.json
*/
async function fleetsListVirtualMachineScaleSets() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.fleets.listVirtualMachineScaleSets(
"rgazurefleet",
"myFleet",
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
fleetsListVirtualMachineScaleSets();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,358 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { AzureFleetClient } from "@azure/arm-computefleet";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to update a Fleet
*
* @summary update a Fleet
* x-ms-original-file: 2024-11-01/Fleets_Update.json
*/
async function fleetsUpdate() {
const credential = new DefaultAzureCredential();
const subscriptionId = "1DC2F28C-A625-4B0E-9748-9885A3C9E9EB";
const client = new AzureFleetClient(credential, subscriptionId);
const result = await client.fleets.update("rgazurefleet", "testFleet", {
identity: { type: "UserAssigned", userAssignedIdentities: {} },
tags: {},
properties: {
spotPriorityProfile: {
capacity: 20,
minCapacity: 10,
maxPricePerVM: 0.00865,
evictionPolicy: "Delete",
allocationStrategy: "PriceCapacityOptimized",
maintain: true,
},
regularPriorityProfile: {
capacity: 20,
minCapacity: 10,
allocationStrategy: "LowestPrice",
},
vmSizesProfile: [{ name: "Standard_d1_v2", rank: 19225 }],
computeProfile: {
baseVirtualMachineProfile: {
osProfile: {
computerNamePrefix: "o",
adminUsername: "nrgzqciiaaxjrqldbmjbqkyhntp",
adminPassword: "adfbrdxpv",
customData: "xjjib",
windowsConfiguration: {
provisionVMAgent: true,
enableAutomaticUpdates: true,
timeZone: "hlyjiqcfksgrpjrct",
additionalUnattendContent: [
{
passName: "OobeSystem",
componentName: "Microsoft-Windows-Shell-Setup",
settingName: "AutoLogon",
content: "bubmqbxjkj",
},
],
patchSettings: {
patchMode: "Manual",
enableHotpatching: true,
assessmentMode: "ImageDefault",
automaticByPlatformSettings: {
rebootSetting: "Unknown",
bypassPlatformSafetyChecksOnUserSchedule: true,
},
},
winRM: {
listeners: [
{
protocol: "Http",
certificateUrl:
"https://myVaultName.vault.azure.net/secrets/myCertName",
},
],
},
enableVMAgentPlatformUpdates: true,
},
linuxConfiguration: {
disablePasswordAuthentication: true,
ssh: {
publicKeys: [
{ path: "kmqz", keyData: "kivgsubusvpprwqaqpjcmhsv" },
],
},
provisionVMAgent: true,
patchSettings: {
patchMode: "ImageDefault",
assessmentMode: "ImageDefault",
automaticByPlatformSettings: {
rebootSetting: "Unknown",
bypassPlatformSafetyChecksOnUserSchedule: true,
},
},
enableVMAgentPlatformUpdates: true,
},
secrets: [
{
sourceVault: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}",
},
vaultCertificates: [
{
certificateUrl:
"https://myVaultName.vault.azure.net/secrets/myCertName",
certificateStore: "nlxrwavpzhueffxsshlun",
},
],
},
],
allowExtensionOperations: true,
requireGuestProvisionSignal: true,
},
storageProfile: {
imageReference: {
publisher: "mqxgwbiyjzmxavhbkd",
offer: "isxgumkarlkomp",
sku: "eojmppqcrnpmxirtp",
version: "wvpcqefgtmqdgltiuz",
sharedGalleryImageId: "kmkgihoxwlawuuhcinfirktdwkmx",
communityGalleryImageId: "vlqe",
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}/versions/{versionName}",
},
osDisk: {
name: "wfttw",
caching: "None",
writeAcceleratorEnabled: true,
createOption: "FromImage",
diffDiskSettings: { option: "Local", placement: "CacheDisk" },
diskSizeGB: 14,
osType: "Windows",
image: {
uri: "https://myStorageAccountName.blob.core.windows.net/myContainerName/myVhdName.vhd",
},
vhdContainers: ["tkzcwddtinkfpnfklatw"],
managedDisk: {
storageAccountType: "Standard_LRS",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
securityProfile: {
securityEncryptionType: "VMGuestStateOnly",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
},
},
deleteOption: "Delete",
},
dataDisks: [
{
name: "eogiykmdmeikswxmigjws",
lun: 14,
caching: "None",
writeAcceleratorEnabled: true,
createOption: "FromImage",
diskSizeGB: 6,
managedDisk: {
storageAccountType: "Standard_LRS",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
securityProfile: {
securityEncryptionType: "VMGuestStateOnly",
diskEncryptionSet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
},
},
diskIOPSReadWrite: 27,
diskMBpsReadWrite: 2,
deleteOption: "Delete",
},
],
},
networkProfile: {
healthProbe: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}",
},
networkInterfaceConfigurations: [
{
name: "i",
properties: {
primary: true,
enableAcceleratedNetworking: true,
disableTcpStateTracking: true,
enableFpga: true,
networkSecurityGroup: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}",
},
dnsSettings: { dnsServers: ["nxmmfolhclsesu"] },
ipConfigurations: [
{
name: "oezqhkidfhyywlfzwuotilrpbqnjg",
properties: {
subnet: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}",
},
primary: true,
publicIPAddressConfiguration: {
name: "fvpqf",
properties: {
idleTimeoutInMinutes: 9,
dnsSettings: {
domainNameLabel: "ukrddzvmorpmfsczjwtbvp",
domainNameLabelScope: "TenantReuse",
},
ipTags: [
{
ipTagType: "sddgsoemnzgqizale",
tag: "wufmhrjsakbiaetyara",
},
],
publicIPPrefix: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}",
},
publicIPAddressVersion: "IPv4",
deleteOption: "Delete",
},
sku: { name: "Basic", tier: "Regional" },
},
privateIPAddressVersion: "IPv4",
applicationGatewayBackendAddressPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}",
},
],
applicationSecurityGroups: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}",
},
],
loadBalancerBackendAddressPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}",
},
],
loadBalancerInboundNatPools: [
{
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}",
},
],
},
},
],
enableIPForwarding: true,
deleteOption: "Delete",
auxiliaryMode: "None",
auxiliarySku: "None",
},
},
],
networkApiVersion: "2020-11-01",
},
securityProfile: {
uefiSettings: { secureBootEnabled: true, vTpmEnabled: true },
encryptionAtHost: true,
securityType: "TrustedLaunch",
encryptionIdentity: {
userAssignedIdentityResourceId:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}",
},
proxyAgentSettings: {
enabled: true,
mode: "Audit",
keyIncarnationId: 20,
},
},
diagnosticsProfile: {
bootDiagnostics: {
enabled: true,
storageUri: "http://myStorageAccountName.blob.core.windows.net",
},
},
extensionProfile: {
extensions: [
{
name: "bndxuxx",
properties: {
forceUpdateTag: "yhgxw",
publisher: "kpxtirxjfprhs",
type: "pgjilctjjwaa",
typeHandlerVersion: "zevivcoilxmbwlrihhhibq",
autoUpgradeMinorVersion: true,
enableAutomaticUpgrade: true,
settings: {},
protectedSettings: {},
provisionAfterExtensions: ["nftzosroolbcwmpupujzqwqe"],
suppressFailures: true,
protectedSettingsFromKeyVault: {
secretUrl:
"https://myVaultName.vault.azure.net/secrets/secret/mySecretName",
sourceVault: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}",
},
},
},
},
],
extensionsTimeBudget: "mbhjahtdygwgyszdwjtvlvtgchdwil",
},
licenseType: "v",
scheduledEventsProfile: {
terminateNotificationProfile: {
notBeforeTimeout: "iljppmmw",
enable: true,
},
osImageNotificationProfile: {
notBeforeTimeout: "olbpadmevekyczfokodtfprxti",
enable: true,
},
},
userData: "s",
capacityReservation: {
capacityReservationGroup: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}",
},
},
applicationProfile: {
galleryApplications: [
{
tags: "eyrqjbib",
order: 5,
packageReferenceId:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{applicationName}/versions/{versionName}",
configurationReference: "ulztmiavpojpbpbddgnuuiimxcpau",
treatFailureAsDeploymentFailure: true,
enableAutomaticUpgrade: true,
},
],
},
hardwareProfile: {
vmSizeProperties: { vCPUsAvailable: 16, vCPUsPerCore: 23 },
},
serviceArtifactReference: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactsName}/vmArtifactsProfiles/{vmArtifactsProfileName}",
},
securityPostureReference: {
id: "/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest",
excludeExtensions: ["{securityPostureVMExtensionName}"],
isOverridable: true,
},
},
computeApiVersion: "2023-07-01",
platformFaultDomainCount: 1,
},
},
plan: {
name: "jwgrcrnrtfoxn",
publisher: "iozjbiqqckqm",
product: "cgopbyvdyqikahwyxfpzwaqk",
promotionCode: "naglezezplcaruqogtxnuizslqnnbr",
version: "wa",
},
});
console.log(result);
}
async function main() {
fleetsUpdate();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { AzureFleetClient } from "@azure/arm-computefleet";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to list the operations for the provider
*
* @summary list the operations for the provider
* x-ms-original-file: 2024-11-01/Operations_List.json
*/
async function operationsList() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-00000000000";
const client = new AzureFleetClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
operationsList();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"alwaysStrict": true,
"outDir": "dist",
"rootDir": "src"
},
"include": [
"src/**/*.ts"
]
}

Просмотреть файл

@ -1,10 +1,11 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { logger } from "../logger.js";
import { Client, ClientOptions, getClient } from "@azure-rest/core-client";
import { TokenCredential } from "@azure/core-auth";
import { ClientOptions } from "@azure-rest/core-client";
import { AzureFleetContext } from "../rest/index.js";
import getClient from "../rest/index.js";
export interface AzureFleetContext extends Client {}
/** Optional parameters for the client. */
export interface AzureFleetClientOptionalParams extends ClientOptions {
@ -12,18 +13,42 @@ export interface AzureFleetClientOptionalParams extends ClientOptions {
apiVersion?: string;
}
export { AzureFleetContext } from "../rest/index.js";
export function createAzureFleet(
credential: TokenCredential,
options: AzureFleetClientOptionalParams = {},
): AzureFleetContext {
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
const userAgentPrefix = prefixFromOptions ? `${prefixFromOptions} azsdk-js-api` : "azsdk-js-api";
const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://management.azure.com`;
const clientContext = getClient(credential, {
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
const userAgentInfo = `azsdk-js-arm-computefleet/1.0.0`;
const userAgentPrefix = prefixFromOptions
? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`
: `azsdk-js-api ${userAgentInfo}`;
const { apiVersion: _, ...updatedOptions } = {
...options,
userAgentOptions: { userAgentPrefix },
loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },
credentials: {
scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`],
},
};
const clientContext = getClient(endpointUrl, credential, updatedOptions);
clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" });
const apiVersion = options.apiVersion ?? "2024-11-01";
clientContext.pipeline.addPolicy({
name: "ClientApiVersionPolicy",
sendRequest: (req, next) => {
// Use the apiVersion defined in request url directly
// Append one if there is no apiVersion and we have one at client options
const url = new URL(req.url);
if (!url.searchParams.get("api-version")) {
req.url = `${req.url}${
Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"
}api-version=${apiVersion}`;
}
return next(req);
},
});
return clientContext;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -3,9 +3,19 @@
export {
createAzureFleet,
AzureFleetClientOptionalParams,
AzureFleetContext,
AzureFleetClientOptionalParams,
} from "./azureFleetContext.js";
export {
OperationsListOptionalParams,
FleetsGetOptionalParams,
FleetsCreateOrUpdateOptionalParams,
FleetsUpdateOptionalParams,
FleetsDeleteOptionalParams,
FleetsListByResourceGroupOptionalParams,
FleetsListBySubscriptionOptionalParams,
FleetsListVirtualMachineScaleSetsOptionalParams,
} from "./options.js";
export {
fleetsGet,
fleetsCreateOrUpdate,

Просмотреть файл

@ -1,57 +1,41 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { Operation, _OperationListResult } from "../../models/models.js";
import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js";
import { buildPagedAsyncIterator } from "../pagingHelpers.js";
import { AzureFleetContext as Client, OperationsListOptionalParams } from "../index.js";
import {
isUnexpected,
AzureFleetContext as Client,
OperationsList200Response,
OperationsListDefaultResponse,
} from "../../rest/index.js";
_OperationListResult,
_operationListResultDeserializer,
Operation,
} from "../../models/models.js";
import {
PagedAsyncIterableIterator,
buildPagedAsyncIterator,
} from "../../static-helpers/pagingHelpers.js";
import {
StreamableMethod,
operationOptionsToRequestParameters,
PathUncheckedResponse,
createRestError,
operationOptionsToRequestParameters,
} from "@azure-rest/core-client";
import { OperationsListOptionalParams } from "../../models/options.js";
export function _operationsListSend(
context: Client,
options: OperationsListOptionalParams = { requestOptions: {} },
): StreamableMethod<OperationsList200Response | OperationsListDefaultResponse> {
): StreamableMethod {
return context
.path("/providers/Microsoft.AzureFleet/operations")
.get({ ...operationOptionsToRequestParameters(options) });
}
export async function _operationsListDeserialize(
result: OperationsList200Response | OperationsListDefaultResponse,
result: PathUncheckedResponse,
): Promise<_OperationListResult> {
if (isUnexpected(result)) {
const expectedStatuses = ["200"];
if (!expectedStatuses.includes(result.status)) {
throw createRestError(result);
}
return {
value: result.body["value"].map((p) => {
return {
name: p["name"],
isDataAction: p["isDataAction"],
display: !p.display
? undefined
: {
provider: p.display?.["provider"],
resource: p.display?.["resource"],
operation: p.display?.["operation"],
description: p.display?.["description"],
},
origin: p["origin"],
actionType: p["actionType"],
};
}),
nextLink: result.body["nextLink"],
};
return _operationListResultDeserializer(result.body);
}
/** List the operations for the provider */
@ -63,6 +47,7 @@ export function operationsList(
context,
() => _operationsListSend(context, options),
_operationsListDeserialize,
["200"],
{ itemName: "value", nextLinkName: "nextLink" },
);
}

Просмотреть файл

@ -1,15 +1,15 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { TokenCredential } from "@azure/core-auth";
import { Pipeline } from "@azure/core-rest-pipeline";
import { getOperationsOperations, OperationsOperations } from "./classic/operations/index.js";
import { getFleetsOperations, FleetsOperations } from "./classic/fleets/index.js";
import {
createAzureFleet,
AzureFleetClientOptionalParams,
AzureFleetContext,
AzureFleetClientOptionalParams,
} from "./api/index.js";
import { Pipeline } from "@azure/core-rest-pipeline";
import { TokenCredential } from "@azure/core-auth";
export { AzureFleetClientOptionalParams } from "./api/azureFleetContext.js";
@ -27,7 +27,6 @@ export class AzureFleetClient {
const userAgentPrefix = prefixFromOptions
? `${prefixFromOptions} azsdk-js-client`
: "azsdk-js-client";
this._client = createAzureFleet(credential, {
...options,
userAgentOptions: { userAgentPrefix },

Просмотреть файл

@ -2,7 +2,6 @@
// Licensed under the MIT License.
import { AzureFleetContext } from "../../api/azureFleetContext.js";
import { Fleet, FleetUpdate, VirtualMachineScaleSet } from "../../models/models.js";
import {
fleetsGet,
fleetsCreateOrUpdate,
@ -12,8 +11,6 @@ import {
fleetsListBySubscription,
fleetsListVirtualMachineScaleSets,
} from "../../api/fleets/index.js";
import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js";
import { PollerLike, OperationState } from "@azure/core-lro";
import {
FleetsGetOptionalParams,
FleetsCreateOrUpdateOptionalParams,
@ -22,7 +19,10 @@ import {
FleetsListByResourceGroupOptionalParams,
FleetsListBySubscriptionOptionalParams,
FleetsListVirtualMachineScaleSetsOptionalParams,
} from "../../models/options.js";
} from "../../api/options.js";
import { Fleet, FleetUpdate, VirtualMachineScaleSet } from "../../models/models.js";
import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js";
import { PollerLike, OperationState } from "@azure/core-lro";
/** Interface representing a Fleets operations. */
export interface FleetsOperations {

Просмотреть файл

@ -2,10 +2,10 @@
// Licensed under the MIT License.
import { AzureFleetContext } from "../../api/azureFleetContext.js";
import { Operation } from "../../models/models.js";
import { operationsList } from "../../api/operations/index.js";
import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js";
import { OperationsListOptionalParams } from "../../models/options.js";
import { OperationsListOptionalParams } from "../../api/options.js";
import { Operation } from "../../models/models.js";
import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js";
/** Interface representing a Operations operations. */
export interface OperationsOperations {

Просмотреть файл

@ -1,18 +1,19 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
export { AzureFleetClient, AzureFleetClientOptionalParams } from "./azureFleetClient.js";
import {
PageSettings,
ContinuablePage,
PagedAsyncIterableIterator,
} from "./static-helpers/pagingHelpers.js";
export { AzureFleetClient } from "./azureFleetClient.js";
export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js";
export {
Resource,
SystemData,
KnownCreatedByType,
CreatedByType,
TrackedResource,
Fleet,
FleetProperties,
KnownResourceProvisioningState,
ResourceProvisioningState,
ProvisioningState,
KnownProvisioningState,
SpotPriorityProfile,
KnownEvictionPolicy,
EvictionPolicy,
@ -22,7 +23,25 @@ export {
KnownRegularPriorityAllocationStrategy,
RegularPriorityAllocationStrategy,
VmSizeProfile,
ComputeProfile,
VMAttributes,
VMAttributeMinMaxInteger,
VMAttributeMinMaxDouble,
KnownVMAttributeSupport,
VMAttributeSupport,
KnownLocalStorageDiskType,
LocalStorageDiskType,
KnownAcceleratorManufacturer,
AcceleratorManufacturer,
KnownAcceleratorType,
AcceleratorType,
KnownVMCategory,
VMCategory,
KnownArchitectureType,
ArchitectureType,
KnownCpuManufacturer,
CpuManufacturer,
AdditionalLocationsProfile,
LocationProfile,
BaseVirtualMachineProfile,
VirtualMachineScaleSetOSProfile,
WindowsConfiguration,
@ -134,14 +153,18 @@ export {
VMSizeProperties,
ServiceArtifactReference,
SecurityPostureReference,
ComputeProfile,
AdditionalCapabilities,
ManagedServiceIdentity,
KnownManagedServiceIdentityType,
ManagedServiceIdentityType,
UserAssignedIdentity,
Plan,
ErrorResponse,
ErrorDetail,
ErrorAdditionalInfo,
TrackedResource,
Resource,
SystemData,
KnownCreatedByType,
CreatedByType,
FleetUpdate,
ManagedServiceIdentityUpdate,
ResourcePlanUpdate,
@ -155,8 +178,9 @@ export {
Origin,
KnownActionType,
ActionType,
Versions,
ProvisioningState,
} from "./models/index.js";
export {
AzureFleetClientOptionalParams,
OperationsListOptionalParams,
FleetsGetOptionalParams,
FleetsCreateOrUpdateOptionalParams,
@ -165,8 +189,6 @@ export {
FleetsListByResourceGroupOptionalParams,
FleetsListBySubscriptionOptionalParams,
FleetsListVirtualMachineScaleSetsOptionalParams,
PageSettings,
ContinuablePage,
PagedAsyncIterableIterator,
} from "./models/index.js";
} from "./api/index.js";
export { FleetsOperations, OperationsOperations } from "./classic/index.js";
export { PageSettings, ContinuablePage, PagedAsyncIterableIterator };

Просмотреть файл

@ -2,15 +2,10 @@
// Licensed under the MIT License.
export {
Resource,
SystemData,
KnownCreatedByType,
CreatedByType,
TrackedResource,
Fleet,
FleetProperties,
KnownResourceProvisioningState,
ResourceProvisioningState,
KnownProvisioningState,
ProvisioningState,
SpotPriorityProfile,
KnownEvictionPolicy,
EvictionPolicy,
@ -20,7 +15,25 @@ export {
KnownRegularPriorityAllocationStrategy,
RegularPriorityAllocationStrategy,
VmSizeProfile,
ComputeProfile,
VMAttributes,
VMAttributeMinMaxInteger,
VMAttributeMinMaxDouble,
KnownVMAttributeSupport,
VMAttributeSupport,
KnownLocalStorageDiskType,
LocalStorageDiskType,
KnownAcceleratorManufacturer,
AcceleratorManufacturer,
KnownAcceleratorType,
AcceleratorType,
KnownVMCategory,
VMCategory,
KnownArchitectureType,
ArchitectureType,
KnownCpuManufacturer,
CpuManufacturer,
AdditionalLocationsProfile,
LocationProfile,
BaseVirtualMachineProfile,
VirtualMachineScaleSetOSProfile,
WindowsConfiguration,
@ -132,14 +145,18 @@ export {
VMSizeProperties,
ServiceArtifactReference,
SecurityPostureReference,
ComputeProfile,
AdditionalCapabilities,
ManagedServiceIdentity,
KnownManagedServiceIdentityType,
ManagedServiceIdentityType,
UserAssignedIdentity,
Plan,
ErrorResponse,
ErrorDetail,
ErrorAdditionalInfo,
TrackedResource,
Resource,
SystemData,
KnownCreatedByType,
CreatedByType,
FleetUpdate,
ManagedServiceIdentityUpdate,
ResourcePlanUpdate,
@ -153,17 +170,4 @@ export {
Origin,
KnownActionType,
ActionType,
Versions,
ProvisioningState,
} from "./models.js";
export {
OperationsListOptionalParams,
FleetsGetOptionalParams,
FleetsCreateOrUpdateOptionalParams,
FleetsUpdateOptionalParams,
FleetsDeleteOptionalParams,
FleetsListByResourceGroupOptionalParams,
FleetsListBySubscriptionOptionalParams,
FleetsListVirtualMachineScaleSetsOptionalParams,
} from "./options.js";
export { PageSettings, ContinuablePage, PagedAsyncIterableIterator } from "./pagingTypes.js";

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,79 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* Options for the byPage method
*/
export interface PageSettings {
/**
* A reference to a specific page to start iterating from.
*/
continuationToken?: string;
}
/**
* An interface that describes a page of results.
*/
export type ContinuablePage<TElement, TPage = TElement[]> = TPage & {
/**
* The token that keeps track of where to continue the iterator
*/
continuationToken?: string;
};
/**
* An interface that allows async iterable iteration both to completion and by page.
*/
export interface PagedAsyncIterableIterator<
TElement,
TPage = TElement[],
TPageSettings extends PageSettings = PageSettings,
> {
/**
* The next method, part of the iteration protocol
*/
next(): Promise<IteratorResult<TElement>>;
/**
* The connection to the async iterator, part of the iteration protocol
*/
[Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;
/**
* Return an AsyncIterableIterator that works a page at a time
*/
byPage: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;
}
/**
* An interface that describes how to communicate with the service.
*/
export interface PagedResult<
TElement,
TPage = TElement[],
TPageSettings extends PageSettings = PageSettings,
> {
/**
* Link to the first page of results.
*/
firstPageLink?: string;
/**
* A method that returns a page of results.
*/
getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>;
/**
* a function to implement the `byPage` method on the paged async iterator.
*/
byPage?: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;
/**
* A function to extract elements from a page.
*/
toElements?: (page: TPage) => TElement[];
}
/**
* Options for the paging helper
*/
export interface BuildPagedAsyncIteratorOptions {
itemName?: string;
nextLinkName?: string;
}

Просмотреть файл

@ -1,61 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { getClient, ClientOptions } from "@azure-rest/core-client";
import { logger } from "../logger.js";
import { TokenCredential } from "@azure/core-auth";
import { AzureFleetContext } from "./clientDefinitions.js";
/** The optional parameters for the client */
export interface AzureFleetContextOptions extends ClientOptions {
/** The api version option of the client */
apiVersion?: string;
}
/**
* Initialize a new instance of `AzureFleetContext`
* @param credentials - uniquely identify client credential
* @param options - the parameter for all optional parameters
*/
export default function createClient(
credentials: TokenCredential,
{ apiVersion = "2024-05-01-preview", ...options }: AzureFleetContextOptions = {},
): AzureFleetContext {
const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://management.azure.com`;
const userAgentInfo = `azsdk-js-arm-computefleet/1.0.0-beta.1`;
const userAgentPrefix =
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
: `${userAgentInfo}`;
options = {
...options,
userAgentOptions: {
userAgentPrefix,
},
loggingOptions: {
logger: options.loggingOptions?.logger ?? logger.info,
},
credentials: {
scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`],
},
};
const client = getClient(endpointUrl, credentials, options) as AzureFleetContext;
client.pipeline.removePolicy({ name: "ApiVersionPolicy" });
client.pipeline.addPolicy({
name: "ClientApiVersionPolicy",
sendRequest: (req, next) => {
// Use the apiVersion defined in request url directly
// Append one if there is no apiVersion and we have one at client options
const url = new URL(req.url);
if (!url.searchParams.get("api-version") && apiVersion) {
req.url = `${req.url}${
Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"
}api-version=${apiVersion}`;
}
return next(req);
},
});
return client;
}

Просмотреть файл

@ -1,130 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
OperationsListParameters,
FleetsGetParameters,
FleetsCreateOrUpdateParameters,
FleetsUpdateParameters,
FleetsDeleteParameters,
FleetsListByResourceGroupParameters,
FleetsListBySubscriptionParameters,
FleetsListVirtualMachineScaleSetsParameters,
} from "./parameters.js";
import {
OperationsList200Response,
OperationsListDefaultResponse,
FleetsGet200Response,
FleetsGetDefaultResponse,
FleetsCreateOrUpdate200Response,
FleetsCreateOrUpdate201Response,
FleetsCreateOrUpdateDefaultResponse,
FleetsUpdate200Response,
FleetsUpdate202Response,
FleetsUpdateDefaultResponse,
FleetsDelete202Response,
FleetsDelete204Response,
FleetsDeleteDefaultResponse,
FleetsListByResourceGroup200Response,
FleetsListByResourceGroupDefaultResponse,
FleetsListBySubscription200Response,
FleetsListBySubscriptionDefaultResponse,
FleetsListVirtualMachineScaleSets200Response,
FleetsListVirtualMachineScaleSetsDefaultResponse,
} from "./responses.js";
import { Client, StreamableMethod } from "@azure-rest/core-client";
export interface OperationsList {
/** List the operations for the provider */
get(
options?: OperationsListParameters,
): StreamableMethod<OperationsList200Response | OperationsListDefaultResponse>;
}
export interface FleetsGet {
/** Get a Fleet */
get(
options?: FleetsGetParameters,
): StreamableMethod<FleetsGet200Response | FleetsGetDefaultResponse>;
/** Create a Fleet */
put(
options: FleetsCreateOrUpdateParameters,
): StreamableMethod<
| FleetsCreateOrUpdate200Response
| FleetsCreateOrUpdate201Response
| FleetsCreateOrUpdateDefaultResponse
>;
/** Update a Fleet */
patch(
options: FleetsUpdateParameters,
): StreamableMethod<
FleetsUpdate200Response | FleetsUpdate202Response | FleetsUpdateDefaultResponse
>;
/** Delete a Fleet */
delete(
options?: FleetsDeleteParameters,
): StreamableMethod<
FleetsDelete202Response | FleetsDelete204Response | FleetsDeleteDefaultResponse
>;
}
export interface FleetsListByResourceGroup {
/** List Fleet resources by resource group */
get(
options?: FleetsListByResourceGroupParameters,
): StreamableMethod<
FleetsListByResourceGroup200Response | FleetsListByResourceGroupDefaultResponse
>;
}
export interface FleetsListBySubscription {
/** List Fleet resources by subscription ID */
get(
options?: FleetsListBySubscriptionParameters,
): StreamableMethod<
FleetsListBySubscription200Response | FleetsListBySubscriptionDefaultResponse
>;
}
export interface FleetsListVirtualMachineScaleSets {
/** List VirtualMachineScaleSet resources by Fleet */
get(
options?: FleetsListVirtualMachineScaleSetsParameters,
): StreamableMethod<
FleetsListVirtualMachineScaleSets200Response | FleetsListVirtualMachineScaleSetsDefaultResponse
>;
}
export interface Routes {
/** Resource for '/providers/Microsoft.AzureFleet/operations' has methods for the following verbs: get */
(path: "/providers/Microsoft.AzureFleet/operations"): OperationsList;
/** Resource for '/subscriptions/\{subscriptionId\}/resourceGroups/\{resourceGroupName\}/providers/Microsoft.AzureFleet/fleets/\{fleetName\}' has methods for the following verbs: get, put, patch, delete */
(
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{fleetName}",
subscriptionId: string,
resourceGroupName: string,
fleetName: string,
): FleetsGet;
/** Resource for '/subscriptions/\{subscriptionId\}/resourceGroups/\{resourceGroupName\}/providers/Microsoft.AzureFleet/fleets' has methods for the following verbs: get */
(
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets",
subscriptionId: string,
resourceGroupName: string,
): FleetsListByResourceGroup;
/** Resource for '/subscriptions/\{subscriptionId\}/providers/Microsoft.AzureFleet/fleets' has methods for the following verbs: get */
(
path: "/subscriptions/{subscriptionId}/providers/Microsoft.AzureFleet/fleets",
subscriptionId: string,
): FleetsListBySubscription;
/** Resource for '/subscriptions/\{subscriptionId\}/resourceGroups/\{resourceGroupName\}/providers/Microsoft.AzureFleet/fleets/\{name\}/virtualMachineScaleSets' has methods for the following verbs: get */
(
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{name}/virtualMachineScaleSets",
subscriptionId: string,
resourceGroupName: string,
name: string,
): FleetsListVirtualMachineScaleSets;
}
export type AzureFleetContext = Client & {
path: Routes;
};

Просмотреть файл

@ -1,16 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import AzureFleetClient from "./azureFleetClient.js";
export * from "./azureFleetClient.js";
export * from "./parameters.js";
export * from "./responses.js";
export * from "./clientDefinitions.js";
export * from "./isUnexpected.js";
export * from "./models.js";
export * from "./outputModels.js";
export * from "./paginateHelper.js";
export * from "./pollingHelper.js";
export default AzureFleetClient;

Просмотреть файл

@ -1,191 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
OperationsList200Response,
OperationsListDefaultResponse,
FleetsGet200Response,
FleetsGetDefaultResponse,
FleetsCreateOrUpdate200Response,
FleetsCreateOrUpdate201Response,
FleetsCreateOrUpdateLogicalResponse,
FleetsCreateOrUpdateDefaultResponse,
FleetsUpdate200Response,
FleetsUpdate202Response,
FleetsUpdateLogicalResponse,
FleetsUpdateDefaultResponse,
FleetsDelete202Response,
FleetsDelete204Response,
FleetsDeleteLogicalResponse,
FleetsDeleteDefaultResponse,
FleetsListByResourceGroup200Response,
FleetsListByResourceGroupDefaultResponse,
FleetsListBySubscription200Response,
FleetsListBySubscriptionDefaultResponse,
FleetsListVirtualMachineScaleSets200Response,
FleetsListVirtualMachineScaleSetsDefaultResponse,
} from "./responses.js";
const responseMap: Record<string, string[]> = {
"GET /providers/Microsoft.AzureFleet/operations": ["200"],
"GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{fleetName}":
["200"],
"PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{fleetName}":
["200", "201"],
"PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{fleetName}":
["200", "202"],
"DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{fleetName}":
["202", "204"],
"GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets":
["200"],
"GET /subscriptions/{subscriptionId}/providers/Microsoft.AzureFleet/fleets": ["200"],
"GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{name}/virtualMachineScaleSets":
["200"],
};
export function isUnexpected(
response: OperationsList200Response | OperationsListDefaultResponse,
): response is OperationsListDefaultResponse;
export function isUnexpected(
response: FleetsGet200Response | FleetsGetDefaultResponse,
): response is FleetsGetDefaultResponse;
export function isUnexpected(
response:
| FleetsCreateOrUpdate200Response
| FleetsCreateOrUpdate201Response
| FleetsCreateOrUpdateLogicalResponse
| FleetsCreateOrUpdateDefaultResponse,
): response is FleetsCreateOrUpdateDefaultResponse;
export function isUnexpected(
response:
| FleetsUpdate200Response
| FleetsUpdate202Response
| FleetsUpdateLogicalResponse
| FleetsUpdateDefaultResponse,
): response is FleetsUpdateDefaultResponse;
export function isUnexpected(
response:
| FleetsDelete202Response
| FleetsDelete204Response
| FleetsDeleteLogicalResponse
| FleetsDeleteDefaultResponse,
): response is FleetsDeleteDefaultResponse;
export function isUnexpected(
response: FleetsListByResourceGroup200Response | FleetsListByResourceGroupDefaultResponse,
): response is FleetsListByResourceGroupDefaultResponse;
export function isUnexpected(
response: FleetsListBySubscription200Response | FleetsListBySubscriptionDefaultResponse,
): response is FleetsListBySubscriptionDefaultResponse;
export function isUnexpected(
response:
| FleetsListVirtualMachineScaleSets200Response
| FleetsListVirtualMachineScaleSetsDefaultResponse,
): response is FleetsListVirtualMachineScaleSetsDefaultResponse;
export function isUnexpected(
response:
| OperationsList200Response
| OperationsListDefaultResponse
| FleetsGet200Response
| FleetsGetDefaultResponse
| FleetsCreateOrUpdate200Response
| FleetsCreateOrUpdate201Response
| FleetsCreateOrUpdateLogicalResponse
| FleetsCreateOrUpdateDefaultResponse
| FleetsUpdate200Response
| FleetsUpdate202Response
| FleetsUpdateLogicalResponse
| FleetsUpdateDefaultResponse
| FleetsDelete202Response
| FleetsDelete204Response
| FleetsDeleteLogicalResponse
| FleetsDeleteDefaultResponse
| FleetsListByResourceGroup200Response
| FleetsListByResourceGroupDefaultResponse
| FleetsListBySubscription200Response
| FleetsListBySubscriptionDefaultResponse
| FleetsListVirtualMachineScaleSets200Response
| FleetsListVirtualMachineScaleSetsDefaultResponse,
): response is
| OperationsListDefaultResponse
| FleetsGetDefaultResponse
| FleetsCreateOrUpdateDefaultResponse
| FleetsUpdateDefaultResponse
| FleetsDeleteDefaultResponse
| FleetsListByResourceGroupDefaultResponse
| FleetsListBySubscriptionDefaultResponse
| FleetsListVirtualMachineScaleSetsDefaultResponse {
const lroOriginal = response.headers["x-ms-original-url"];
const url = new URL(lroOriginal ?? response.request.url);
const method = response.request.method;
let pathDetails = responseMap[`${method} ${url.pathname}`];
if (!pathDetails) {
pathDetails = getParametrizedPathSuccess(method, url.pathname);
}
return !pathDetails.includes(response.status);
}
function getParametrizedPathSuccess(method: string, path: string): string[] {
const pathParts = path.split("/");
// Traverse list to match the longest candidate
// matchedLen: the length of candidate path
// matchedValue: the matched status code array
let matchedLen = -1,
matchedValue: string[] = [];
// Iterate the responseMap to find a match
for (const [key, value] of Object.entries(responseMap)) {
// Extracting the path from the map key which is in format
// GET /path/foo
if (!key.startsWith(method)) {
continue;
}
const candidatePath = getPathFromMapKey(key);
// Get each part of the url path
const candidateParts = candidatePath.split("/");
// track if we have found a match to return the values found.
let found = true;
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) {
const start = candidateParts[i]!.indexOf("}") + 1,
end = candidateParts[i]?.length;
// If the current part of the candidate is a "template" part
// Try to use the suffix of pattern to match the path
// {guid} ==> $
// {guid}:export ==> :export$
const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(
pathParts[j] || "",
);
if (!isMatched) {
found = false;
break;
}
continue;
}
// If the candidate part is not a template and
// the parts don't match mark the candidate as not found
// to move on with the next candidate path.
if (candidateParts[i] !== pathParts[j]) {
found = false;
break;
}
}
// We finished evaluating the current candidate parts
// Update the matched value if and only if we found the longer pattern
if (found && candidatePath.length > matchedLen) {
matchedLen = candidatePath.length;
matchedValue = value;
}
}
return matchedValue;
}
function getPathFromMapKey(mapKey: string): string {
const pathStart = mapKey.indexOf("/");
return mapKey.slice(pathStart);
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,131 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { getPagedAsyncIterator, PagedAsyncIterableIterator, PagedResult } from "@azure/core-paging";
import { Client, createRestError, PathUncheckedResponse } from "@azure-rest/core-client";
/**
* Helper type to extract the type of an array
*/
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,
) => Promise<{
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>[]>;
}
/**
* Helper type to infer the Type of the paged elements from the response type
* This type is generated based on the swagger information for x-ms-pageable
* specifically on the itemName property which indicates the property of the response
* where the page items are found. The default value is `value`.
* 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 };
}
? GetArrayType<TPage>
: Array<unknown>;
/**
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
* @param client - Client to use for sending the next page requests
* @param initialResponse - Initial response containing the nextLink and current page of elements
* @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
* @returns - PagedAsyncIterableIterator to iterate the elements
*/
export function paginate<TResponse extends PathUncheckedResponse>(
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,
};
},
};
return getPagedAsyncIterator(pagedResult);
}
/**
* Gets for the value of nextLink in the body
*/
function getNextLink(body: unknown, nextLinkName?: string): string | undefined {
if (!nextLinkName) {
return undefined;
}
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`);
}
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[];
// 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 ?? [];
}
/**
* 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,
);
}
}

Просмотреть файл

@ -1,26 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { RequestParameters } from "@azure-rest/core-client";
import { Fleet, FleetUpdate } from "./models.js";
export type OperationsListParameters = RequestParameters;
export type FleetsGetParameters = RequestParameters;
export interface FleetsCreateOrUpdateBodyParam {
/** Resource create parameters. */
body: Fleet;
}
export type FleetsCreateOrUpdateParameters = FleetsCreateOrUpdateBodyParam & RequestParameters;
export interface FleetsUpdateBodyParam {
/** The resource properties to be updated. */
body: FleetUpdate;
}
export type FleetsUpdateParameters = FleetsUpdateBodyParam & RequestParameters;
export type FleetsDeleteParameters = RequestParameters;
export type FleetsListByResourceGroupParameters = RequestParameters;
export type FleetsListBySubscriptionParameters = RequestParameters;
export type FleetsListVirtualMachineScaleSetsParameters = RequestParameters;

Просмотреть файл

@ -1,232 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { Client, HttpResponse } from "@azure-rest/core-client";
import { AbortSignalLike } from "@azure/abort-controller";
import {
CancelOnProgress,
CreateHttpPollerOptions,
RunningOperation,
OperationResponse,
OperationState,
createHttpPoller,
} from "@azure/core-lro";
import {
FleetsCreateOrUpdate200Response,
FleetsCreateOrUpdate201Response,
FleetsCreateOrUpdateDefaultResponse,
FleetsCreateOrUpdateLogicalResponse,
FleetsUpdate200Response,
FleetsUpdate202Response,
FleetsUpdateDefaultResponse,
FleetsUpdateLogicalResponse,
FleetsDelete202Response,
FleetsDelete204Response,
FleetsDeleteDefaultResponse,
FleetsDeleteLogicalResponse,
} from "./responses.js";
/**
* A simple poller that can be used to poll a long running operation.
*/
export interface SimplePollerLike<TState extends OperationState<TResult>, TResult> {
/**
* Returns true if the poller has finished polling.
*/
isDone(): boolean;
/**
* Returns the state of the operation.
*/
getOperationState(): TState;
/**
* Returns the result value of the operation,
* regardless of the state of the poller.
* It can return undefined or an incomplete form of the final TResult value
* depending on the implementation.
*/
getResult(): TResult | undefined;
/**
* Returns a promise that will resolve once a single polling request finishes.
* It does this by calling the update method of the Poller's operation.
*/
poll(options?: { abortSignal?: AbortSignalLike }): Promise<TState>;
/**
* Returns a promise that will resolve once the underlying operation is completed.
*/
pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise<TResult>;
/**
* Invokes the provided callback after each polling is completed,
* sending the current state of the poller's operation.
*
* It returns a method that can be used to stop receiving updates on the given callback function.
*/
onProgress(callback: (state: TState) => void): CancelOnProgress;
/**
* Returns a promise that could be used for serialized version of the poller's operation
* by invoking the operation's serialize method.
*/
serialize(): Promise<string>;
/**
* Wait the poller to be submitted.
*/
submitted(): Promise<void>;
/**
* Returns a string representation of the poller's operation. Similar to serialize but returns a string.
* @deprecated Use serialize() instead.
*/
toString(): string;
/**
* Stops the poller from continuing to poll. Please note this will only stop the client-side polling
* @deprecated Use abortSignal to stop polling instead.
*/
stopPolling(): void;
/**
* Returns true if the poller is stopped.
* @deprecated Use abortSignal status to track this instead.
*/
isStopped(): boolean;
}
/**
* Helper function that builds a Poller object to help polling a long running operation.
* @param client - Client to use for sending the request to get additional pages.
* @param initialResponse - The initial response.
* @param options - Options to set a resume state or custom polling interval.
* @returns - A poller object to poll for operation state updates and eventually get the final response.
*/
export async function getLongRunningPoller<
TResult extends FleetsCreateOrUpdateLogicalResponse | FleetsCreateOrUpdateDefaultResponse,
>(
client: Client,
initialResponse:
| FleetsCreateOrUpdate200Response
| FleetsCreateOrUpdate201Response
| FleetsCreateOrUpdateDefaultResponse,
options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>,
): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;
export async function getLongRunningPoller<
TResult extends FleetsUpdateLogicalResponse | FleetsUpdateDefaultResponse,
>(
client: Client,
initialResponse: FleetsUpdate200Response | FleetsUpdate202Response | FleetsUpdateDefaultResponse,
options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>,
): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;
export async function getLongRunningPoller<
TResult extends FleetsDeleteLogicalResponse | FleetsDeleteDefaultResponse,
>(
client: Client,
initialResponse: FleetsDelete202Response | FleetsDelete204Response | FleetsDeleteDefaultResponse,
options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>,
): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;
export async function getLongRunningPoller<TResult extends HttpResponse>(
client: Client,
initialResponse: TResult,
options: CreateHttpPollerOptions<TResult, OperationState<TResult>> = {},
): Promise<SimplePollerLike<OperationState<TResult>, TResult>> {
const abortController = new AbortController();
const poller: RunningOperation<TResult> = {
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: string, pollOptions?: { abortSignal?: AbortSignalLike }) => {
// 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.
function abortListener(): void {
abortController.abort();
}
const inputAbortSignal = pollOptions?.abortSignal;
const abortSignal = abortController.signal;
if (inputAbortSignal?.aborted) {
abortController.abort();
} else if (!abortSignal.aborted) {
inputAbortSignal?.addEventListener("abort", abortListener, {
once: true,
});
}
let response;
try {
response = await client
.pathUnchecked(path ?? initialResponse.request.url)
.get({ abortSignal });
} finally {
inputAbortSignal?.removeEventListener("abort", abortListener);
}
const lroResponse = getLroResponse(response as TResult);
lroResponse.rawResponse.headers["x-ms-original-url"] = initialResponse.request.url;
return lroResponse;
},
};
options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;
const httpPoller = createHttpPoller(poller, options);
const simplePoller: SimplePollerLike<OperationState<TResult>, TResult> = {
isDone() {
return httpPoller.isDone;
},
isStopped() {
return abortController.signal.aborted;
},
getOperationState() {
if (!httpPoller.operationState) {
throw new Error(
"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().",
);
}
return httpPoller.operationState;
},
getResult() {
return httpPoller.result;
},
toString() {
if (!httpPoller.operationState) {
throw new Error(
"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().",
);
}
return JSON.stringify({
state: httpPoller.operationState,
});
},
stopPolling() {
abortController.abort();
},
onProgress: httpPoller.onProgress,
poll: httpPoller.poll,
pollUntilDone: httpPoller.pollUntilDone,
serialize: httpPoller.serialize,
submitted: httpPoller.submitted,
};
return simplePoller;
}
/**
* Converts a Rest Client response to a response that the LRO implementation understands
* @param response - a rest client http response
* @returns - An LRO response that the LRO implementation understands
*/
function getLroResponse<TResult extends HttpResponse>(
response: TResult,
): OperationResponse<TResult> {
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,
},
};
}

Просмотреть файл

@ -1,154 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { RawHttpHeaders } from "@azure/core-rest-pipeline";
import { HttpResponse } from "@azure-rest/core-client";
import {
OperationListResultOutput,
ErrorResponseOutput,
FleetOutput,
FleetListResultOutput,
VirtualMachineScaleSetListResultOutput,
} from "./outputModels.js";
/** Azure operation completed successfully. */
export interface OperationsList200Response extends HttpResponse {
status: "200";
body: OperationListResultOutput;
}
export interface OperationsListDefaultResponse extends HttpResponse {
status: string;
body: ErrorResponseOutput;
}
/** Azure operation completed successfully. */
export interface FleetsGet200Response extends HttpResponse {
status: "200";
body: FleetOutput;
}
export interface FleetsGetDefaultResponse extends HttpResponse {
status: string;
body: ErrorResponseOutput;
}
/** Resource 'Fleet' update operation succeeded */
export interface FleetsCreateOrUpdate200Response extends HttpResponse {
status: "200";
body: FleetOutput;
}
export interface FleetsCreateOrUpdate201Headers {
/** The Retry-After header can indicate how long the client should wait before polling the operation status. */
"retry-after"?: number;
}
/** Resource 'Fleet' create operation succeeded */
export interface FleetsCreateOrUpdate201Response extends HttpResponse {
status: "201";
body: FleetOutput;
headers: RawHttpHeaders & FleetsCreateOrUpdate201Headers;
}
export interface FleetsCreateOrUpdateDefaultResponse extends HttpResponse {
status: string;
body: ErrorResponseOutput;
}
/** The final response for long-running createOrUpdate operation */
export interface FleetsCreateOrUpdateLogicalResponse extends HttpResponse {
status: "200";
body: FleetOutput;
}
/** Azure operation completed successfully. */
export interface FleetsUpdate200Response extends HttpResponse {
status: "200";
body: FleetOutput;
}
export interface FleetsUpdate202Headers {
/** The Location header contains the URL where the status of the long running operation can be checked. */
location?: string;
/** The Retry-After header can indicate how long the client should wait before polling the operation status. */
"retry-after"?: number;
}
/** Resource update request accepted. */
export interface FleetsUpdate202Response extends HttpResponse {
status: "202";
headers: RawHttpHeaders & FleetsUpdate202Headers;
}
export interface FleetsUpdateDefaultResponse extends HttpResponse {
status: string;
body: ErrorResponseOutput;
}
/** The final response for long-running update operation */
export interface FleetsUpdateLogicalResponse extends HttpResponse {
status: "200";
body: FleetOutput;
}
export interface FleetsDelete202Headers {
/** The Location header contains the URL where the status of the long running operation can be checked. */
location?: string;
/** The Retry-After header can indicate how long the client should wait before polling the operation status. */
"retry-after"?: number;
}
/** Resource deletion accepted. */
export interface FleetsDelete202Response extends HttpResponse {
status: "202";
headers: RawHttpHeaders & FleetsDelete202Headers;
}
/** Resource does not exist. */
export interface FleetsDelete204Response extends HttpResponse {
status: "204";
}
export interface FleetsDeleteDefaultResponse extends HttpResponse {
status: string;
body: ErrorResponseOutput;
}
/** The final response for long-running delete operation */
export interface FleetsDeleteLogicalResponse extends HttpResponse {
status: "200";
}
/** Azure operation completed successfully. */
export interface FleetsListByResourceGroup200Response extends HttpResponse {
status: "200";
body: FleetListResultOutput;
}
export interface FleetsListByResourceGroupDefaultResponse extends HttpResponse {
status: string;
body: ErrorResponseOutput;
}
/** Azure operation completed successfully. */
export interface FleetsListBySubscription200Response extends HttpResponse {
status: "200";
body: FleetListResultOutput;
}
export interface FleetsListBySubscriptionDefaultResponse extends HttpResponse {
status: string;
body: ErrorResponseOutput;
}
/** Azure operation completed successfully. */
export interface FleetsListVirtualMachineScaleSets200Response extends HttpResponse {
status: "200";
body: VirtualMachineScaleSetListResultOutput;
}
export interface FleetsListVirtualMachineScaleSetsDefaultResponse extends HttpResponse {
status: string;
body: ErrorResponseOutput;
}

Просмотреть файл

@ -1,21 +1,21 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { AzureFleetClient } from "./azureFleetClient.js";
import {
_fleetsCreateOrUpdateDeserialize,
_fleetsUpdateDeserialize,
_fleetsDeleteDeserialize,
} from "./api/fleets/index.js";
import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js";
import { OperationOptions, PathUncheckedResponse } from "@azure-rest/core-client";
import { AbortSignalLike } from "@azure/abort-controller";
import {
PollerLike,
OperationState,
deserializeState,
ResourceLocationConfig,
} from "@azure/core-lro";
import { AzureFleetClient } from "./azureFleetClient.js";
import { getLongRunningPoller } from "./api/pollingHelpers.js";
import {
_fleetsCreateOrUpdateDeserialize,
_fleetsUpdateDeserialize,
_fleetsDeleteDeserialize,
} from "./api/fleets/index.js";
import { PathUncheckedResponse, OperationOptions } from "@azure-rest/core-client";
import { AbortSignalLike } from "@azure/abort-controller";
export interface RestorePollerOptions<
TResult,
@ -52,8 +52,9 @@ export function restorePoller<TResponse extends PathUncheckedResponse, TResult>(
const resourceLocationConfig = metadata?.["resourceLocationConfig"] as
| ResourceLocationConfig
| undefined;
const deserializeHelper =
options?.processResponseBody ?? getDeserializationHelper(initialRequestUrl, requestMethod);
const { deserializer, expectedStatuses = [] } =
getDeserializationHelper(initialRequestUrl, requestMethod) ?? {};
const deserializeHelper = options?.processResponseBody ?? deserializer;
if (!deserializeHelper) {
throw new Error(
`Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`,
@ -62,6 +63,7 @@ export function restorePoller<TResponse extends PathUncheckedResponse, TResult>(
return getLongRunningPoller(
(client as any)["_client"] ?? client,
deserializeHelper as (result: TResponse) => Promise<TResult>,
expectedStatuses,
{
updateIntervalInMs: options?.updateIntervalInMs,
abortSignal: options?.abortSignal,
@ -72,19 +74,33 @@ export function restorePoller<TResponse extends PathUncheckedResponse, TResult>(
);
}
const deserializeMap: Record<string, Function> = {
interface DeserializationHelper {
deserializer: Function;
expectedStatuses: string[];
}
const deserializeMap: Record<string, DeserializationHelper> = {
"PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{fleetName}":
_fleetsCreateOrUpdateDeserialize,
{
deserializer: _fleetsCreateOrUpdateDeserialize,
expectedStatuses: ["200", "201"],
},
"PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{fleetName}":
_fleetsUpdateDeserialize,
{
deserializer: _fleetsUpdateDeserialize,
expectedStatuses: ["200", "202"],
},
"DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{fleetName}":
_fleetsDeleteDeserialize,
{
deserializer: _fleetsDeleteDeserialize,
expectedStatuses: ["202", "204", "200"],
},
};
function getDeserializationHelper(
urlStr: string,
method: string,
): ((result: unknown) => Promise<unknown>) | undefined {
): DeserializationHelper | undefined {
const path = new URL(urlStr).pathname;
const pathParts = path.split("/");
@ -92,7 +108,7 @@ function getDeserializationHelper(
// matchedLen: the length of candidate path
// matchedValue: the matched status code array
let matchedLen = -1,
matchedValue: ((result: unknown) => Promise<unknown>) | undefined;
matchedValue: DeserializationHelper | undefined;
// Iterate the responseMap to find a match
for (const [key, value] of Object.entries(deserializeMap)) {
@ -139,7 +155,7 @@ function getDeserializationHelper(
// Update the matched value if and only if we found the longer pattern
if (found && candidatePath.length > matchedLen) {
matchedLen = candidatePath.length;
matchedValue = value as (result: unknown) => Promise<unknown>;
matchedValue = value;
}
}

Просмотреть файл

@ -3,14 +3,83 @@
import { Client, createRestError, PathUncheckedResponse } from "@azure-rest/core-client";
import { RestError } from "@azure/core-rest-pipeline";
import {
BuildPagedAsyncIteratorOptions,
ContinuablePage,
PageSettings,
PagedAsyncIterableIterator,
PagedResult,
} from "../models/pagingTypes.js";
import { isUnexpected } from "../rest/index.js";
/**
* Options for the byPage method
*/
export interface PageSettings {
/**
* A reference to a specific page to start iterating from.
*/
continuationToken?: string;
}
/**
* An interface that describes a page of results.
*/
export type ContinuablePage<TElement, TPage = TElement[]> = TPage & {
/**
* The token that keeps track of where to continue the iterator
*/
continuationToken?: string;
};
/**
* An interface that allows async iterable iteration both to completion and by page.
*/
export interface PagedAsyncIterableIterator<
TElement,
TPage = TElement[],
TPageSettings extends PageSettings = PageSettings,
> {
/**
* The next method, part of the iteration protocol
*/
next(): Promise<IteratorResult<TElement>>;
/**
* The connection to the async iterator, part of the iteration protocol
*/
[Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;
/**
* Return an AsyncIterableIterator that works a page at a time
*/
byPage: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;
}
/**
* An interface that describes how to communicate with the service.
*/
export interface PagedResult<
TElement,
TPage = TElement[],
TPageSettings extends PageSettings = PageSettings,
> {
/**
* Link to the first page of results.
*/
firstPageLink?: string;
/**
* A method that returns a page of results.
*/
getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>;
/**
* a function to implement the `byPage` method on the paged async iterator.
*/
byPage?: (settings?: TPageSettings) => AsyncIterableIterator<ContinuablePage<TElement, TPage>>;
/**
* A function to extract elements from a page.
*/
toElements?: (page: TPage) => TElement[];
}
/**
* Options for the paging helper
*/
export interface BuildPagedAsyncIteratorOptions {
itemName?: string;
nextLinkName?: string;
}
/**
* Helper to paginate results in a generic way and return a PagedAsyncIterableIterator
@ -24,6 +93,7 @@ export function buildPagedAsyncIterator<
client: Client,
getInitialResponse: () => PromiseLike<TResponse>,
processResponseBody: (result: TResponse) => PromiseLike<unknown>,
expectedStatuses: string[],
options: BuildPagedAsyncIteratorOptions = {},
): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {
const itemName = options.itemName ?? "value";
@ -34,7 +104,7 @@ export function buildPagedAsyncIterator<
pageLink === undefined
? await getInitialResponse()
: await client.pathUnchecked(pageLink).get();
checkPagingRequest(result);
checkPagingRequest(result, expectedStatuses);
const results = await processResponseBody(result as TResponse);
const nextLink = getNextLink(results, nextLinkName);
const values = getElements<TElement>(results, itemName) as TPage;
@ -161,8 +231,8 @@ function getElements<T = unknown>(body: unknown, itemName: string): T[] {
/**
* Checks if a request failed
*/
function checkPagingRequest(response: PathUncheckedResponse): void {
if (isUnexpected(response)) {
function checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void {
if (!expectedStatuses.includes(response.status)) {
throw createRestError(
`Pagination failed with unexpected statusCode ${response.status}`,
response,

Просмотреть файл

@ -12,7 +12,6 @@ import {
import { Client, PathUncheckedResponse, createRestError } from "@azure-rest/core-client";
import { AbortSignalLike } from "@azure/abort-controller";
import { isUnexpected } from "../rest/index.js";
export interface GetLongRunningPollerOptions<TResponse> {
/** Delay to wait until next poll, in milliseconds. */
@ -42,6 +41,7 @@ export interface GetLongRunningPollerOptions<TResponse> {
export function getLongRunningPoller<TResponse extends PathUncheckedResponse, TResult = void>(
client: Client,
processResponseBody: (result: TResponse) => Promise<TResult>,
expectedStatuses: string[],
options: GetLongRunningPollerOptions<TResponse>,
): PollerLike<OperationState<TResult>, TResult> {
const { restoreFrom, getInitialResponse } = options;
@ -56,7 +56,7 @@ export function getLongRunningPoller<TResponse extends PathUncheckedResponse, TR
throw new Error("getInitialResponse is required when initializing a new poller");
}
initialResponse = await getInitialResponse();
return getLroResponse(initialResponse);
return getLroResponse(initialResponse, expectedStatuses);
},
sendPollRequest: async (
path: string,
@ -88,12 +88,8 @@ export function getLongRunningPoller<TResponse extends PathUncheckedResponse, TR
options.abortSignal?.removeEventListener("abort", abortListener);
pollOptions?.abortSignal?.removeEventListener("abort", abortListener);
}
if (options.initialRequestUrl || initialResponse) {
response.headers["x-ms-original-url"] =
options.initialRequestUrl ?? initialResponse!.request.url;
}
return getLroResponse(response as TResponse);
return getLroResponse(response as TResponse, expectedStatuses);
},
};
return createHttpPoller(poller, {
@ -113,10 +109,12 @@ export function getLongRunningPoller<TResponse extends PathUncheckedResponse, TR
*/
function getLroResponse<TResponse extends PathUncheckedResponse>(
response: TResponse,
expectedStatuses: string[],
): OperationResponse<TResponse> {
if (isUnexpected(response as PathUncheckedResponse)) {
if (!expectedStatuses.includes(response.status)) {
throw createRestError(response);
}
return {
flatResponse: response,
rawResponse: {

Просмотреть файл

@ -159,7 +159,7 @@ describe("AzureFleet test", () => {
it("fleets delete test", async function () {
const resArray = new Array();
const res = await client.fleets.delete(resourceGroup, resourcename);
await client.fleets.delete(resourceGroup, resourcename);
for await (let item of client.fleets.listByResourceGroup(resourceGroup)) {
resArray.push(item);
}

Просмотреть файл

@ -3,7 +3,18 @@
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"rootDir": "."
"rootDir": ".",
"skipLibCheck": true,
"paths": {
"@azure/arm-computefleet": ["./src/index"]
}
},
"include": ["./src/**/*.ts", "./src/**/*.mts", "./src/**/*.cts", "test/**/*.ts", "./test/**/*.ts"]
"include": [
"./src/**/*.ts",
"./src/**/*.mts",
"./src/**/*.cts",
"test/**/*.ts",
"./test/**/*.ts",
"samples-dev/**/*.ts"
]
}

Просмотреть файл

@ -1,3 +1,3 @@
directory: specification/azurefleet/AzureFleet.Management
commit: b75726f11c9af676feef91a67ea7e5365b3b111d
commit: 8ad58020cfafc5ace71d85b31272acf4d6b694d3
repo: Azure/azure-rest-api-specs

Просмотреть файл

@ -33,5 +33,6 @@ export default defineConfig({
reportsDirectory: "coverage-browser",
},
testTimeout: 1200000,
hookTimeout: 1200000
},
});

Просмотреть файл

@ -29,5 +29,6 @@ export default defineConfig({
reportsDirectory: "coverage",
},
testTimeout: 1200000,
hookTimeout: 1200000
},
});