Skip to content

Commit 3f1ee62

Browse files
authored
[containerservice] Migrate containerservice projects to use snippets extraction (Azure#32695)
### Packages impacted by this PR - @azure/arm-containerservice - @azure/arm-containerservicefleet - @azure-rest/arm-containerservice ### Issues associated with this PR - Azure#32416 ### Describe the problem that is addressed by this PR Updates all projects under `astro` to use snippets extraction. ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? ### Are there test cases added in this PR? _(If not, why?)_ ### Provide a list of related PRs _(if any)_ ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [ ] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary)
1 parent aef47d2 commit 3f1ee62

File tree

300 files changed

+1169
-1805
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

300 files changed

+1169
-1805
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 9 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/containerservice/arm-containerservice-rest/README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,29 +50,29 @@ The following section shows you how to initialize and authenticate your client,
5050

5151
### List All Managed Clusters
5252

53-
```typescript
54-
import ContainerServiceManagementClient, { paginate } from "@azure-rest/arm-containerservice";
53+
```ts snippet:SampleReadmeListManagedClusters
5554
import { DefaultAzureCredential } from "@azure/identity";
55+
import ContainerServiceClient, { isUnexpected, paginate } from "@azure-rest/arm-containerservice";
5656

57-
async function listManagedClusters() {
58-
const subscriptionId = process.env.SUBSCRIPTION_ID as string;
59-
const credential = new DefaultAzureCredential();
60-
const client = ContainerServiceManagementClient(credential);
61-
const initialResponse = await client
62-
.path(
63-
"/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters",
64-
subscriptionId,
65-
)
66-
.get();
67-
const result = paginate(client, initialResponse);
68-
const resArray = new Array();
69-
for await (let item of result) {
70-
resArray.push(item);
71-
}
72-
console.log(resArray);
57+
const subscriptionId = "00000000-0000-0000-0000-000000000000";
58+
const credential = new DefaultAzureCredential();
59+
const client = ContainerServiceClient(credential);
60+
61+
const initialResponse = await client
62+
.path(
63+
"/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters",
64+
subscriptionId,
65+
)
66+
.get();
67+
68+
if (isUnexpected(initialResponse)) {
69+
throw initialResponse;
7370
}
7471

75-
listManagedClusters().catch(console.error);
72+
const result = paginate(client, initialResponse);
73+
for await (const item of result) {
74+
console.log(`Managed Cluster: ${item.name}`);
75+
}
7676
```
7777

7878
## Troubleshooting
@@ -81,7 +81,7 @@ listManagedClusters().catch(console.error);
8181

8282
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
8383

84-
```javascript
84+
```ts snippet:SetLogLevel
8585
import { setLogLevel } from "@azure/logger";
8686

8787
setLogLevel("info");

sdk/containerservice/arm-containerservice-rest/package.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
"files": [
2525
"dist/",
2626
"README.md",
27-
"LICENSE",
28-
"review/*",
29-
"CHANGELOG.md"
27+
"LICENSE"
3028
],
3129
"//metadata": {
3230
"constantPaths": [
@@ -64,33 +62,33 @@
6462
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
6563
"unit-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
6664
"unit-test:node": "dev-tool run test:vitest",
67-
"update-snippets": "echo skipped"
65+
"update-snippets": "dev-tool run update-snippets"
6866
},
6967
"sideEffects": false,
7068
"autoPublish": false,
7169
"dependencies": {
7270
"@azure-rest/core-client": "^1.0.0",
7371
"@azure/abort-controller": "^2.1.2",
74-
"@azure/core-auth": "^1.3.0",
72+
"@azure/core-auth": "^1.9.0",
7573
"@azure/core-lro": "^3.1.0",
76-
"@azure/core-rest-pipeline": "^1.8.0",
77-
"@azure/logger": "^1.0.0",
78-
"tslib": "^2.2.0"
74+
"@azure/core-rest-pipeline": "^1.18.2",
75+
"@azure/logger": "^1.1.4",
76+
"tslib": "^2.8.1"
7977
},
8078
"devDependencies": {
8179
"@azure-tools/test-credential": "^2.0.0",
8280
"@azure-tools/test-recorder": "^4.1.0",
8381
"@azure-tools/test-utils-vitest": "^1.0.0",
8482
"@azure/dev-tool": "^1.0.0",
8583
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
86-
"@azure/identity": "^4.0.1",
84+
"@azure/identity": "^4.6.0",
8785
"@types/node": "^18.0.0",
8886
"@vitest/browser": "^3.0.3",
8987
"@vitest/coverage-istanbul": "^3.0.3",
9088
"autorest": "latest",
9189
"dotenv": "^16.0.0",
9290
"eslint": "^9.9.0",
93-
"playwright": "^1.49.1",
91+
"playwright": "^1.50.0",
9492
"typescript": "~5.7.2",
9593
"vitest": "^3.0.3"
9694
},

0 commit comments

Comments
 (0)