Skip to content

Commit 4c5b90b

Browse files
colawwjMaryGao
andauthored
servicelinker-track2-release (Azure#21888)
* servicelinker-track2-release * update * Update README.md No change required in readme.md Co-authored-by: Mary Gao <yanmeigao1210@gmail.com>
1 parent d292c80 commit 4c5b90b

32 files changed

+1026
-30
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Release History
22

3+
## 2.0.0 (2022-05-16)
4+
5+
**Features**
6+
7+
- Added Interface ValidateOperationResult
8+
- Enum KnownValidationResultStatus has a new value Failure
9+
10+
**Breaking Changes**
11+
12+
- Enum KnownValidationResultStatus no longer has value Failed
13+
14+
315
## 1.0.0 (2022-04-27)
416

517
The package of @azure/arm-servicelinker is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart).
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"commit": "af53c06807f579062e88531c0b292ac5414af0dd",
2+
"commit": "3f456dba8358994af8251bfae2f911a127092e54",
33
"readme": "specification/servicelinker/resource-manager/readme.md",
44
"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\\servicelinker\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.1 --generate-sample=true",
55
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
6-
"release_tool": "@azure-tools/js-sdk-release-tools@2.2.6",
6+
"release_tool": "@azure-tools/js-sdk-release-tools@2.3.0",
77
"use": "@autorest/typescript@6.0.0-alpha.19.20220408.1"
88
}

sdk/servicelinker/arm-servicelinker/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"sdk-type": "mgmt",
44
"author": "Microsoft Corporation",
55
"description": "A generated SDK for ServiceLinkerManagementClient.",
6-
"version": "1.0.0",
6+
"version": "2.0.0",
77
"engines": {
88
"node": ">=12.0.0"
99
},
@@ -28,7 +28,7 @@
2828
"module": "./dist-esm/src/index.js",
2929
"types": "./types/arm-servicelinker.d.ts",
3030
"devDependencies": {
31-
"@microsoft/api-extractor": "^7.18.11",
31+
"@microsoft/api-extractor": "7.18.11",
3232
"@rollup/plugin-commonjs": "^21.0.1",
3333
"@rollup/plugin-json": "^4.1.0",
3434
"@rollup/plugin-multi-entry": "^4.1.0",
@@ -115,4 +115,4 @@
115115
"disableDocsMs": true,
116116
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-servicelinker?view=azure-node-preview"
117117
}
118-
}
118+
}

