Skip to content

Commit

Permalink
CodeGen from PR 21203 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 6dec761fe5805a570da5e99a179d6bfab1290724 into cacf126b6a1d44e144a999dce18e34bf520521c5
  • Loading branch information
SDKAuto committed Oct 20, 2022
1 parent 03e4fa2 commit fd0e1c5
Show file tree
Hide file tree
Showing 9 changed files with 194 additions and 167 deletions.
94 changes: 51 additions & 43 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

21 changes: 10 additions & 11 deletions sdk/managedapplications/arm-managedapplications/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Release History

## 2.0.2 (Unreleased)

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes


## 2.1.0 (2022-10-20)

**Features**

- Added Interface Application
- Added Interface ApplicationDefinition
- Added Interface ApplicationPatchable
- Added Interface GenericResource

## 2.0.1 (2022-04-18)

**features**
Expand Down
10 changes: 5 additions & 5 deletions sdk/managedapplications/arm-managedapplications/_meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"commit": "a42f1b58607091c4f255ead152a8ef323fa0b280",
"readme": "specification\\resources\\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:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\resources\\resource-manager\\readme.md --use=@autorest/[email protected]alpha.19.20220408.1 --generate-sample=true",
"commit": "58c77a8df2fa09cf1fb85d2f91e75564c9d1a444",
"readme": "specification/resources/resource-manager/readme.md",
"autorest_command": "autorest --version=3.8.4 --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/resources/resource-manager/readme.md --use=@autorest/[email protected]rc.2",
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
"release_tool": "@azure-tools/js-sdk-release-tools@2.2.6",
"use": "@autorest/[email protected]alpha.19.20220408.1"
"release_tool": "@azure-tools/js-sdk-release-tools@2.4.4",
"use": "@autorest/[email protected]rc.2"
}
29 changes: 12 additions & 17 deletions sdk/managedapplications/arm-managedapplications/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"sdk-type": "mgmt",
"author": "Microsoft Corporation",
"description": "A generated SDK for ApplicationClient.",
"version": "2.0.2",
"version": "2.1.0",
"engines": {
"node": ">=14.0.0"
},
Expand Down Expand Up @@ -36,13 +36,17 @@
"mkdirp": "^1.0.4",
"rollup": "^2.66.1",
"rollup-plugin-sourcemaps": "^0.6.3",
"typescript": "~4.2.0",
"typescript": "~4.6.0",
"uglify-js": "^3.4.9",
"rimraf": "^3.0.0",
"@azure/identity": "^2.0.1",
"@azure-tools/test-recorder": "^1.0.0",
"@azure-tools/test-recorder": "^2.0.0",
"@azure-tools/test-credential": "^1.0.0",
"mocha": "^7.1.1",
"cross-env": "^7.0.2"
"@types/chai": "^4.2.8",
"chai": "^4.2.0",
"cross-env": "^7.0.2",
"@azure/dev-tool": "^1.0.0"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/managedapplications/arm-managedapplications",
"repository": {
Expand Down Expand Up @@ -93,9 +97,8 @@
"unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node",
"unit-test:browser": "echo skipped",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js",
"integration-test:browser": "echo skipped",
"docs": "echo skipped"
"integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'",
"integration-test:browser": "echo skipped"
},
"sideEffects": false,
"//metadata": {
Expand All @@ -106,13 +109,5 @@
}
]
},
"autoPublish": true,
"//sampleConfiguration": {
"productName": "",
"productSlugs": [
"azure"
],
"disableDocsMs": true,
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-managedapplications?view=azure-node-preview"
}
}
"autoPublish": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import { PollerLike } from '@azure/core-lro';
import { PollOperationState } from '@azure/core-lro';

// @public
export type Application = GenericResource & {
plan?: Plan;
export interface Application extends GenericResource {
applicationDefinitionId?: string;
kind: string;
managedResourceGroupId: string;
applicationDefinitionId?: string;
parameters?: Record<string, unknown>;
readonly outputs?: Record<string, unknown>;
parameters?: Record<string, unknown>;
plan?: Plan;
readonly provisioningState?: ProvisioningState;
};
}

