Skip to content
Merged
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
42 changes: 21 additions & 21 deletions packages/@azure/arm-visualstudio/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -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.
154 changes: 77 additions & 77 deletions packages/@azure/arm-visualstudio/README.md
Original file line number Diff line number Diff line change
@@ -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
<!DOCTYPE html>
<html lang="en">
<head>
<title>@azure/arm-visualstudio sample</title>
<script src="node_modules/ms-rest-js/dist/msRest.browser.js"></script>
<script src="node_modules/ms-rest-azure-js/dist/msRestAzure.js"></script>
<script src="node_modules/ms-rest-browserauth/dist/msAuth.js"></script>
<script src="node_modules/@azure/arm-visualstudio/dist/arm-visualstudio.js"></script>
<script>
const subscriptionId = "<Subscription_Id>";
const authManager = new msAuth.AuthManager({
clientId: "<client id for your Azure AD app>",
tenant: "<optional tenant for your organization>"
});
authManager.finalizeLogin().then((res) => {
if (!res.isLoggedIn) {
// may cause redirects
authManager.login();
}
const client = new Azure.ArmVisualstudio.VisualStudioResourceProviderClient(res.creds, subscriptionId);
client.operations.list().then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log('An error occurred:');
console.error(err);
});
});
</script>
</head>
<body>
</body>
</html>
```

# 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
<!DOCTYPE html>
<html lang="en">
<head>
<title>@azure/arm-visualstudio sample</title>
<script src="node_modules/ms-rest-js/dist/msRest.browser.js"></script>
<script src="node_modules/ms-rest-azure-js/dist/msRestAzure.js"></script>
<script src="node_modules/ms-rest-browserauth/dist/msAuth.js"></script>
<script src="node_modules/@azure/arm-visualstudio/dist/arm-visualstudio.js"></script>
<script>
const subscriptionId = "<Subscription_Id>";
const authManager = new msAuth.AuthManager({
clientId: "<client id for your Azure AD app>",
tenant: "<optional tenant for your organization>"
});
authManager.finalizeLogin().then((res) => {
if (!res.isLoggedIn) {
// may cause redirects
authManager.login();
}
const client = new Azure.ArmVisualstudio.VisualStudioResourceProviderClient(res.creds, subscriptionId);
client.operations.list().then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log("An error occurred:");
console.error(err);
});
});
</script>
</head>
<body>
</body>
</html>
```
# Related projects
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export {
Resource,
BaseResource,
AccountResourceRequest,
AccountTagRequest,
ExtensionResource,
ExtensionResourcePlan,
ProjectResource
Expand Down
33 changes: 33 additions & 0 deletions packages/@azure/arm-visualstudio/lib/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
*/
Expand Down
21 changes: 21 additions & 0 deletions packages/@azure/arm-visualstudio/lib/models/mappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
70 changes: 70 additions & 0 deletions packages/@azure/arm-visualstudio/lib/operations/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,43 @@ export class Accounts {
getOperationSpec,
callback) as Promise<Models.AccountsGetResponse>;
}

/**
* 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<Models.AccountsUpdateResponse>
*/
update(resourceGroupName: string, body: Models.AccountTagRequest, resourceName: string, options?: msRest.RequestOptionsBase): Promise<Models.AccountsUpdateResponse>;
/**
* @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<Models.AccountResource>): 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<Models.AccountResource>): void;
update(resourceGroupName: string, body: Models.AccountTagRequest, resourceName: string, options?: msRest.RequestOptionsBase, callback?: msRest.ServiceCallback<Models.AccountResource>): Promise<Models.AccountsUpdateResponse> {
return this.client.sendOperationRequest(
{
resourceGroupName,
body,
resourceName,
options
},
updateOperationSpec,
callback) as Promise<Models.AccountsUpdateResponse>;
}
}

// Operation Specifications
Expand Down Expand Up @@ -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
};
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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';
Expand All @@ -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;
}
Expand Down
Loading