diff --git a/packages/@azure/arm-visualstudio/LICENSE.txt b/packages/@azure/arm-visualstudio/LICENSE.txt index a70e8cf66038..5431ba98b936 100644 --- a/packages/@azure/arm-visualstudio/LICENSE.txt +++ b/packages/@azure/arm-visualstudio/LICENSE.txt @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2018 Microsoft - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +The MIT License (MIT) + +Copyright (c) 2018 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/@azure/arm-visualstudio/README.md b/packages/@azure/arm-visualstudio/README.md index f529f6a8c7db..ffe569863e7e 100644 --- a/packages/@azure/arm-visualstudio/README.md +++ b/packages/@azure/arm-visualstudio/README.md @@ -1,77 +1,77 @@ -# Azure VisualStudioResourceProviderClient SDK for JavaScript -This package contains an isomorphic SDK for VisualStudioResourceProviderClient. - -## Currently supported environments -- Node.js version 6.x.x or higher -- Browser JavaScript - -## How to Install -``` -npm install @azure/arm-visualstudio -``` - - -## How to use - -### nodejs - Authentication, client creation and list operations as an example written in TypeScript. - -```ts -import * as msRest from "ms-rest-js"; -import * as msRestAzure from "ms-rest-azure-js"; -import * as msRestNodeAuth from "ms-rest-nodeauth"; -import { VisualStudioResourceProviderClient, VisualStudioResourceProviderModels, VisualStudioResourceProviderMappers } from "@azure/arm-visualstudio"; -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -msRestNodeAuth.interactiveLogin().then((creds) => { - const client = new VisualStudioResourceProviderClient(creds, subscriptionId); - client.operations.list().then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); -}); -``` - -### browser - Authentication, client creation and list operations as an example written in JavaScript. -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. - -- index.html -```html - - - - @azure/arm-visualstudio sample - - - - - - - - - -``` - -# Related projects - - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +# Azure VisualStudioResourceProviderClient SDK for JavaScript +This package contains an isomorphic SDK for VisualStudioResourceProviderClient. + +## Currently supported environments +- Node.js version 6.x.x or higher +- Browser JavaScript + +## How to Install +``` +npm install @azure/arm-visualstudio +``` + + +## How to use + +### nodejs - Authentication, client creation and list operations as an example written in TypeScript. + +```ts +import * as msRest from "ms-rest-js"; +import * as msRestAzure from "ms-rest-azure-js"; +import * as msRestNodeAuth from "ms-rest-nodeauth"; +import { VisualStudioResourceProviderClient, VisualStudioResourceProviderModels, VisualStudioResourceProviderMappers } from "@azure/arm-visualstudio"; +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +msRestNodeAuth.interactiveLogin().then((creds) => { + const client = new VisualStudioResourceProviderClient(creds, subscriptionId); + client.operations.list().then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.error(err); +}); +``` + +### browser - Authentication, client creation and list operations as an example written in JavaScript. +See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. + +- index.html +```html + + + + @azure/arm-visualstudio sample + + + + + + + + + +``` + +# Related projects + - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) diff --git a/packages/@azure/arm-visualstudio/lib/models/accountsMappers.ts b/packages/@azure/arm-visualstudio/lib/models/accountsMappers.ts index 629369bfca41..5393c150241e 100644 --- a/packages/@azure/arm-visualstudio/lib/models/accountsMappers.ts +++ b/packages/@azure/arm-visualstudio/lib/models/accountsMappers.ts @@ -17,6 +17,7 @@ export { Resource, BaseResource, AccountResourceRequest, + AccountTagRequest, ExtensionResource, ExtensionResourcePlan, ProjectResource diff --git a/packages/@azure/arm-visualstudio/lib/models/index.ts b/packages/@azure/arm-visualstudio/lib/models/index.ts index fc70d5bc6ea2..b2bcfadfba96 100644 --- a/packages/@azure/arm-visualstudio/lib/models/index.ts +++ b/packages/@azure/arm-visualstudio/lib/models/index.ts @@ -78,6 +78,20 @@ export interface AccountResourceListResult { value?: AccountResource[]; } +/** + * @interface + * An interface representing AccountTagRequest. + * The body of a Patch request to add tags to a Visual Studio account resource. + * + */ +export interface AccountTagRequest { + /** + * @member {{ [propertyName: string]: string }} [tags] The custom tags of the + * resource. + */ + tags?: { [propertyName: string]: string }; +} + /** * @interface * An interface representing AccountResourceRequest. @@ -477,6 +491,25 @@ export type AccountsGetResponse = AccountResource & { }; }; +/** + * Contains response data for the update operation. + */ +export type AccountsUpdateResponse = AccountResource & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: AccountResource; + }; +}; + /** * Contains response data for the listByAccount operation. */ diff --git a/packages/@azure/arm-visualstudio/lib/models/mappers.ts b/packages/@azure/arm-visualstudio/lib/models/mappers.ts index 9ad99f3a2d87..3c2f97df8d73 100644 --- a/packages/@azure/arm-visualstudio/lib/models/mappers.ts +++ b/packages/@azure/arm-visualstudio/lib/models/mappers.ts @@ -106,6 +106,27 @@ export const AccountResourceListResult: msRest.CompositeMapper = { } }; +export const AccountTagRequest: msRest.CompositeMapper = { + serializedName: "AccountTagRequest", + type: { + name: "Composite", + className: "AccountTagRequest", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + } + } + } + } +}; + export const AccountResourceRequest: msRest.CompositeMapper = { serializedName: "AccountResourceRequest", type: { diff --git a/packages/@azure/arm-visualstudio/lib/operations/accounts.ts b/packages/@azure/arm-visualstudio/lib/operations/accounts.ts index d076c869e661..c4f1c9ec510a 100644 --- a/packages/@azure/arm-visualstudio/lib/operations/accounts.ts +++ b/packages/@azure/arm-visualstudio/lib/operations/accounts.ts @@ -188,6 +188,43 @@ export class Accounts { getOperationSpec, callback) as Promise; } + + /** + * Updates tags for Visual Studio Team Services account resource. + * @summary Accounts_Update + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param body The request data. + * @param resourceName Name of the resource. + * @param [options] The optional parameters + * @returns Promise + */ + update(resourceGroupName: string, body: Models.AccountTagRequest, resourceName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param body The request data. + * @param resourceName Name of the resource. + * @param callback The callback + */ + update(resourceGroupName: string, body: Models.AccountTagRequest, resourceName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param body The request data. + * @param resourceName Name of the resource. + * @param options The optional parameters + * @param callback The callback + */ + update(resourceGroupName: string, body: Models.AccountTagRequest, resourceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + update(resourceGroupName: string, body: Models.AccountTagRequest, resourceName: string, options?: msRest.RequestOptionsBase, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + body, + resourceName, + options + }, + updateOperationSpec, + callback) as Promise; + } } // Operation Specifications @@ -327,3 +364,36 @@ const getOperationSpec: msRest.OperationSpec = { }, serializer }; + +const updateOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.visualstudio/account/{resourceName}", + urlParameters: [ + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.resourceName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "body", + mapper: { + ...Mappers.AccountTagRequest, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.AccountResource + }, + 404: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/packages/@azure/arm-visualstudio/lib/visualStudioResourceProviderClientContext.ts b/packages/@azure/arm-visualstudio/lib/visualStudioResourceProviderClientContext.ts index 7710ef946d4e..11b58a1a7c64 100644 --- a/packages/@azure/arm-visualstudio/lib/visualStudioResourceProviderClientContext.ts +++ b/packages/@azure/arm-visualstudio/lib/visualStudioResourceProviderClientContext.ts @@ -16,16 +16,9 @@ const packageName = "@azure/arm-visualstudio"; const packageVersion = "1.0.0-preview"; export class VisualStudioResourceProviderClientContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials; - subscriptionId: string; - - apiVersion: string; - - acceptLanguage: string; - - longRunningOperationRetryTimeout: number; + apiVersion?: string; /** * Initializes a new instance of the VisualStudioResourceProviderClient class. @@ -44,6 +37,11 @@ export class VisualStudioResourceProviderClientContext extends msRestAzure.Azure if (!options) { options = {}; } + if(!options.userAgent) { + const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); + options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; + } + super(credentials, options); this.apiVersion = '2014-04-01-preview'; @@ -54,7 +52,6 @@ export class VisualStudioResourceProviderClientContext extends msRestAzure.Azure this.credentials = credentials; this.subscriptionId = subscriptionId; - this.addUserAgentInfo(`${packageName}/${packageVersion}`); if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { this.acceptLanguage = options.acceptLanguage; } diff --git a/packages/@azure/arm-visualstudio/package.json b/packages/@azure/arm-visualstudio/package.json index cb727f761bf9..db164c5fb0be 100644 --- a/packages/@azure/arm-visualstudio/package.json +++ b/packages/@azure/arm-visualstudio/package.json @@ -4,8 +4,8 @@ "description": "VisualStudioResourceProviderClient Library with typescript type definitions for node.js and browser.", "version": "1.0.0-preview", "dependencies": { - "ms-rest-azure-js": "^1.0.176", - "ms-rest-js": "^1.0.455", + "ms-rest-azure-js": "^1.0.181", + "ms-rest-js": "^1.0.457", "tslib": "^1.9.3" }, "keywords": [ @@ -33,10 +33,23 @@ "bugs": { "url": "https://github.com/azure/azure-sdk-for-js/issues" }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "esm/**/*.js", + "esm/**/*.js.map", + "esm/**/*.d.ts", + "esm/**/*.d.ts.map", + "lib/**/*.ts", + "rollup.config.js", + "tsconfig.json" + ], "scripts": { "build": "tsc && rollup -c rollup.config.js && npm run minify", "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-visualstudio.js.map'\" -o ./dist/arm-visualstudio.min.js ./dist/arm-visualstudio.js", - "prepare": "npm run build" + "prepack": "npm install && npm run build" }, "sideEffects": false }