Skip to content

Commit

Permalink
CodeGen from PR 19538 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Fix name and displayName issues (Azure#19538)

* fix name displayName

* fix enum issue

* Swagger ModelValidation fixes

* fixes

* json fix

* fix enum

* parsing

* json fix

* dummy commit

* adding type

* json fix

* nextlink fix

* remove @ from mgmt

* nextlink revert
  • Loading branch information
SDKAuto committed Jun 28, 2022
1 parent cab71f9 commit d1bbc65
Show file tree
Hide file tree
Showing 9 changed files with 196 additions and 164 deletions.
30 changes: 20 additions & 10 deletions sdk/managementgroups/arm-managementgroups/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
# Release History

## 3.0.0 (2022-06-28)

**Features**

## 2.0.2 (Unreleased)

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes

- Added Interface ParentGroupBagInfo
- Added Type Alias EntitySearchType
- Added Type Alias EntityViewParameterType
- Added Type Alias ManagementGroupExpandType
- Added Enum KnownEntitySearchType
- Added Enum KnownEntityViewParameterType
- Added Enum KnownManagementGroupExpandType

**Breaking Changes**

- Removed Enum KnownEnum0
- Removed Enum KnownEnum2
- Removed Enum KnownEnum3
- Removed Enum KnownManagementGroupChildType
- Removed Enum KnownPermissions

## 2.0.1 (2022-04-24)

**Features**
Expand Down
12 changes: 6 additions & 6 deletions sdk/managementgroups/arm-managementgroups/_meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"commit": "184b23b63ee3a79fb41ca3aa55a31a8d9e636772",
"readme": "specification\\managementgroups\\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\\managementgroups\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.1 --generate-sample=true",
"commit": "a7de71ef99f5ea2aefe38bbd3c55db09c64547e8",
"readme": "specification/managementgroups/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=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/managementgroups/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.2.6",
"use": "@autorest/typescript@6.0.0-alpha.19.20220408.1"
}
"release_tool": "@azure-tools/js-sdk-release-tools@2.3.2",
"use": "@autorest/typescript@6.0.0-alpha.19.20220425.1"
}
22 changes: 8 additions & 14 deletions sdk/managementgroups/arm-managementgroups/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 ManagementGroupsAPI.",
"version": "2.0.2",
"version": "3.0.0",
"engines": {
"node": ">=12.0.0"
},
Expand Down Expand Up @@ -40,9 +40,11 @@
"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"
"cross-env": "^7.0.2",
"@azure/dev-tool": "^1.0.0"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/managementgroups/arm-managementgroups",
"repository": {
Expand Down Expand Up @@ -93,7 +95,7 @@
"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:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'",
"integration-test:browser": "echo skipped",
"docs": "echo skipped"
},
Expand All @@ -106,13 +108,5 @@
}
]
},
"autoPublish": true,
"//sampleConfiguration": {
"productName": "",
"productSlugs": [
"azure"
],
"disableDocsMs": true,
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-managementgroups?view=azure-node-preview"
}
}
"autoPublish": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ export interface EntitiesListNextOptionalParams extends coreClient.OperationOpti
cacheControl?: string;
filter?: string;
groupName?: string;
search?: Enum2;
search?: EntitySearchType;
select?: string;
skip?: number;
skiptoken?: string;
top?: number;
view?: Enum3;
view?: EntityViewParameterType;
}

// @public
Expand All @@ -127,12 +127,12 @@ export interface EntitiesListOptionalParams extends coreClient.OperationOptions
cacheControl?: string;
filter?: string;
groupName?: string;
search?: Enum2;
search?: EntitySearchType;
select?: string;
skip?: number;
skiptoken?: string;
top?: number;
view?: Enum3;
view?: EntityViewParameterType;
}

// @public
Expand Down Expand Up @@ -178,13 +178,10 @@ export interface EntityParentGroupInfo {
}

// @public
export type Enum0 = string;
export type EntitySearchType = string;

// @public
export type Enum2 = string;

// @public
export type Enum3 = string;
export type EntityViewParameterType = string;

