From 54201e1e4936d2d61e0add67f45c4c5d45942022 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 15 Jul 2022 08:15:48 +0000 Subject: [PATCH] CodeGen from PR 19653 in Azure/azure-rest-api-specs Merge dc0d153e25a250d53a28b0e5c87006f653efa80b into c03c258c7a01a7d57b3110cc20e2e76752b6f2d6 --- .../arm-containerservice/CHANGELOG.md | 62 +- .../arm-containerservice/_meta.json | 8 +- .../arm-containerservice/package.json | 14 +- .../review/arm-containerservice.api.md | 256 ++++++- .../src/containerServiceClient.ts | 14 +- .../arm-containerservice/src/models/index.ts | 337 ++++++++- .../src/models/mappers.ts | 335 +++++++++ .../src/models/parameters.ts | 74 +- .../src/operations/fleetMembers.ts | 485 +++++++++++++ .../src/operations/fleets.ts | 642 ++++++++++++++++++ .../src/operations/index.ts | 2 + .../src/operationsInterfaces/fleetMembers.ts | 113 +++ .../src/operationsInterfaces/fleets.ts | 129 ++++ .../src/operationsInterfaces/index.ts | 2 + .../arm-containerservice/test/sampleTest.ts | 43 ++ .../arm-containerservice/tsconfig.json | 10 +- 16 files changed, 2483 insertions(+), 43 deletions(-) create mode 100644 sdk/containerservice/arm-containerservice/src/operations/fleetMembers.ts create mode 100644 sdk/containerservice/arm-containerservice/src/operations/fleets.ts create mode 100644 sdk/containerservice/arm-containerservice/src/operationsInterfaces/fleetMembers.ts create mode 100644 sdk/containerservice/arm-containerservice/src/operationsInterfaces/fleets.ts create mode 100644 sdk/containerservice/arm-containerservice/test/sampleTest.ts diff --git a/sdk/containerservice/arm-containerservice/CHANGELOG.md b/sdk/containerservice/arm-containerservice/CHANGELOG.md index f68039b74e6f..3a2db888fcca 100644 --- a/sdk/containerservice/arm-containerservice/CHANGELOG.md +++ b/sdk/containerservice/arm-containerservice/CHANGELOG.md @@ -1,31 +1,47 @@ # Release History - -## 17.0.0-beta.2 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 17.0.0-beta.1 (2022-06-08) + +## 17.0.0-beta.2 (2022-07-15) **Features** + - Added operation group FleetMembers + - Added operation group Fleets - Added operation group ManagedClusterSnapshots - Added operation group TrustedAccessRoleBindings - Added operation group TrustedAccessRoles - Added operation ManagedClusters.beginRotateServiceAccountSigningKeys - Added operation ManagedClusters.beginRotateServiceAccountSigningKeysAndWait - Added Interface AzureKeyVaultKms + - Added Interface ErrorAdditionalInfo + - Added Interface ErrorDetail + - Added Interface ErrorResponse + - Added Interface FleetCredentialResult + - Added Interface FleetCredentialResults + - Added Interface FleetHubProfile + - Added Interface FleetListResult + - Added Interface FleetMembersCreateOrUpdateOptionalParams + - Added Interface FleetMembersDeleteOptionalParams + - Added Interface FleetMembersGetOptionalParams + - Added Interface FleetMembersListByFleetNextOptionalParams + - Added Interface FleetMembersListByFleetOptionalParams + - Added Interface FleetMembersListResult + - Added Interface FleetPatch + - Added Interface FleetsCreateOrUpdateOptionalParams + - Added Interface FleetsDeleteOptionalParams + - Added Interface FleetsGetOptionalParams + - Added Interface FleetsListByResourceGroupNextOptionalParams + - Added Interface FleetsListByResourceGroupOptionalParams + - Added Interface FleetsListCredentialsOptionalParams + - Added Interface FleetsListNextOptionalParams + - Added Interface FleetsListOptionalParams + - Added Interface FleetsUpdateOptionalParams - Added Interface ManagedClusterIngressProfile - Added Interface ManagedClusterIngressProfileWebAppRouting - Added Interface ManagedClusterOidcIssuerProfile - Added Interface ManagedClusterPropertiesForSnapshot - Added Interface ManagedClusterSecurityProfileDefender - Added Interface ManagedClusterSecurityProfileDefenderSecurityMonitoring + - Added Interface ManagedClusterSecurityProfileNodeRestriction - Added Interface ManagedClusterSecurityProfileWorkloadIdentity - Added Interface ManagedClusterSnapshotListResult - Added Interface ManagedClusterSnapshotsCreateOrUpdateOptionalParams @@ -52,6 +68,23 @@ - Added Interface TrustedAccessRoleRule - Added Interface TrustedAccessRolesListNextOptionalParams - Added Interface TrustedAccessRolesListOptionalParams + - Added Type Alias AzureEntityResource + - Added Type Alias Fleet + - Added Type Alias FleetMember + - Added Type Alias FleetMemberProvisioningState + - Added Type Alias FleetMembersCreateOrUpdateResponse + - Added Type Alias FleetMembersGetResponse + - Added Type Alias FleetMembersListByFleetNextResponse + - Added Type Alias FleetMembersListByFleetResponse + - Added Type Alias FleetProvisioningState + - Added Type Alias FleetsCreateOrUpdateResponse + - Added Type Alias FleetsGetResponse + - Added Type Alias FleetsListByResourceGroupNextResponse + - Added Type Alias FleetsListByResourceGroupResponse + - Added Type Alias FleetsListCredentialsResponse + - Added Type Alias FleetsListNextResponse + - Added Type Alias FleetsListResponse + - Added Type Alias FleetsUpdateResponse - Added Type Alias KeyVaultNetworkAccessTypes - Added Type Alias ManagedClusterSnapshot - Added Type Alias ManagedClusterSnapshotsCreateOrUpdateResponse @@ -82,9 +115,12 @@ - Interface ManagedClustersDeleteOptionalParams has a new optional parameter ignorePodDisruptionBudget - Interface ManagedClusterSecurityProfile has a new optional parameter azureKeyVaultKms - Interface ManagedClusterSecurityProfile has a new optional parameter defender + - Interface ManagedClusterSecurityProfile has a new optional parameter nodeRestriction - Interface ManagedClusterSecurityProfile has a new optional parameter workloadIdentity - Interface ManagedClusterStorageProfile has a new optional parameter blobCSIDriver - Interface ManagedClusterStorageProfileDiskCSIDriver has a new optional parameter version + - Class ContainerServiceClient has a new parameter fleetMembers + - Class ContainerServiceClient has a new parameter fleets - Class ContainerServiceClient has a new parameter managedClusterSnapshots - Class ContainerServiceClient has a new parameter trustedAccessRoleBindings - Class ContainerServiceClient has a new parameter trustedAccessRoles @@ -97,6 +133,8 @@ - Type Alias ManagedCluster has a new parameter enableNamespaceResources - Type Alias ManagedCluster has a new parameter ingressProfile - Type Alias ManagedCluster has a new parameter workloadAutoScalerProfile + - Added Enum KnownFleetMemberProvisioningState + - Added Enum KnownFleetProvisioningState - Added Enum KnownKeyVaultNetworkAccessTypes - Added Enum KnownNetworkPluginMode - Added Enum KnownTrustedAccessRoleBindingProvisioningState diff --git a/sdk/containerservice/arm-containerservice/_meta.json b/sdk/containerservice/arm-containerservice/_meta.json index d7b5afd5d55d..f9e7a1c4ec51 100644 --- a/sdk/containerservice/arm-containerservice/_meta.json +++ b/sdk/containerservice/arm-containerservice/_meta.json @@ -1,8 +1,8 @@ { - "commit": "f1cf4b44dc3abfcf9d9a514e2e6faa3ae8d11b4c", + "commit": "209252d68513b724028e52d9b6d16c8318080765", "readme": "specification/containerservice/resource-manager/readme.md", - "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\containerservice\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-beta.20 --generate-sample=true", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/containerservice/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220425.1", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.3.0", - "use": "@autorest/typescript@6.0.0-beta.20" + "release_tool": "@azure-tools/js-sdk-release-tools@2.4.0", + "use": "@autorest/typescript@6.0.0-alpha.19.20220425.1" } \ No newline at end of file diff --git a/sdk/containerservice/arm-containerservice/package.json b/sdk/containerservice/arm-containerservice/package.json index 7073ae8d7c05..3c287c33c437 100644 --- a/sdk/containerservice/arm-containerservice/package.json +++ b/sdk/containerservice/arm-containerservice/package.json @@ -43,8 +43,6 @@ "@azure-tools/test-recorder": "^2.0.0", "@azure-tools/test-credential": "^1.0.0", "mocha": "^7.1.1", - "@types/chai": "^4.2.8", - "chai": "^4.2.0", "cross-env": "^7.0.2", "@azure/dev-tool": "^1.0.0" }, @@ -110,13 +108,5 @@ } ] }, - "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-containerservice?view=azure-node-preview" - } -} + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/containerservice/arm-containerservice/review/arm-containerservice.api.md b/sdk/containerservice/arm-containerservice/review/arm-containerservice.api.md index 1666f43afce5..0720e993ba28 100644 --- a/sdk/containerservice/arm-containerservice/review/arm-containerservice.api.md +++ b/sdk/containerservice/arm-containerservice/review/arm-containerservice.api.md @@ -187,6 +187,11 @@ export interface AgentPoolUpgradeSettings { maxSurge?: string; } +// @public +export type AzureEntityResource = Resource & { + readonly etag?: string; +}; + // @public export interface AzureKeyVaultKms { enabled?: boolean; @@ -224,6 +229,10 @@ export class ContainerServiceClient extends coreClient.ServiceClient { // (undocumented) apiVersion: string; // (undocumented) + fleetMembers: FleetMembers; + // (undocumented) + fleets: Fleets; + // (undocumented) maintenanceConfigurations: MaintenanceConfigurations; // (undocumented) managedClusters: ManagedClusters; @@ -354,6 +363,26 @@ export interface EndpointDetail { protocol?: string; } +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + 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 Expander = string; @@ -366,6 +395,193 @@ export interface ExtendedLocation { // @public export type ExtendedLocationTypes = string; +// @public +export type Fleet = TrackedResource & { + readonly etag?: string; + hubProfile?: FleetHubProfile; + readonly provisioningState?: FleetProvisioningState; +}; + +// @public +export interface FleetCredentialResult { + readonly name?: string; + readonly value?: Uint8Array; +} + +// @public +export interface FleetCredentialResults { + readonly kubeconfigs?: FleetCredentialResult[]; +} + +// @public +export interface FleetHubProfile { + dnsPrefix?: string; + readonly fqdn?: string; + readonly kubernetesVersion?: string; +} + +// @public +export interface FleetListResult { + readonly nextLink?: string; + value?: Fleet[]; +} + +// @public +export type FleetMember = AzureEntityResource & { + clusterResourceId?: string; + readonly provisioningState?: FleetMemberProvisioningState; +}; + +// @public +export type FleetMemberProvisioningState = string; + +// @public +export interface FleetMembers { + beginCreateOrUpdate(resourceGroupName: string, fleetName: string, fleetMemberName: string, parameters: FleetMember, options?: FleetMembersCreateOrUpdateOptionalParams): Promise, FleetMembersCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, fleetName: string, fleetMemberName: string, parameters: FleetMember, options?: FleetMembersCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, fleetName: string, fleetMemberName: string, options?: FleetMembersDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, fleetName: string, fleetMemberName: string, options?: FleetMembersDeleteOptionalParams): Promise; + get(resourceGroupName: string, fleetName: string, fleetMemberName: string, options?: FleetMembersGetOptionalParams): Promise; + listByFleet(resourceGroupName: string, fleetName: string, options?: FleetMembersListByFleetOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface FleetMembersCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + ifMatch?: string; + ifNoneMatch?: string; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type FleetMembersCreateOrUpdateResponse = FleetMember; + +// @public +export interface FleetMembersDeleteOptionalParams extends coreClient.OperationOptions { + ifMatch?: string; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface FleetMembersGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FleetMembersGetResponse = FleetMember; + +// @public +export interface FleetMembersListByFleetNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FleetMembersListByFleetNextResponse = FleetMembersListResult; + +// @public +export interface FleetMembersListByFleetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FleetMembersListByFleetResponse = FleetMembersListResult; + +// @public +export interface FleetMembersListResult { + readonly nextLink?: string; + value?: FleetMember[]; +} + +// @public +export interface FleetPatch { + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export type FleetProvisioningState = string; + +// @public +export interface Fleets { + beginCreateOrUpdate(resourceGroupName: string, fleetName: string, parameters: Fleet, options?: FleetsCreateOrUpdateOptionalParams): Promise, FleetsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, fleetName: string, parameters: Fleet, options?: FleetsCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, fleetName: string, options?: FleetsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, fleetName: string, options?: FleetsDeleteOptionalParams): Promise; + get(resourceGroupName: string, fleetName: string, options?: FleetsGetOptionalParams): Promise; + list(options?: FleetsListOptionalParams): PagedAsyncIterableIterator; + listByResourceGroup(resourceGroupName: string, options?: FleetsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listCredentials(resourceGroupName: string, fleetName: string, options?: FleetsListCredentialsOptionalParams): Promise; + update(resourceGroupName: string, fleetName: string, options?: FleetsUpdateOptionalParams): Promise; +} + +// @public +export interface FleetsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + ifMatch?: string; + ifNoneMatch?: string; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type FleetsCreateOrUpdateResponse = Fleet; + +// @public +export interface FleetsDeleteOptionalParams extends coreClient.OperationOptions { + ifMatch?: string; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface FleetsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FleetsGetResponse = Fleet; + +// @public +export interface FleetsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FleetsListByResourceGroupNextResponse = FleetListResult; + +// @public +export interface FleetsListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FleetsListByResourceGroupResponse = FleetListResult; + +// @public +export interface FleetsListCredentialsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FleetsListCredentialsResponse = FleetCredentialResults; + +// @public +export interface FleetsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FleetsListNextResponse = FleetListResult; + +// @public +export interface FleetsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FleetsListResponse = FleetListResult; + +// @public +export interface FleetsUpdateOptionalParams extends coreClient.OperationOptions { + ifMatch?: string; + parameters?: FleetPatch; +} + +// @public +export type FleetsUpdateResponse = Fleet; + // @public export type Format = string; @@ -794,6 +1010,38 @@ export enum KnownExtendedLocationTypes { EdgeZone = "EdgeZone" } +// @public +export enum KnownFleetMemberProvisioningState { + // (undocumented) + Canceled = "Canceled", + // (undocumented) + Failed = "Failed", + // (undocumented) + Joining = "Joining", + // (undocumented) + Leaving = "Leaving", + // (undocumented) + Succeeded = "Succeeded", + // (undocumented) + Updating = "Updating" +} + +// @public +export enum KnownFleetProvisioningState { + // (undocumented) + Canceled = "Canceled", + // (undocumented) + Creating = "Creating", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Failed = "Failed", + // (undocumented) + Succeeded = "Succeeded", + // (undocumented) + Updating = "Updating" +} + // @public export enum KnownFormat { Azure = "azure", @@ -1176,7 +1424,7 @@ export interface ManagedClusterAddonProfile { } // @public -export type ManagedClusterAddonProfileIdentity = UserAssignedIdentity; +export type ManagedClusterAddonProfileIdentity = UserAssignedIdentity & {}; // @public export type ManagedClusterAgentPoolProfile = ManagedClusterAgentPoolProfileProperties & { @@ -1478,6 +1726,7 @@ export interface ManagedClustersDeleteOptionalParams extends coreClient.Operatio export interface ManagedClusterSecurityProfile { azureKeyVaultKms?: AzureKeyVaultKms; defender?: ManagedClusterSecurityProfileDefender; + nodeRestriction?: ManagedClusterSecurityProfileNodeRestriction; workloadIdentity?: ManagedClusterSecurityProfileWorkloadIdentity; } @@ -1492,6 +1741,11 @@ export interface ManagedClusterSecurityProfileDefenderSecurityMonitoring { enabled?: boolean; } +// @public +export interface ManagedClusterSecurityProfileNodeRestriction { + enabled?: boolean; +} + // @public export interface ManagedClusterSecurityProfileWorkloadIdentity { enabled?: boolean; diff --git a/sdk/containerservice/arm-containerservice/src/containerServiceClient.ts b/sdk/containerservice/arm-containerservice/src/containerServiceClient.ts index 0830093bcd4d..9890d46e7266 100644 --- a/sdk/containerservice/arm-containerservice/src/containerServiceClient.ts +++ b/sdk/containerservice/arm-containerservice/src/containerServiceClient.ts @@ -25,7 +25,9 @@ import { SnapshotsImpl, ManagedClusterSnapshotsImpl, TrustedAccessRolesImpl, - TrustedAccessRoleBindingsImpl + TrustedAccessRoleBindingsImpl, + FleetsImpl, + FleetMembersImpl } from "./operations"; import { Operations, @@ -38,7 +40,9 @@ import { Snapshots, ManagedClusterSnapshots, TrustedAccessRoles, - TrustedAccessRoleBindings + TrustedAccessRoleBindings, + Fleets, + FleetMembers } from "./operationsInterfaces"; import { ContainerServiceClientOptionalParams } from "./models"; @@ -121,7 +125,7 @@ export class ContainerServiceClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2022-05-02-preview"; + this.apiVersion = options.apiVersion || "2022-06-02-preview"; this.operations = new OperationsImpl(this); this.managedClusters = new ManagedClustersImpl(this); this.maintenanceConfigurations = new MaintenanceConfigurationsImpl(this); @@ -135,6 +139,8 @@ export class ContainerServiceClient extends coreClient.ServiceClient { this.managedClusterSnapshots = new ManagedClusterSnapshotsImpl(this); this.trustedAccessRoles = new TrustedAccessRolesImpl(this); this.trustedAccessRoleBindings = new TrustedAccessRoleBindingsImpl(this); + this.fleets = new FleetsImpl(this); + this.fleetMembers = new FleetMembersImpl(this); this.addCustomApiVersionPolicy(options.apiVersion); } @@ -177,4 +183,6 @@ export class ContainerServiceClient extends coreClient.ServiceClient { managedClusterSnapshots: ManagedClusterSnapshots; trustedAccessRoles: TrustedAccessRoles; trustedAccessRoleBindings: TrustedAccessRoleBindings; + fleets: Fleets; + fleetMembers: FleetMembers; } diff --git a/sdk/containerservice/arm-containerservice/src/models/index.ts b/sdk/containerservice/arm-containerservice/src/models/index.ts index d49fa8825860..111a4a0ea3a8 100644 --- a/sdk/containerservice/arm-containerservice/src/models/index.ts +++ b/sdk/containerservice/arm-containerservice/src/models/index.ts @@ -743,6 +743,8 @@ export interface ManagedClusterSecurityProfile { azureKeyVaultKms?: AzureKeyVaultKms; /** [Workload Identity](https://azure.github.io/azure-workload-identity/docs/) settings for the security profile. */ workloadIdentity?: ManagedClusterSecurityProfileWorkloadIdentity; + /** [Node Restriction](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#noderestriction) settings for the security profile. */ + nodeRestriction?: ManagedClusterSecurityProfileNodeRestriction; } /** Microsoft Defender settings for the security profile. */ @@ -777,6 +779,12 @@ export interface ManagedClusterSecurityProfileWorkloadIdentity { enabled?: boolean; } +/** Node Restriction settings for the security profile. */ +export interface ManagedClusterSecurityProfileNodeRestriction { + /** Whether to enable Node Restriction */ + enabled?: boolean; +} + /** Storage profile for the container service cluster. */ export interface ManagedClusterStorageProfile { /** AzureDisk CSI Driver settings for the storage profile. */ @@ -1339,6 +1347,122 @@ export interface TrustedAccessRoleBindingListResult { readonly nextLink?: string; } +/** The FleetHubProfile configures the fleet hub. */ +export interface FleetHubProfile { + /** DNS prefix used to create the FQDN for the Fleet hub. */ + dnsPrefix?: string; + /** + * The FQDN of the Fleet hub. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly fqdn?: string; + /** + * The Kubernetes version of the Fleet hub. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly kubernetesVersion?: string; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: Record; +} + +/** Properties of a Fleet that can be patched. */ +export interface FleetPatch { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; +} + +/** The response from the List Fleets operation. */ +export interface FleetListResult { + /** The list of Fleets. */ + value?: Fleet[]; + /** + * The URL to get the next page of Fleets. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** The response from the List FleetMembers operation. */ +export interface FleetMembersListResult { + /** The list of members in a given Fleet. */ + value?: FleetMember[]; + /** + * The URL to get the next page of Fleet members. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** The list credential result response. */ +export interface FleetCredentialResults { + /** + * Base64-encoded Kubernetes configuration file. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly kubeconfigs?: FleetCredentialResult[]; +} + +/** The credential result response. */ +export interface FleetCredentialResult { + /** + * The name of the credential. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Base64-encoded Kubernetes configuration file. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: Uint8Array; +} + /** Profile for the container service master. */ export interface ContainerServiceMasterProfile { /** Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. */ @@ -1386,7 +1510,7 @@ export type ManagedClusterAgentPoolProfile = ManagedClusterAgentPoolProfilePrope }; /** Information of user assigned identity used by this add-on. */ -export type ManagedClusterAddonProfileIdentity = UserAssignedIdentity; +export type ManagedClusterAddonProfileIdentity = UserAssignedIdentity & {}; /** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ export type TrackedResource = Resource & { @@ -1409,6 +1533,15 @@ export type TrustedAccessRoleBinding = Resource & { roles: string[]; }; +/** The resource model definition for an Azure Resource Manager resource with an etag. */ +export type AzureEntityResource = Resource & { + /** + * Resource Etag. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly etag?: string; +}; + /** See [planned maintenance](https://docs.microsoft.com/azure/aks/planned-maintenance) for more information about planned maintenance. */ export type MaintenanceConfiguration = SubResource & { /** @@ -1685,6 +1818,33 @@ export type ManagedClusterSnapshot = TrackedResource & { readonly managedClusterPropertiesReadOnly?: ManagedClusterPropertiesForSnapshot; }; +/** The Fleet resource which contains multiple Kubernetes clusters as its members. */ +export type Fleet = TrackedResource & { + /** + * Resource Etag. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly etag?: string; + /** The FleetHubProfile configures the Fleet's hub. */ + hubProfile?: FleetHubProfile; + /** + * The provisioning state of the last accepted operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: FleetProvisioningState; +}; + +/** A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. */ +export type FleetMember = AzureEntityResource & { + /** The ARM resource id of the cluster that joins the Fleet. Must be a valid Azure resource id. e.g.: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. */ + clusterResourceId?: string; + /** + * The provisioning state of the last accepted operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: FleetMemberProvisioningState; +}; + /** Defines headers for AgentPools_upgradeNodeImageVersion operation. */ export interface AgentPoolsUpgradeNodeImageVersionHeaders { /** URL to query for status of the operation. */ @@ -2352,6 +2512,54 @@ export enum KnownTrustedAccessRoleBindingProvisioningState { */ export type TrustedAccessRoleBindingProvisioningState = string; +/** Known values of {@link FleetProvisioningState} that the service accepts. */ +export enum KnownFleetProvisioningState { + Succeeded = "Succeeded", + Failed = "Failed", + Canceled = "Canceled", + Creating = "Creating", + Deleting = "Deleting", + Updating = "Updating" +} + +/** + * Defines values for FleetProvisioningState. \ + * {@link KnownFleetProvisioningState} can be used interchangeably with FleetProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Failed** \ + * **Canceled** \ + * **Creating** \ + * **Deleting** \ + * **Updating** + */ +export type FleetProvisioningState = string; + +/** Known values of {@link FleetMemberProvisioningState} that the service accepts. */ +export enum KnownFleetMemberProvisioningState { + Succeeded = "Succeeded", + Failed = "Failed", + Canceled = "Canceled", + Joining = "Joining", + Leaving = "Leaving", + Updating = "Updating" +} + +/** + * Defines values for FleetMemberProvisioningState. \ + * {@link KnownFleetMemberProvisioningState} can be used interchangeably with FleetMemberProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Failed** \ + * **Canceled** \ + * **Joining** \ + * **Leaving** \ + * **Updating** + */ +export type FleetMemberProvisioningState = string; + /** Known values of {@link ContainerServiceVMSizeTypes} that the service accepts. */ export enum KnownContainerServiceVMSizeTypes { StandardA1 = "Standard_A1", @@ -3247,6 +3455,133 @@ export interface TrustedAccessRoleBindingsListNextOptionalParams /** Contains response data for the listNext operation. */ export type TrustedAccessRoleBindingsListNextResponse = TrustedAccessRoleBindingListResult; +/** Optional parameters. */ +export interface FleetsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. */ + ifMatch?: string; + /** Set to '*' to allow a new resource to be created and prevent updating an existing resource. Other values will result in a 412 Pre-condition Failed response. */ + ifNoneMatch?: string; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type FleetsCreateOrUpdateResponse = Fleet; + +/** Optional parameters. */ +export interface FleetsUpdateOptionalParams + extends coreClient.OperationOptions { + /** Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. */ + ifMatch?: string; + /** The properties of a Fleet to update. */ + parameters?: FleetPatch; +} + +/** Contains response data for the update operation. */ +export type FleetsUpdateResponse = Fleet; + +/** Optional parameters. */ +export interface FleetsGetOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type FleetsGetResponse = Fleet; + +/** Optional parameters. */ +export interface FleetsDeleteOptionalParams + extends coreClient.OperationOptions { + /** Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. */ + ifMatch?: string; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface FleetsListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type FleetsListByResourceGroupResponse = FleetListResult; + +/** Optional parameters. */ +export interface FleetsListOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type FleetsListResponse = FleetListResult; + +/** Optional parameters. */ +export interface FleetsListCredentialsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listCredentials operation. */ +export type FleetsListCredentialsResponse = FleetCredentialResults; + +/** Optional parameters. */ +export interface FleetsListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type FleetsListByResourceGroupNextResponse = FleetListResult; + +/** Optional parameters. */ +export interface FleetsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type FleetsListNextResponse = FleetListResult; + +/** Optional parameters. */ +export interface FleetMembersCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. */ + ifMatch?: string; + /** Set to '*' to allow a new resource to be created and prevent updating an existing resource. Other values will result in a 412 Pre-condition Failed response. */ + ifNoneMatch?: string; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type FleetMembersCreateOrUpdateResponse = FleetMember; + +/** Optional parameters. */ +export interface FleetMembersGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type FleetMembersGetResponse = FleetMember; + +/** Optional parameters. */ +export interface FleetMembersDeleteOptionalParams + extends coreClient.OperationOptions { + /** Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. */ + ifMatch?: string; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface FleetMembersListByFleetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByFleet operation. */ +export type FleetMembersListByFleetResponse = FleetMembersListResult; + +/** Optional parameters. */ +export interface FleetMembersListByFleetNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByFleetNext operation. */ +export type FleetMembersListByFleetNextResponse = FleetMembersListResult; + /** Optional parameters. */ export interface ContainerServiceClientOptionalParams extends coreClient.ServiceClientOptions { diff --git a/sdk/containerservice/arm-containerservice/src/models/mappers.ts b/sdk/containerservice/arm-containerservice/src/models/mappers.ts index d540673000d6..dbb8846e46fc 100644 --- a/sdk/containerservice/arm-containerservice/src/models/mappers.ts +++ b/sdk/containerservice/arm-containerservice/src/models/mappers.ts @@ -2130,6 +2130,13 @@ export const ManagedClusterSecurityProfile: coreClient.CompositeMapper = { name: "Composite", className: "ManagedClusterSecurityProfileWorkloadIdentity" } + }, + nodeRestriction: { + serializedName: "nodeRestriction", + type: { + name: "Composite", + className: "ManagedClusterSecurityProfileNodeRestriction" + } } } } @@ -2221,6 +2228,21 @@ export const ManagedClusterSecurityProfileWorkloadIdentity: coreClient.Composite } }; +export const ManagedClusterSecurityProfileNodeRestriction: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedClusterSecurityProfileNodeRestriction", + modelProperties: { + enabled: { + serializedName: "enabled", + type: { + name: "Boolean" + } + } + } + } +}; + export const ManagedClusterStorageProfile: coreClient.CompositeMapper = { type: { name: "Composite", @@ -3564,6 +3586,248 @@ export const TrustedAccessRoleBindingListResult: coreClient.CompositeMapper = { } }; +export const FleetHubProfile: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FleetHubProfile", + modelProperties: { + dnsPrefix: { + serializedName: "dnsPrefix", + type: { + name: "String" + } + }, + fqdn: { + serializedName: "fqdn", + readOnly: true, + type: { + name: "String" + } + }, + kubernetesVersion: { + serializedName: "kubernetesVersion", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + }, + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + } + } + } +}; + +export const ErrorAdditionalInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + info: { + serializedName: "info", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const FleetPatch: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FleetPatch", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const FleetListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FleetListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Fleet" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const FleetMembersListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FleetMembersListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "FleetMember" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const FleetCredentialResults: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FleetCredentialResults", + modelProperties: { + kubeconfigs: { + serializedName: "kubeconfigs", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "FleetCredentialResult" + } + } + } + } + } + } +}; + +export const FleetCredentialResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FleetCredentialResult", + modelProperties: { + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + value: { + serializedName: "value", + readOnly: true, + type: { + name: "ByteArray" + } + } + } + } +}; + export const ContainerServiceMasterProfile: coreClient.CompositeMapper = { type: { name: "Composite", @@ -3760,6 +4024,23 @@ export const TrustedAccessRoleBinding: coreClient.CompositeMapper = { } }; +export const AzureEntityResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureEntityResource", + modelProperties: { + ...Resource.type.modelProperties, + etag: { + serializedName: "etag", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + export const MaintenanceConfiguration: coreClient.CompositeMapper = { type: { name: "Composite", @@ -4511,6 +4792,60 @@ export const ManagedClusterSnapshot: coreClient.CompositeMapper = { } }; +export const Fleet: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Fleet", + modelProperties: { + ...TrackedResource.type.modelProperties, + etag: { + serializedName: "etag", + readOnly: true, + type: { + name: "String" + } + }, + hubProfile: { + serializedName: "properties.hubProfile", + type: { + name: "Composite", + className: "FleetHubProfile" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const FleetMember: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FleetMember", + modelProperties: { + ...AzureEntityResource.type.modelProperties, + clusterResourceId: { + serializedName: "properties.clusterResourceId", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + export const AgentPoolsUpgradeNodeImageVersionHeaders: coreClient.CompositeMapper = { type: { name: "Composite", diff --git a/sdk/containerservice/arm-containerservice/src/models/parameters.ts b/sdk/containerservice/arm-containerservice/src/models/parameters.ts index a853769988d2..6fdc5a151e9d 100644 --- a/sdk/containerservice/arm-containerservice/src/models/parameters.ts +++ b/sdk/containerservice/arm-containerservice/src/models/parameters.ts @@ -23,7 +23,10 @@ import { PrivateLinkResource as PrivateLinkResourceMapper, Snapshot as SnapshotMapper, ManagedClusterSnapshot as ManagedClusterSnapshotMapper, - TrustedAccessRoleBinding as TrustedAccessRoleBindingMapper + TrustedAccessRoleBinding as TrustedAccessRoleBindingMapper, + Fleet as FleetMapper, + FleetPatch as FleetPatchMapper, + FleetMember as FleetMemberMapper } from "../models/mappers"; export const accept: OperationParameter = { @@ -53,7 +56,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2022-05-02-preview", + defaultValue: "2022-06-02-preview", isConstant: true, serializedName: "api-version", type: { @@ -316,3 +319,70 @@ export const trustedAccessRoleBinding: OperationParameter = { parameterPath: "trustedAccessRoleBinding", mapper: TrustedAccessRoleBindingMapper }; + +export const parameters10: OperationParameter = { + parameterPath: "parameters", + mapper: FleetMapper +}; + +export const fleetName: OperationURLParameter = { + parameterPath: "fleetName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"), + MaxLength: 63, + MinLength: 1 + }, + serializedName: "fleetName", + required: true, + type: { + name: "String" + } + } +}; + +export const ifMatch: OperationParameter = { + parameterPath: ["options", "ifMatch"], + mapper: { + serializedName: "If-Match", + type: { + name: "String" + } + } +}; + +export const ifNoneMatch: OperationParameter = { + parameterPath: ["options", "ifNoneMatch"], + mapper: { + serializedName: "If-None-Match", + type: { + name: "String" + } + } +}; + +export const parameters11: OperationParameter = { + parameterPath: ["options", "parameters"], + mapper: FleetPatchMapper +}; + +export const parameters12: OperationParameter = { + parameterPath: "parameters", + mapper: FleetMemberMapper +}; + +export const fleetMemberName: OperationURLParameter = { + parameterPath: "fleetMemberName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"), + MaxLength: 50, + MinLength: 1 + }, + serializedName: "fleetMemberName", + required: true, + type: { + name: "String" + } + } +}; diff --git a/sdk/containerservice/arm-containerservice/src/operations/fleetMembers.ts b/sdk/containerservice/arm-containerservice/src/operations/fleetMembers.ts new file mode 100644 index 000000000000..d07d693547b3 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/src/operations/fleetMembers.ts @@ -0,0 +1,485 @@ +/* + * 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. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { FleetMembers } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { ContainerServiceClient } from "../containerServiceClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + FleetMember, + FleetMembersListByFleetNextOptionalParams, + FleetMembersListByFleetOptionalParams, + FleetMembersCreateOrUpdateOptionalParams, + FleetMembersCreateOrUpdateResponse, + FleetMembersGetOptionalParams, + FleetMembersGetResponse, + FleetMembersDeleteOptionalParams, + FleetMembersListByFleetResponse, + FleetMembersListByFleetNextResponse +} from "../models"; + +/// +/** Class containing FleetMembers operations. */ +export class FleetMembersImpl implements FleetMembers { + private readonly client: ContainerServiceClient; + + /** + * Initialize a new instance of the class FleetMembers class. + * @param client Reference to the service client + */ + constructor(client: ContainerServiceClient) { + this.client = client; + } + + /** + * Lists the members of a fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param options The options parameters. + */ + public listByFleet( + resourceGroupName: string, + fleetName: string, + options?: FleetMembersListByFleetOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByFleetPagingAll( + resourceGroupName, + fleetName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByFleetPagingPage( + resourceGroupName, + fleetName, + options + ); + } + }; + } + + private async *listByFleetPagingPage( + resourceGroupName: string, + fleetName: string, + options?: FleetMembersListByFleetOptionalParams + ): AsyncIterableIterator { + let result = await this._listByFleet(resourceGroupName, fleetName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByFleetNext( + resourceGroupName, + fleetName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByFleetPagingAll( + resourceGroupName: string, + fleetName: string, + options?: FleetMembersListByFleetOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByFleetPagingPage( + resourceGroupName, + fleetName, + options + )) { + yield* page; + } + } + + /** + * A member contains a reference to an existing Kubernetes cluster. Creating a member makes the + * referenced cluster join the Fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param parameters The Fleet member to create or update. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + parameters: FleetMember, + options?: FleetMembersCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + FleetMembersCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, fleetName, fleetMemberName, parameters, options }, + createOrUpdateOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * A member contains a reference to an existing Kubernetes cluster. Creating a member makes the + * referenced cluster join the Fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param parameters The Fleet member to create or update. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + parameters: FleetMember, + options?: FleetMembersCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + fleetName, + fleetMemberName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Gets a Fleet member. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + options?: FleetMembersGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, fleetName, fleetMemberName, options }, + getOperationSpec + ); + } + + /** + * Deleting a Fleet member results in the member cluster leaving fleet. The Member azure resource is + * deleted upon success. The underlying cluster is not deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + options?: FleetMembersDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, fleetName, fleetMemberName, options }, + deleteOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Deleting a Fleet member results in the member cluster leaving fleet. The Member azure resource is + * deleted upon success. The underlying cluster is not deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + options?: FleetMembersDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + fleetName, + fleetMemberName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Lists the members of a fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param options The options parameters. + */ + private _listByFleet( + resourceGroupName: string, + fleetName: string, + options?: FleetMembersListByFleetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, fleetName, options }, + listByFleetOperationSpec + ); + } + + /** + * ListByFleetNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param nextLink The nextLink from the previous successful call to the ListByFleet method. + * @param options The options parameters. + */ + private _listByFleetNext( + resourceGroupName: string, + fleetName: string, + nextLink: string, + options?: FleetMembersListByFleetNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, fleetName, nextLink, options }, + listByFleetNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.FleetMember + }, + 201: { + bodyMapper: Mappers.FleetMember + }, + 202: { + bodyMapper: Mappers.FleetMember + }, + 204: { + bodyMapper: Mappers.FleetMember + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters12, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.fleetName, + Parameters.fleetMemberName + ], + headerParameters: [ + Parameters.accept, + Parameters.contentType, + Parameters.ifMatch, + Parameters.ifNoneMatch + ], + mediaType: "json", + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FleetMember + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.fleetName, + Parameters.fleetMemberName + ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.fleetName, + Parameters.fleetMemberName + ], + headerParameters: [Parameters.accept, Parameters.ifMatch], + serializer +}; +const listByFleetOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FleetMembersListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.fleetName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByFleetNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FleetMembersListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink, + Parameters.fleetName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/containerservice/arm-containerservice/src/operations/fleets.ts b/sdk/containerservice/arm-containerservice/src/operations/fleets.ts new file mode 100644 index 000000000000..c24591aca8fc --- /dev/null +++ b/sdk/containerservice/arm-containerservice/src/operations/fleets.ts @@ -0,0 +1,642 @@ +/* + * 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. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Fleets } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { ContainerServiceClient } from "../containerServiceClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + Fleet, + FleetsListByResourceGroupNextOptionalParams, + FleetsListByResourceGroupOptionalParams, + FleetsListNextOptionalParams, + FleetsListOptionalParams, + FleetsCreateOrUpdateOptionalParams, + FleetsCreateOrUpdateResponse, + FleetsUpdateOptionalParams, + FleetsUpdateResponse, + FleetsGetOptionalParams, + FleetsGetResponse, + FleetsDeleteOptionalParams, + FleetsListByResourceGroupResponse, + FleetsListResponse, + FleetsListCredentialsOptionalParams, + FleetsListCredentialsResponse, + FleetsListByResourceGroupNextResponse, + FleetsListNextResponse +} from "../models"; + +/// +/** Class containing Fleets operations. */ +export class FleetsImpl implements Fleets { + private readonly client: ContainerServiceClient; + + /** + * Initialize a new instance of the class Fleets class. + * @param client Reference to the service client + */ + constructor(client: ContainerServiceClient) { + this.client = client; + } + + /** + * Lists fleets in the specified subscription and resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroupName: string, + options?: FleetsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByResourceGroupPagingPage(resourceGroupName, options); + } + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: FleetsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroup(resourceGroupName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: FleetsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Lists fleets in the specified subscription. + * @param options The options parameters. + */ + public list( + options?: FleetsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: FleetsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: FleetsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Creates or updates a Fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param parameters The Fleet to create or update. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + fleetName: string, + parameters: Fleet, + options?: FleetsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + FleetsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, fleetName, parameters, options }, + createOrUpdateOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Creates or updates a Fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param parameters The Fleet to create or update. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + fleetName: string, + parameters: Fleet, + options?: FleetsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + fleetName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Patches a fleet resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + fleetName: string, + options?: FleetsUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, fleetName, options }, + updateOperationSpec + ); + } + + /** + * Gets a Fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + fleetName: string, + options?: FleetsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, fleetName, options }, + getOperationSpec + ); + } + + /** + * Deletes a Fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + fleetName: string, + options?: FleetsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, fleetName, options }, + deleteOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Deletes a Fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + fleetName: string, + options?: FleetsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + fleetName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Lists fleets in the specified subscription and resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + private _listByResourceGroup( + resourceGroupName: string, + options?: FleetsListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); + } + + /** + * Lists fleets in the specified subscription. + * @param options The options parameters. + */ + private _list( + options?: FleetsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * Lists the user credentials of a Fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param options The options parameters. + */ + listCredentials( + resourceGroupName: string, + fleetName: string, + options?: FleetsListCredentialsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, fleetName, options }, + listCredentialsOperationSpec + ); + } + + /** + * ListByResourceGroupNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. + * @param options The options parameters. + */ + private _listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: FleetsListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: FleetsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Fleet + }, + 201: { + bodyMapper: Mappers.Fleet + }, + 202: { + bodyMapper: Mappers.Fleet + }, + 204: { + bodyMapper: Mappers.Fleet + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters10, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.fleetName + ], + headerParameters: [ + Parameters.accept, + Parameters.contentType, + Parameters.ifMatch, + Parameters.ifNoneMatch + ], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.Fleet + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters11, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.fleetName + ], + headerParameters: [ + Parameters.accept, + Parameters.contentType, + Parameters.ifMatch + ], + mediaType: "json", + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Fleet + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.fleetName + ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.fleetName + ], + headerParameters: [Parameters.accept, Parameters.ifMatch], + serializer +}; +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FleetListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FleetListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listCredentialsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.FleetCredentialResults + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.fleetName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FleetListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FleetListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/containerservice/arm-containerservice/src/operations/index.ts b/sdk/containerservice/arm-containerservice/src/operations/index.ts index 9266846c2a40..e45d9b4f3499 100644 --- a/sdk/containerservice/arm-containerservice/src/operations/index.ts +++ b/sdk/containerservice/arm-containerservice/src/operations/index.ts @@ -17,3 +17,5 @@ export * from "./snapshots"; export * from "./managedClusterSnapshots"; export * from "./trustedAccessRoles"; export * from "./trustedAccessRoleBindings"; +export * from "./fleets"; +export * from "./fleetMembers"; diff --git a/sdk/containerservice/arm-containerservice/src/operationsInterfaces/fleetMembers.ts b/sdk/containerservice/arm-containerservice/src/operationsInterfaces/fleetMembers.ts new file mode 100644 index 000000000000..8f6f197a37df --- /dev/null +++ b/sdk/containerservice/arm-containerservice/src/operationsInterfaces/fleetMembers.ts @@ -0,0 +1,113 @@ +/* + * 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. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + FleetMember, + FleetMembersListByFleetOptionalParams, + FleetMembersCreateOrUpdateOptionalParams, + FleetMembersCreateOrUpdateResponse, + FleetMembersGetOptionalParams, + FleetMembersGetResponse, + FleetMembersDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a FleetMembers. */ +export interface FleetMembers { + /** + * Lists the members of a fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param options The options parameters. + */ + listByFleet( + resourceGroupName: string, + fleetName: string, + options?: FleetMembersListByFleetOptionalParams + ): PagedAsyncIterableIterator; + /** + * A member contains a reference to an existing Kubernetes cluster. Creating a member makes the + * referenced cluster join the Fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param parameters The Fleet member to create or update. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + parameters: FleetMember, + options?: FleetMembersCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + FleetMembersCreateOrUpdateResponse + > + >; + /** + * A member contains a reference to an existing Kubernetes cluster. Creating a member makes the + * referenced cluster join the Fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param parameters The Fleet member to create or update. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + parameters: FleetMember, + options?: FleetMembersCreateOrUpdateOptionalParams + ): Promise; + /** + * Gets a Fleet member. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + options?: FleetMembersGetOptionalParams + ): Promise; + /** + * Deleting a Fleet member results in the member cluster leaving fleet. The Member azure resource is + * deleted upon success. The underlying cluster is not deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + options?: FleetMembersDeleteOptionalParams + ): Promise, void>>; + /** + * Deleting a Fleet member results in the member cluster leaving fleet. The Member azure resource is + * deleted upon success. The underlying cluster is not deleted. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + fleetName: string, + fleetMemberName: string, + options?: FleetMembersDeleteOptionalParams + ): Promise; +} diff --git a/sdk/containerservice/arm-containerservice/src/operationsInterfaces/fleets.ts b/sdk/containerservice/arm-containerservice/src/operationsInterfaces/fleets.ts new file mode 100644 index 000000000000..1dcc3e16d08d --- /dev/null +++ b/sdk/containerservice/arm-containerservice/src/operationsInterfaces/fleets.ts @@ -0,0 +1,129 @@ +/* + * 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. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + Fleet, + FleetsListByResourceGroupOptionalParams, + FleetsListOptionalParams, + FleetsCreateOrUpdateOptionalParams, + FleetsCreateOrUpdateResponse, + FleetsUpdateOptionalParams, + FleetsUpdateResponse, + FleetsGetOptionalParams, + FleetsGetResponse, + FleetsDeleteOptionalParams, + FleetsListCredentialsOptionalParams, + FleetsListCredentialsResponse +} from "../models"; + +/// +/** Interface representing a Fleets. */ +export interface Fleets { + /** + * Lists fleets in the specified subscription and resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: FleetsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Lists fleets in the specified subscription. + * @param options The options parameters. + */ + list(options?: FleetsListOptionalParams): PagedAsyncIterableIterator; + /** + * Creates or updates a Fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param parameters The Fleet to create or update. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + fleetName: string, + parameters: Fleet, + options?: FleetsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + FleetsCreateOrUpdateResponse + > + >; + /** + * Creates or updates a Fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param parameters The Fleet to create or update. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + fleetName: string, + parameters: Fleet, + options?: FleetsCreateOrUpdateOptionalParams + ): Promise; + /** + * Patches a fleet resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + fleetName: string, + options?: FleetsUpdateOptionalParams + ): Promise; + /** + * Gets a Fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + fleetName: string, + options?: FleetsGetOptionalParams + ): Promise; + /** + * Deletes a Fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + fleetName: string, + options?: FleetsDeleteOptionalParams + ): Promise, void>>; + /** + * Deletes a Fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + fleetName: string, + options?: FleetsDeleteOptionalParams + ): Promise; + /** + * Lists the user credentials of a Fleet. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param options The options parameters. + */ + listCredentials( + resourceGroupName: string, + fleetName: string, + options?: FleetsListCredentialsOptionalParams + ): Promise; +} diff --git a/sdk/containerservice/arm-containerservice/src/operationsInterfaces/index.ts b/sdk/containerservice/arm-containerservice/src/operationsInterfaces/index.ts index 9266846c2a40..e45d9b4f3499 100644 --- a/sdk/containerservice/arm-containerservice/src/operationsInterfaces/index.ts +++ b/sdk/containerservice/arm-containerservice/src/operationsInterfaces/index.ts @@ -17,3 +17,5 @@ export * from "./snapshots"; export * from "./managedClusterSnapshots"; export * from "./trustedAccessRoles"; export * from "./trustedAccessRoleBindings"; +export * from "./fleets"; +export * from "./fleetMembers"; diff --git a/sdk/containerservice/arm-containerservice/test/sampleTest.ts b/sdk/containerservice/arm-containerservice/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/containerservice/arm-containerservice/test/sampleTest.ts @@ -0,0 +1,43 @@ +/* + * 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. + */ + +import { + Recorder, + RecorderStartOptions, + env +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/containerservice/arm-containerservice/tsconfig.json b/sdk/containerservice/arm-containerservice/tsconfig.json index 5bad5556bbfd..3e6ae96443f3 100644 --- a/sdk/containerservice/arm-containerservice/tsconfig.json +++ b/sdk/containerservice/arm-containerservice/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-containerservice": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"