sdk/servicelinker/arm-servicelinker/review/arm-servicelinker.api.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export enum KnownTargetServiceType {
194194
// @public
195195
export enum KnownValidationResultStatus {
196196
// (undocumented)
197-
Failed = "failed",
197+
Failure = "failure",
198198
// (undocumented)
199199
Success = "success",
200200
// (undocumented)
@@ -312,7 +312,7 @@ export interface LinkerValidateOptionalParams extends coreClient.OperationOption
312312
}
313313

314314
// @public
315-
export type LinkerValidateResponse = ValidateResult;
315+
export type LinkerValidateResponse = ValidateOperationResult;
316316

317317
// @public
318318
export interface Operation {
@@ -473,13 +473,15 @@ export type UserAssignedIdentityAuthInfo = AuthInfoBase & {
473473
};
474474

475475
// @public
476-
export interface ValidateResult {
476+
export interface ValidateOperationResult {
477477
authType?: AuthType;
478478
isConnectionAvailable?: boolean;
479479
linkerName?: string;
480480
reportEndTimeUtc?: Date;
481481
reportStartTimeUtc?: Date;
482+
resourceId?: string;
482483
sourceId?: string;
484+
status?: string;
483485
targetId?: string;
484486
validationDetail?: ValidationResultItem[];
485487
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# client library samples for JavaScript
2+
3+
These sample programs show how to use the JavaScript client libraries for in some common scenarios.
4+
5+
| **File Name** | **Description** |
6+
| ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
7+
| [linkerCreateOrUpdateSample.js][linkercreateorupdatesample] | Create or update linker resource. x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/PutLink.json |
8+
| [linkerDeleteSample.js][linkerdeletesample] | Delete a link. x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/DeleteLink.json |
9+
| [linkerGetSample.js][linkergetsample] | Returns Linker resource for a given name. x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/Link.json |
10+
| [linkerListConfigurationsSample.js][linkerlistconfigurationssample] | list source configurations for a linker. x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/GetConfigurations.json |
11+
| [linkerListSample.js][linkerlistsample] | Returns list of Linkers which connects to the resource. x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/LinkList.json |
12+
| [linkerUpdateSample.js][linkerupdatesample] | Operation to update an existing link. x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/PatchLink.json |
13+
| [linkerValidateSample.js][linkervalidatesample] | Validate a link. x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/ValidateLinkSuccess.json |
14+
| [operationsListSample.js][operationslistsample] | Lists the available ServiceLinker REST API operations. x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/OperationsList.json |
15+
16+
## Prerequisites
17+
18+
The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/).
19+
20+
You need [an Azure subscription][freesub] to run these sample programs.
21+
22+
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
23+
24+
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
25+
26+
## Setup
27+
28+
To run the samples using the published version of the package:
29+
30+
1. Install the dependencies using `npm`:
31+
32+
```bash
33+
npm install
34+
```
35+
36+
2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
37+
38+
3. Run whichever samples you like (note that some samples may require additional setup, see the table above):
39+
40+
```bash
41+
node linkerCreateOrUpdateSample.js
42+
```
43+
44+
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
45+
46+
```bash
47+
npx cross-env node linkerCreateOrUpdateSample.js
48+
```
49+
50+
## Next Steps
51+
52+
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
53+
54+
[linkercreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/servicelinker/arm-servicelinker/samples/v2/javascript/linkerCreateOrUpdateSample.js
55+
[linkerdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/servicelinker/arm-servicelinker/samples/v2/javascript/linkerDeleteSample.js
56+
[linkergetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/servicelinker/arm-servicelinker/samples/v2/javascript/linkerGetSample.js
57+
[linkerlistconfigurationssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/servicelinker/arm-servicelinker/samples/v2/javascript/linkerListConfigurationsSample.js
58+
[linkerlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/servicelinker/arm-servicelinker/samples/v2/javascript/linkerListSample.js
59+
[linkerupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/servicelinker/arm-servicelinker/samples/v2/javascript/linkerUpdateSample.js
60+
[linkervalidatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/servicelinker/arm-servicelinker/samples/v2/javascript/linkerValidateSample.js
61+
[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/servicelinker/arm-servicelinker/samples/v2/javascript/operationsListSample.js
62+
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-servicelinker?view=azure-node-preview
63+
[freesub]: https://azure.microsoft.com/free/
64+
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/servicelinker/arm-servicelinker/README.md
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation.
3+
* Licensed under the MIT License.
4+
*
5+
* Code generated by Microsoft (R) AutoRest Code Generator.
6+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
*/
8+
9+
// Copyright (c) Microsoft Corporation.
10+
// Licensed under the MIT License.
11+
const { ServiceLinkerManagementClient } = require("@azure/arm-servicelinker");
12+
const { DefaultAzureCredential } = require("@azure/identity");
13+
14+
/**
15+
* This sample demonstrates how to Create or update linker resource.
16+
*
17+
* @summary Create or update linker resource.
18+
* x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/PutLink.json
19+
*/
20+
async function putLink() {
21+
const resourceUri =
22+
"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app";
23+
const linkerName = "linkName";
24+
const parameters = {
25+
authInfo: {
26+
name: "name",
27+
authType: "secret",
28+
secretInfo: { secretType: "rawValue", value: "secret" },
29+
},
30+
targetService: {
31+
type: "AzureResource",
32+
id: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DBforPostgreSQL/servers/test-pg/databases/test-db",
33+
},
34+
};
35+
const credential = new DefaultAzureCredential();
36+
const client = new ServiceLinkerManagementClient(credential);
37+
const result = await client.linker.beginCreateOrUpdateAndWait(
38+
resourceUri,
39+
linkerName,
40+
parameters
41+
);
42+
console.log(result);
43+
}
44+
45+
putLink().catch(console.error);
46+
47+
/**
48+
* This sample demonstrates how to Create or update linker resource.
49+
*
50+
* @summary Create or update linker resource.
51+
* x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/PutLinkWithSecretStore.json
52+
*/
53+
async function putLinkWithSecretStore() {
54+
const resourceUri =
55+
"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app";
56+
const linkerName = "linkName";
57+
const parameters = {
58+
authInfo: { authType: "secret" },
59+
secretStore: {
60+
keyVaultId:
61+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.KeyVault/vaults/test-kv",
62+
},
63+
targetService: {
64+
type: "AzureResource",
65+
id: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db",
66+
},
67+
};
68+
const credential = new DefaultAzureCredential();
69+
const client = new ServiceLinkerManagementClient(credential);
70+
const result = await client.linker.beginCreateOrUpdateAndWait(
71+
resourceUri,
72+
linkerName,
73+
parameters
74+
);
75+
console.log(result);
76+
}
77+
78+
putLinkWithSecretStore().catch(console.error);
79+
80+
/**
81+
* This sample demonstrates how to Create or update linker resource.
82+
*
83+
* @summary Create or update linker resource.
84+
* x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/PutLinkWithServiceEndpoint.json
85+
*/
86+
async function putLinkWithServiceEndpoint() {
87+
const resourceUri =
88+
"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app";
89+
const linkerName = "linkName";
90+
const parameters = {
91+
authInfo: {
92+
name: "name",
93+
authType: "secret",
94+
secretInfo: {
95+
secretType: "keyVaultSecretUri",
96+
value:
97+
"https://vault-name.vault.azure.net/secrets/secret-name/00000000000000000000000000000000",
98+
},
99+
},
100+
targetService: {
101+
type: "AzureResource",
102+
id: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DBforPostgreSQL/servers/test-pg/databases/test-db",
103+
},
104+
vNetSolution: { type: "serviceEndpoint" },
105+
};
106+
const credential = new DefaultAzureCredential();
107+
const client = new ServiceLinkerManagementClient(credential);
108+
const result = await client.linker.beginCreateOrUpdateAndWait(
109+
resourceUri,
110+
linkerName,
111+
parameters
112+
);
113+
console.log(result);
114+
}
115+
116+
putLinkWithServiceEndpoint().catch(console.error);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation.
3+
* Licensed under the MIT License.
4+
*
5+
* Code generated by Microsoft (R) AutoRest Code Generator.
6+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
*/
8+
9+
// Copyright (c) Microsoft Corporation.
10+
// Licensed under the MIT License.
11+
const { ServiceLinkerManagementClient } = require("@azure/arm-servicelinker");
12+
const { DefaultAzureCredential } = require("@azure/identity");
13+
14+
/**
15+
* This sample demonstrates how to Delete a link.
16+
*
17+
* @summary Delete a link.
18+
* x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/DeleteLink.json
19+
*/
20+
async function deleteLink() {
21+
const resourceUri =
22+
"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app";
23+
const linkerName = "linkName";
24+
const credential = new DefaultAzureCredential();
25+
const client = new ServiceLinkerManagementClient(credential);
26+
const result = await client.linker.beginDeleteAndWait(resourceUri, linkerName);
27+
console.log(result);
28+
}
29+
30+
deleteLink().catch(console.error);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation.
3+
* Licensed under the MIT License.
4+
*
5+
* Code generated by Microsoft (R) AutoRest Code Generator.
6+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
*/
8+
9+
// Copyright (c) Microsoft Corporation.
10+
// Licensed under the MIT License.
11+
const { ServiceLinkerManagementClient } = require("@azure/arm-servicelinker");
12+
const { DefaultAzureCredential } = require("@azure/identity");
13+
14+
/**
15+
* This sample demonstrates how to Returns Linker resource for a given name.
16+
*
17+
* @summary Returns Linker resource for a given name.
18+
* x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/Link.json
19+
*/
20+
async function link() {
21+
const resourceUri =
22+
"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app";
23+
const linkerName = "linkName";
24+
const credential = new DefaultAzureCredential();
25+
const client = new ServiceLinkerManagementClient(credential);
26+
const result = await client.linker.get(resourceUri, linkerName);
27+
console.log(result);
28+
}
29+
30+
link().catch(console.error);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation.
3+
* Licensed under the MIT License.
4+
*
5+
* Code generated by Microsoft (R) AutoRest Code Generator.
6+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
*/
8+
9+
// Copyright (c) Microsoft Corporation.
10+
// Licensed under the MIT License.
11+
const { ServiceLinkerManagementClient } = require("@azure/arm-servicelinker");
12+
const { DefaultAzureCredential } = require("@azure/identity");
13+
14+
/**
15+
* This sample demonstrates how to list source configurations for a linker.
16+
*
17+
* @summary list source configurations for a linker.
18+
* x-ms-original-file: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/GetConfigurations.json
19+
*/
20+
async function getConfiguration() {
21+
const resourceUri =
22+
"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app";
23+
const linkerName = "linkName";
24+
const credential = new DefaultAzureCredential();
25+
const client = new ServiceLinkerManagementClient(credential);
26+
const result = await client.linker.listConfigurations(resourceUri, linkerName);
27+
console.log(result);
28+
}
29+
30+
getConfiguration().catch(console.error);

0 commit comments

Comments
 (0)