// @public
export interface ErrorDetails {
Expand Down Expand Up @@ -266,17 +263,7 @@ export interface HierarchySettingsUpdateOptionalParams extends coreClient.Operat
export type HierarchySettingsUpdateResponse = HierarchySettings;

// @public
export enum KnownEnum0 {
// (undocumented)
Ancestors = "ancestors",
// (undocumented)
Children = "children",
// (undocumented)
Path = "path"
}

// @public
export enum KnownEnum2 {
export enum KnownEntitySearchType {
// (undocumented)
AllowedChildren = "AllowedChildren",
// (undocumented)
Expand All @@ -290,7 +277,7 @@ export enum KnownEnum2 {
}

// @public
export enum KnownEnum3 {
export enum KnownEntityViewParameterType {
// (undocumented)
Audit = "Audit",
// (undocumented)
Expand All @@ -302,23 +289,13 @@ export enum KnownEnum3 {
}

// @public
export enum KnownManagementGroupChildType {
// (undocumented)
MicrosoftManagementManagementGroups = "Microsoft.Management/managementGroups",
export enum KnownManagementGroupExpandType {
// (undocumented)
Subscriptions = "/subscriptions"
}

// @public
export enum KnownPermissions {
// (undocumented)
Delete = "delete",
// (undocumented)
Edit = "edit",
Ancestors = "ancestors",
// (undocumented)
Noaccess = "noaccess",
Children = "children",
// (undocumented)
View = "view"
Path = "path"
}

// @public
Expand Down Expand Up @@ -348,7 +325,7 @@ export interface ManagementGroupChildInfo {
}

// @public
export type ManagementGroupChildType = string;
export type ManagementGroupChildType = "Microsoft.Management/managementGroups" | "/subscriptions";

// @public
export interface ManagementGroupDetails {
Expand All @@ -361,6 +338,9 @@ export interface ManagementGroupDetails {
version?: number;
}

// @public
export type ManagementGroupExpandType = string;

// @public
export interface ManagementGroupInfo {
displayName?: string;
Expand Down Expand Up @@ -476,7 +456,7 @@ export type ManagementGroupsGetDescendantsResponse = DescendantListResult;
// @public
export interface ManagementGroupsGetOptionalParams extends coreClient.OperationOptions {
cacheControl?: string;
expand?: Enum0;
expand?: ManagementGroupExpandType;
filter?: string;
recurse?: boolean;
}
Expand Down Expand Up @@ -603,6 +583,13 @@ export interface OperationsListOptionalParams extends coreClient.OperationOption
// @public
export type OperationsListResponse = OperationListResult;

// @public
export interface ParentGroupBagInfo {
displayName?: string;
id?: string;
name?: string;
}

// @public
export interface ParentGroupInfo {
displayName?: string;
Expand All @@ -617,7 +604,7 @@ export interface PatchManagementGroupRequest {
}

// @public
type Permissions_2 = string;
type Permissions_2 = "noaccess" | "view" | "edit" | "delete";
export { Permissions_2 as Permissions }

// @public
Expand All @@ -638,7 +625,7 @@ export interface SubscriptionUnderManagementGroup {
displayName?: string;
readonly id?: string;
readonly name?: string;
parent?: DescendantParentGroupInfo;
parent?: ParentGroupBagInfo;
state?: string;
tenant?: string;
readonly type?: string;
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 {
ManagementGroupsImpl,
Expand Down Expand Up @@ -62,7 +67,7 @@ export class ManagementGroupsAPI extends coreClient.ServiceClient {
credential: credentials
};

const packageDetails = `azsdk-js-arm-managementgroups/2.0.2`;
const packageDetails = `azsdk-js-arm-managementgroups/3.0.0`;
const userAgentPrefix =
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
Expand Down Expand Up @@ -117,6 +122,35 @@ export class ManagementGroupsAPI extends coreClient.ServiceClient {
);
this.operations = new OperationsImpl(this);
this.entities = new EntitiesImpl(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 item.replace(/(?<==).*$/, apiVersion);
} else {
return item;
}
});
request.url = param[0] + "?" + newParams.join("&");
}
return next(request);
}
};
this.pipeline.addPolicy(apiVersionPolicy);
}

/**
Expand Down
Loading

0 comments on commit d1bbc65

Please sign in to comment.