UNPKG

@azure/arm-compute

Version:
191 lines 9.42 kB
"use strict"; /* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.ComputeManagementClient = void 0; const tslib_1 = require("tslib"); const coreClient = tslib_1.__importStar(require("@azure/core-client")); const coreRestPipeline = tslib_1.__importStar(require("@azure/core-rest-pipeline")); const index_js_1 = require("./operations/index.js"); class ComputeManagementClient extends coreClient.ServiceClient { $host; subscriptionId; /** * Initializes a new instance of the ComputeManagementClient class. * @param credentials Subscription credentials which uniquely identify client subscription. * @param subscriptionId The ID of the target subscription. * @param options The parameter options */ constructor(credentials, subscriptionId, options) { if (credentials === undefined) { throw new Error("'credentials' cannot be null"); } if (subscriptionId === undefined) { throw new Error("'subscriptionId' cannot be null"); } // Initializing default values for options if (!options) { options = {}; } const defaults = { requestContentType: "application/json; charset=utf-8", credential: credentials, }; const packageDetails = `azsdk-js-arm-compute/23.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` : `${packageDetails}`; const optionsWithDefaults = { ...defaults, ...options, userAgentOptions: { userAgentPrefix, }, endpoint: options.endpoint ?? options.baseUri ?? "https://management.azure.com", }; super(optionsWithDefaults); let bearerTokenAuthenticationPolicyFound = false; if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { const pipelinePolicies = options.pipeline.getOrderedPolicies(); bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name === coreRestPipeline.bearerTokenAuthenticationPolicyName); } if (!options || !options.pipeline || options.pipeline.getOrderedPolicies().length == 0 || !bearerTokenAuthenticationPolicyFound) { this.pipeline.removePolicy({ name: coreRestPipeline.bearerTokenAuthenticationPolicyName, }); this.pipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({ credential: credentials, scopes: optionsWithDefaults.credentialScopes ?? `${optionsWithDefaults.endpoint}/.default`, challengeCallbacks: { authorizeRequestOnChallenge: coreClient.authorizeRequestOnClaimChallenge, }, })); } // Parameter assignments this.subscriptionId = subscriptionId; // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; this.operations = new index_js_1.OperationsImpl(this); this.availabilitySets = new index_js_1.AvailabilitySetsImpl(this); this.capacityReservationGroups = new index_js_1.CapacityReservationGroupsImpl(this); this.dedicatedHostGroups = new index_js_1.DedicatedHostGroupsImpl(this); this.images = new index_js_1.ImagesImpl(this); this.virtualMachineImagesEdgeZone = new index_js_1.VirtualMachineImagesEdgeZoneImpl(this); this.virtualMachineImages = new index_js_1.VirtualMachineImagesImpl(this); this.logAnalytics = new index_js_1.LogAnalyticsImpl(this); this.virtualMachineExtensionImages = new index_js_1.VirtualMachineExtensionImagesImpl(this); this.virtualMachineRunCommands = new index_js_1.VirtualMachineRunCommandsImpl(this); this.usageOperations = new index_js_1.UsageOperationsImpl(this); this.virtualMachineScaleSets = new index_js_1.VirtualMachineScaleSetsImpl(this); this.virtualMachines = new index_js_1.VirtualMachinesImpl(this); this.virtualMachineSizes = new index_js_1.VirtualMachineSizesImpl(this); this.proximityPlacementGroups = new index_js_1.ProximityPlacementGroupsImpl(this); this.restorePointCollections = new index_js_1.RestorePointCollectionsImpl(this); this.sshPublicKeys = new index_js_1.SshPublicKeysImpl(this); this.capacityReservations = new index_js_1.CapacityReservationsImpl(this); this.dedicatedHosts = new index_js_1.DedicatedHostsImpl(this); this.restorePoints = new index_js_1.RestorePointsImpl(this); this.virtualMachineScaleSetRollingUpgrades = new index_js_1.VirtualMachineScaleSetRollingUpgradesImpl(this); this.virtualMachineScaleSetExtensions = new index_js_1.VirtualMachineScaleSetExtensionsImpl(this); this.virtualMachineScaleSetVMs = new index_js_1.VirtualMachineScaleSetVMsImpl(this); this.virtualMachineScaleSetVMExtensions = new index_js_1.VirtualMachineScaleSetVMExtensionsImpl(this); this.virtualMachineScaleSetVMRunCommands = new index_js_1.VirtualMachineScaleSetVMRunCommandsImpl(this); this.virtualMachineExtensions = new index_js_1.VirtualMachineExtensionsImpl(this); this.diskAccesses = new index_js_1.DiskAccessesImpl(this); this.diskEncryptionSets = new index_js_1.DiskEncryptionSetsImpl(this); this.disks = new index_js_1.DisksImpl(this); this.snapshots = new index_js_1.SnapshotsImpl(this); this.diskRestorePointOperations = new index_js_1.DiskRestorePointOperationsImpl(this); this.resourceSkus = new index_js_1.ResourceSkusImpl(this); this.galleries = new index_js_1.GalleriesImpl(this); this.communityGalleries = new index_js_1.CommunityGalleriesImpl(this); this.communityGalleryImages = new index_js_1.CommunityGalleryImagesImpl(this); this.communityGalleryImageVersions = new index_js_1.CommunityGalleryImageVersionsImpl(this); this.sharedGalleries = new index_js_1.SharedGalleriesImpl(this); this.sharedGalleryImages = new index_js_1.SharedGalleryImagesImpl(this); this.sharedGalleryImageVersions = new index_js_1.SharedGalleryImageVersionsImpl(this); this.galleryApplications = new index_js_1.GalleryApplicationsImpl(this); this.galleryApplicationVersions = new index_js_1.GalleryApplicationVersionsImpl(this); this.galleryImages = new index_js_1.GalleryImagesImpl(this); this.galleryImageVersions = new index_js_1.GalleryImageVersionsImpl(this); this.galleryInVMAccessControlProfiles = new index_js_1.GalleryInVMAccessControlProfilesImpl(this); this.galleryInVMAccessControlProfileVersions = new index_js_1.GalleryInVMAccessControlProfileVersionsImpl(this); this.gallerySharingProfile = new index_js_1.GallerySharingProfileImpl(this); this.softDeletedResource = new index_js_1.SoftDeletedResourceImpl(this); this.cloudServiceRoleInstances = new index_js_1.CloudServiceRoleInstancesImpl(this); this.cloudServiceRoles = new index_js_1.CloudServiceRolesImpl(this); this.cloudServices = new index_js_1.CloudServicesImpl(this); this.cloudServicesUpdateDomain = new index_js_1.CloudServicesUpdateDomainImpl(this); this.cloudServiceOperatingSystems = new index_js_1.CloudServiceOperatingSystemsImpl(this); } operations; availabilitySets; capacityReservationGroups; dedicatedHostGroups; images; virtualMachineImagesEdgeZone; virtualMachineImages; logAnalytics; virtualMachineExtensionImages; virtualMachineRunCommands; usageOperations; virtualMachineScaleSets; virtualMachines; virtualMachineSizes; proximityPlacementGroups; restorePointCollections; sshPublicKeys; capacityReservations; dedicatedHosts; restorePoints; virtualMachineScaleSetRollingUpgrades; virtualMachineScaleSetExtensions; virtualMachineScaleSetVMs; virtualMachineScaleSetVMExtensions; virtualMachineScaleSetVMRunCommands; virtualMachineExtensions; diskAccesses; diskEncryptionSets; disks; snapshots; diskRestorePointOperations; resourceSkus; galleries; communityGalleries; communityGalleryImages; communityGalleryImageVersions; sharedGalleries; sharedGalleryImages; sharedGalleryImageVersions; galleryApplications; galleryApplicationVersions; galleryImages; galleryImageVersions; galleryInVMAccessControlProfiles; galleryInVMAccessControlProfileVersions; gallerySharingProfile; softDeletedResource; cloudServiceRoleInstances; cloudServiceRoles; cloudServices; cloudServicesUpdateDomain; cloudServiceOperatingSystems; } exports.ComputeManagementClient = ComputeManagementClient; //# sourceMappingURL=computeManagementClient.js.map