Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions sdk/support/arm-support/_meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"commit": "d600759c3516b61a7c353bc8682bccbab85a6f65",
"readme": "specification\\support\\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\\support\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.1 --generate-sample=true",
"commit": "8dac2febba482c00f1a472cc62a63ca5d83dc9f9",
"readme": "specification/support/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/support/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-alpha.19.20220408.1"
}
"release_tool": "@azure-tools/js-sdk-release-tools@2.3.1",
"use": "@autorest/typescript@6.0.0-alpha.19.20220425.1"
}
22 changes: 8 additions & 14 deletions sdk/support/arm-support/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 MicrosoftSupport.",
"version": "2.0.2",
"version": "2.0.3",
"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/support/arm-support",
"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-support?view=azure-node-preview"
}
}
"autoPublish": true
}
36 changes: 35 additions & 1 deletion sdk/support/arm-support/src/microsoftSupport.ts
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 {
OperationsImpl,
Expand Down Expand Up @@ -57,7 +62,7 @@ export class MicrosoftSupport extends coreClient.ServiceClient {
credential: credentials
};

const packageDetails = `azsdk-js-arm-support/2.0.2`;
const packageDetails = `azsdk-js-arm-support/2.0.3`;
const userAgentPrefix =
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
Expand Down Expand Up @@ -110,6 +115,35 @@ export class MicrosoftSupport extends coreClient.ServiceClient {
this.problemClassifications = new ProblemClassificationsImpl(this);
this.supportTickets = new SupportTicketsImpl(this);
this.communications = new CommunicationsImpl(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);
}

operations: Operations;
Expand Down
4 changes: 2 additions & 2 deletions sdk/support/arm-support/src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ export interface SupportTicketsListOptionalParams
extends coreClient.OperationOptions {
/** The number of values to return in the collection. Default is 25 and max is 100. */
top?: number;
/** The filter to apply on the operation. We support 'odata v4.0' filter semantics. [Learn more](https://docs.microsoft.com/odata/concepts/queryoptions-overview). _Status_ filter can only be used with Equals ('eq') operator. For _CreatedDate_ filter, the supported operators are Greater Than ('gt') and Greater Than or Equals ('ge'). When using both filters, combine them using the logical 'AND'. */
/** The filter to apply on the operation. We support 'odata v4.0' filter semantics. [Learn more](https://docs.microsoft.com/odata/concepts/queryoptions-overview). _Status_, _ServiceId_, and _ProblemClassificationId_ filters can only be used with Equals ('eq') operator. For _CreatedDate_ filter, the supported operators are Greater Than ('gt') and Greater Than or Equals ('ge'). When using both filters, combine them using the logical 'AND'. */
filter?: string;
}

Expand Down Expand Up @@ -584,7 +584,7 @@ export interface SupportTicketsListNextOptionalParams
extends coreClient.OperationOptions {
/** The number of values to return in the collection. Default is 25 and max is 100. */
top?: number;
/** The filter to apply on the operation. We support 'odata v4.0' filter semantics. [Learn more](https://docs.microsoft.com/odata/concepts/queryoptions-overview). _Status_ filter can only be used with Equals ('eq') operator. For _CreatedDate_ filter, the supported operators are Greater Than ('gt') and Greater Than or Equals ('ge'). When using both filters, combine them using the logical 'AND'. */
/** The filter to apply on the operation. We support 'odata v4.0' filter semantics. [Learn more](https://docs.microsoft.com/odata/concepts/queryoptions-overview). _Status_, _ServiceId_, and _ProblemClassificationId_ filters can only be used with Equals ('eq') operator. For _CreatedDate_ filter, the supported operators are Greater Than ('gt') and Greater Than or Equals ('ge'). When using both filters, combine them using the logical 'AND'. */
filter?: string;
}

Expand Down
16 changes: 8 additions & 8 deletions sdk/support/arm-support/src/operations/supportTickets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ export class SupportTicketsImpl implements SupportTickets {

/**
* Lists all the support tickets for an Azure subscription. You can also filter the support tickets by
* _Status_ or _CreatedDate_ using the $filter parameter. Output will be a paged result with
* _nextLink_, using which you can retrieve the next set of support tickets. <br/><br/>Support ticket
* data is available for 18 months after ticket creation. If a ticket was created more than 18 months
* ago, a request for data might cause an error.
* _Status_, _CreatedDate_, _ServiceId_, and _ProblemClassificationId_ using the $filter parameter.
* Output will be a paged result with _nextLink_, using which you can retrieve the next set of support
* tickets. <br/><br/>Support ticket data is available for 18 months after ticket creation. If a ticket
* was created more than 18 months ago, a request for data might cause an error.
* @param options The options parameters.
*/
public list(
Expand Down Expand Up @@ -109,10 +109,10 @@ export class SupportTicketsImpl implements SupportTickets {

/**
* Lists all the support tickets for an Azure subscription. You can also filter the support tickets by
* _Status_ or _CreatedDate_ using the $filter parameter. Output will be a paged result with
* _nextLink_, using which you can retrieve the next set of support tickets. <br/><br/>Support ticket
* data is available for 18 months after ticket creation. If a ticket was created more than 18 months
* ago, a request for data might cause an error.
* _Status_, _CreatedDate_, _ServiceId_, and _ProblemClassificationId_ using the $filter parameter.
* Output will be a paged result with _nextLink_, using which you can retrieve the next set of support
* tickets. <br/><br/>Support ticket data is available for 18 months after ticket creation. If a ticket
* was created more than 18 months ago, a request for data might cause an error.
* @param options The options parameters.
*/
private _list(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import {
export interface SupportTickets {
/**
* Lists all the support tickets for an Azure subscription. You can also filter the support tickets by
* _Status_ or _CreatedDate_ using the $filter parameter. Output will be a paged result with
* _nextLink_, using which you can retrieve the next set of support tickets. <br/><br/>Support ticket
* data is available for 18 months after ticket creation. If a ticket was created more than 18 months
* ago, a request for data might cause an error.
* _Status_, _CreatedDate_, _ServiceId_, and _ProblemClassificationId_ using the $filter parameter.
* Output will be a paged result with _nextLink_, using which you can retrieve the next set of support
* tickets. <br/><br/>Support ticket data is available for 18 months after ticket creation. If a ticket
* was created more than 18 months ago, a request for data might cause an error.
* @param options The options parameters.
*/
list(
Expand Down
39 changes: 17 additions & 22 deletions sdk/support/arm-support/test/sampleTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,30 @@
*/

import {
env,
record,
RecorderEnvironmentSetup,
Recorder
Recorder,
RecorderStartOptions,
env
} from "@azure-tools/test-recorder";
import * as assert from "assert";
import { assert } from "chai";
import { Context } from "mocha";

const recorderEnvSetup: RecorderEnvironmentSetup = {
replaceableVariables: {
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"
},
customizationsOnRecordings: [
(recording: any): any =>
recording.replace(
/"access_token":"[^"]*"/g,
`"access_token":"access_token"`
)
],
queryParametersToSkip: []
const replaceableVariables: Record<string, string> = {
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() {
recorder = record(this, recorderEnvSetup);
beforeEach(async function(this: Context) {
recorder = new Recorder(this.currentTest);
await recorder.start(recorderOptions);
});

afterEach(async function() {
Expand Down
10 changes: 2 additions & 8 deletions sdk/support/arm-support/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@
],
"declaration": true,
"outDir": "./dist-esm",
"importHelpers": true,
"paths": {
"@azure/arm-support": [
"./src/index"
]
}
"importHelpers": true
},
"include": [
"./src/**/*.ts",
"./test/**/*.ts",
"samples-dev/**/*.ts"
"./test/**/*.ts"
],
"exclude": [
"node_modules"
Expand Down