// @public
export interface ApplicationArtifact {
Expand Down Expand Up @@ -55,17 +55,17 @@ export interface ApplicationClientOptionalParams extends coreClient.ServiceClien
}

// @public
export type ApplicationDefinition = GenericResource & {
lockLevel: ApplicationLockLevel;
displayName?: string;
isEnabled?: string;
authorizations: ApplicationProviderAuthorization[];
export interface ApplicationDefinition extends GenericResource {
artifacts?: ApplicationArtifact[];
authorizations: ApplicationProviderAuthorization[];
createUiDefinition?: Record<string, unknown>;
description?: string;
packageFileUri?: string;
displayName?: string;
isEnabled?: string;
lockLevel: ApplicationLockLevel;
mainTemplate?: Record<string, unknown>;
createUiDefinition?: Record<string, unknown>;
};
packageFileUri?: string;
}

// @public
export interface ApplicationDefinitionListResult {
Expand Down Expand Up @@ -156,15 +156,15 @@ export interface ApplicationListResult {
export type ApplicationLockLevel = "CanNotDelete" | "ReadOnly" | "None";

// @public
export type ApplicationPatchable = GenericResource & {
plan?: PlanPatchable;
export interface ApplicationPatchable extends GenericResource {
applicationDefinitionId?: string;
kind?: string;
managedResourceGroupId?: string;
applicationDefinitionId?: string;
parameters?: Record<string, unknown>;
readonly outputs?: Record<string, unknown>;
parameters?: Record<string, unknown>;
plan?: PlanPatchable;
readonly provisioningState?: ProvisioningState;
};
}

// @public
export interface ApplicationProviderAuthorization {
Expand Down Expand Up @@ -286,11 +286,11 @@ export interface ErrorResponse {
}

// @public
export type GenericResource = Resource & {
export interface GenericResource extends Resource {
identity?: Identity;
managedBy?: string;
sku?: Sku;
identity?: Identity;
};
}

// @public
export interface Identity {
Expand All @@ -301,27 +301,16 @@ export interface Identity {

// @public
export enum KnownProvisioningState {
// (undocumented)
Accepted = "Accepted",
// (undocumented)
Canceled = "Canceled",
// (undocumented)
Created = "Created",
// (undocumented)
Creating = "Creating",
// (undocumented)
Deleted = "Deleted",
// (undocumented)
Deleting = "Deleting",
// (undocumented)
Failed = "Failed",
// (undocumented)
Ready = "Ready",
// (undocumented)
Running = "Running",
// (undocumented)
Succeeded = "Succeeded",
// (undocumented)
Updating = "Updating"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

import * as coreClient from "@azure/core-client";
import * as coreRestPipeline from "@azure/core-rest-pipeline";
import {
PipelineRequest,
PipelineResponse,
SendRequest
} from "@azure/core-rest-pipeline";
import * as coreAuth from "@azure/core-auth";
import { PagedAsyncIterableIterator } from "@azure/core-paging";
import { ApplicationsImpl, ApplicationDefinitionsImpl } from "./operations";
Expand Down Expand Up @@ -56,7 +61,7 @@ export class ApplicationClient extends coreClient.ServiceClient {
credential: credentials
};

const packageDetails = `azsdk-js-arm-managedapplications/2.0.2`;
const packageDetails = `azsdk-js-arm-managedapplications/2.1.0`;
const userAgentPrefix =
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
Expand All @@ -76,27 +81,34 @@ export class ApplicationClient extends coreClient.ServiceClient {
};
super(optionsWithDefaults);

let bearerTokenAuthenticationPolicyFound: boolean = false;
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
(pipelinePolicy) =>
pipelinePolicy.name ===
coreRestPipeline.bearerTokenAuthenticationPolicyName
);
if (!bearerTokenAuthenticationPolicyFound) {
this.pipeline.removePolicy({
name: coreRestPipeline.bearerTokenAuthenticationPolicyName
});
this.pipeline.addPolicy(
coreRestPipeline.bearerTokenAuthenticationPolicy({
scopes: `${optionsWithDefaults.baseUri}/.default`,
challengeCallbacks: {
authorizeRequestOnChallenge:
coreClient.authorizeRequestOnClaimChallenge
}
})
);
}
}
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}`,
challengeCallbacks: {
authorizeRequestOnChallenge:
coreClient.authorizeRequestOnClaimChallenge
}
})
);
}
// Parameter assignments
this.subscriptionId = subscriptionId;
Expand All @@ -106,6 +118,35 @@ export class ApplicationClient extends coreClient.ServiceClient {
this.apiVersion = options.apiVersion || "2018-06-01";
this.applications = new ApplicationsImpl(this);
this.applicationDefinitions = new ApplicationDefinitionsImpl(this);
this.addCustomApiVersionPolicy(options.apiVersion);
}

/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
private addCustomApiVersionPolicy(apiVersion?: string) {
if (!apiVersion) {
return;
}
const apiVersionPolicy = {
name: "CustomApiVersionPolicy",
async sendRequest(
request: PipelineRequest,
next: SendRequest
): Promise<PipelineResponse> {
const param = request.url.split("?");
if (param.length > 1) {
const newParams = param[1].split("&").map((item) => {
if (item.indexOf("api-version") > -1) {
return "api-version=" + apiVersion;
} else {
return item;
}
});
request.url = param[0] + "?" + newParams.join("&");
}
return next(request);
}
};
this.pipeline.addPolicy(apiVersionPolicy);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,17 @@ export interface ApplicationListResult {
}

/** Resource information. */
export type GenericResource = Resource & {
export interface GenericResource extends Resource {
/** ID of the resource that manages this resource. */
managedBy?: string;
/** The SKU of the resource. */
sku?: Sku;
/** The identity of the resource. */
identity?: Identity;
};
}

/** Information about managed application. */
export type Application = GenericResource & {
export interface Application extends GenericResource {
/** The plan information. */
plan?: Plan;
/** The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. */
Expand All @@ -193,10 +193,10 @@ export type Application = GenericResource & {
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly provisioningState?: ProvisioningState;
};
}

/** Information about managed application. */
export type ApplicationPatchable = GenericResource & {
export interface ApplicationPatchable extends GenericResource {
/** The plan information. */
plan?: PlanPatchable;
/** The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. */
Expand All @@ -217,10 +217,10 @@ export type ApplicationPatchable = GenericResource & {
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly provisioningState?: ProvisioningState;
};
}

/** Information about managed application definition. */
export type ApplicationDefinition = GenericResource & {
export interface ApplicationDefinition extends GenericResource {
/** The managed application lock level. */
lockLevel: ApplicationLockLevel;
/** The managed application definition display name. */
Expand All @@ -239,20 +239,31 @@ export type ApplicationDefinition = GenericResource & {
mainTemplate?: Record<string, unknown>;
/** The createUiDefinition json for the backing template with Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string. */
createUiDefinition?: Record<string, unknown>;
};
}

/** Known values of {@link ProvisioningState} that the service accepts. */
export enum KnownProvisioningState {
/** Accepted */
Accepted = "Accepted",
/** Running */
Running = "Running",
/** Ready */
Ready = "Ready",
/** Creating */
Creating = "Creating",
/** Created */
Created = "Created",
/** Deleting */
Deleting = "Deleting",
/** Deleted */
Deleted = "Deleted",
/** Canceled */
Canceled = "Canceled",
/** Failed */
Failed = "Failed",
/** Succeeded */
Succeeded = "Succeeded",
/** Updating */
Updating = "Updating"
}

Expand Down
Loading

0 comments on commit fd0e1c5

Please sign in to comment.