Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iothub] Migrate iothub projects to use snippets extraction #32944

Merged
merged 25 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c3fa1a9
Migration: Update package.json, tsconfig.json, and api-extractor.json
mpodwysocki Feb 10, 2025
e1ed981
Migration: Update test config
mpodwysocki Feb 10, 2025
e4bc768
Migration: Clean up files
mpodwysocki Feb 10, 2025
5a5486b
Migration: Apply codemod: "fixSourceFile"
mpodwysocki Feb 10, 2025
101997d
Migration: Apply codemod: "fixTestingImports"
mpodwysocki Feb 10, 2025
7858a36
Migration: Apply codemod: "replaceAssertIsRejected"
mpodwysocki Feb 10, 2025
ceff3e6
Migration: Apply codemod: "replaceSinonStub"
mpodwysocki Feb 10, 2025
d1347aa
Migration: Apply codemod: "addViHelper"
mpodwysocki Feb 10, 2025
8393087
Migration: Apply codemod: "replaceSupportTracing"
mpodwysocki Feb 10, 2025
50534b6
Migration: Apply codemod: "replaceTestUtils"
mpodwysocki Feb 10, 2025
ea1a9ef
Migration: npm run format
mpodwysocki Feb 10, 2025
98f3470
Migration: Update package.json, tsconfig.json, and api-extractor.json
mpodwysocki Feb 10, 2025
d2a3af3
Migration: Update test config
mpodwysocki Feb 10, 2025
33bcf6a
Migration: Clean up files
mpodwysocki Feb 10, 2025
908ba62
Migration: Apply codemod: "fixSourceFile"
mpodwysocki Feb 10, 2025
76b6ee9
Migration: Apply codemod: "fixTestingImports"
mpodwysocki Feb 10, 2025
ef44740
Migration: Apply codemod: "replaceAssertIsRejected"
mpodwysocki Feb 10, 2025
efdd3bd
Migration: Apply codemod: "replaceSinonStub"
mpodwysocki Feb 10, 2025
8bcbc45
Migration: Apply codemod: "addViHelper"
mpodwysocki Feb 10, 2025
8e789e3
Migration: Apply codemod: "replaceSupportTracing"
mpodwysocki Feb 10, 2025
d2e6591
Migration: Apply codemod: "replaceTestUtils"
mpodwysocki Feb 10, 2025
f933d55
Migration: npm run format
mpodwysocki Feb 10, 2025
4334eb0
[iothub] Migrate iothub projects to use snippets extraction
mpodwysocki Feb 10, 2025
20bc8e2
[iothub] Migrate iothub projects to use snippets extraction
mpodwysocki Feb 11, 2025
d2e10d1
[iothub] Migrate iothub projects to use snippets extraction
mpodwysocki Feb 11, 2025
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
123 changes: 57 additions & 66 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 21 additions & 14 deletions sdk/iothub/arm-iothub-profile-2020-09-01-hybrid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,28 @@ Set the values of the client ID, tenant ID, and client secret of the AAD applica

For more information about how to create an Azure AD Application check out [this guide](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal).

```javascript
const { IotHubClient } = require("@azure/arm-iothub-profile-2020-09-01-hybrid");
const { DefaultAzureCredential } = require("@azure/identity");
// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details.
Using Node.js and Node-like environments, you can use the `DefaultAzureCredential` class to authenticate the client.

```ts snippet:ReadmeSampleCreateClient_Node
import { IotHubClient } from "@azure/arm-iothub-profile-2020-09-01-hybrid";
import { DefaultAzureCredential } from "@azure/identity";

const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new IotHubClient(new DefaultAzureCredential(), subscriptionId);
```

For browser environments, use the `InteractiveBrowserCredential` from the `@azure/identity` package to authenticate.

```ts snippet:ReadmeSampleCreateClient_Browser
import { InteractiveBrowserCredential } from "@azure/identity";
import { IotHubClient } from "@azure/arm-iothub-profile-2020-09-01-hybrid";

// For client-side applications running in the browser, use this code instead:
// const credential = new InteractiveBrowserCredential({
// tenantId: "<YOUR_TENANT_ID>",
// clientId: "<YOUR_CLIENT_ID>"
// });
// const client = new IotHubClient(credential, subscriptionId);
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const credential = new InteractiveBrowserCredential({
tenantId: "<YOUR_TENANT_ID>",
clientId: "<YOUR_CLIENT_ID>",
});
const client = new IotHubClient(credential, subscriptionId);
```

### JavaScript Bundle
Expand All @@ -80,8 +88,9 @@ To use this client library in the browser, first you need to use a bundler. For

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`:

```javascript
const { setLogLevel } = require("@azure/logger");
```ts snippet:SetLogLevel
import { setLogLevel } from "@azure/logger";

setLogLevel("info");
```

Expand All @@ -99,8 +108,6 @@ If you'd like to contribute to this library, please read the [contributing guide

- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)



[azure_cli]: https://learn.microsoft.com/cli/azure
[azure_sub]: https://azure.microsoft.com/free/
[azure_sub]: https://azure.microsoft.com/free/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
"release_tool": "@azure-tools/[email protected]",
"use": "@autorest/[email protected]"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "./dist-esm/src/index.d.ts",
"mainEntryPointFilePath": "dist/esm/index.d.ts",
"docModel": {
"enabled": true
},
Expand All @@ -11,7 +11,7 @@
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "",
"publicTrimmedFilePath": "./types/arm-iothub-profile-2020-09-01-hybrid.d.ts"
"publicTrimmedFilePath": "dist/arm-iothub-profile-2020-09-01-hybrid.d.ts"
},
"messages": {
"tsdocMessageReporting": {
Expand All @@ -28,4 +28,4 @@
}
}
}
}
}
Loading
Loading