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

[AutoPR @azure/arm-recoveryservices] Added new version in Microsoft.RecoveryServices #5008

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
d769b84
Change default branch name to main (#15840)
praveenkuttappan Jun 18, 2021
1d0b3dd
Fix hard-coded master (#15843)
azure-sdk Jun 18, 2021
ddf4714
[Communication]: Always use x-ms-date for Hmac (#15807)
JianpingChen Jun 18, 2021
c075155
Automatic rush update recheck (#15839)
azure-sdk Jun 18, 2021
bdff63d
[KeyVault] - Add networkAcls to MHSM ARM template (#15830)
maorleger Jun 18, 2021
d023204
[Core] - Move core-tracing to @opentelemetry/api 0.20.0 (#15672)
maorleger Jun 18, 2021
37d1df4
arm-support-identity (#15838)
colawwj Jun 21, 2021
4471210
[identity] Adding extensions API, identity-vscode, and identity-cache…
witemple-msft Jun 21, 2021
919e856
[AzureMonitorExporter] Adding support for temporary redirect (#15850)
hectorhdzg Jun 21, 2021
f9efdf4
Package artifact path (#15512)
praveenkuttappan Jun 21, 2021
d4d2c75
[service-bus] Closing some open areas where we could mask errors, and…
richardpark-msft Jun 21, 2021
5da2922
Sync eng/common directory with azure-sdk-tools for PR 1716 (#15876)
azure-sdk Jun 21, 2021
450f924
Sync eng/common directory with azure-sdk-tools for PR 1719 (#15885)
azure-sdk Jun 21, 2021
b26a218
Remove core-lro runtime dependency on core-http (#15884)
xirzec Jun 22, 2021
53d6089
[Identity] Comment improvements. Identity generally doesn't return nu…
sadasant Jun 22, 2021
8ab9b83
[Identity] README.md: Bigger title for Extensions and a markdown fix …
sadasant Jun 22, 2021
ac8d65c
[core] Update @azure/core-tracing to use @opentelemetry/api@1.0.0 (#1…
maorleger Jun 22, 2021
a64747c
Rename hardcoded master links to use main
chidozieononiwu Jun 22, 2021
bf5cd3e
[App Config] Add display_name to FeatureFlag (#15901)
HarshaNalluru Jun 22, 2021
0f4ae0c
[identity] Add publication metadata for extension pacakges (#15900)
witemple-msft Jun 22, 2021
c7f3a2a
Replace master with main in homepage links.
witemple-msft Jun 22, 2021
0eeb81a
[core] - added changelog entries for recent changes (#15902)
maorleger Jun 22, 2021
556da80
[ContainerRegistry] switch to use official TS code generator (#15777)
jeremymeng Jun 23, 2021
63bc1fd
Arm cosmosdb release (#15789)
colawwj Jun 23, 2021
b499bfb
[KeyVault] - Migrate Key Vault Admin package to Core V2 (#15881)
maorleger Jun 23, 2021
56c7442
Skip rush update when runnign using pull request (#15907)
praveenkuttappan Jun 23, 2021
5728f70
Move to @azure/msal-node-extensions 1.0.0-alpha.7 (#15908)
witemple-msft Jun 23, 2021
023db76
[Communication]Feature: add sender display name within send typing no…
LuChen-Microsoft Jun 23, 2021
a1f909d
Update ubuntu VM image (#15706)
chidozieononiwu Jun 23, 2021
6c59958
Default live test timeout to 60 minutes (#15926)
benbp Jun 23, 2021
137c671
Fix handling of typed arrays in request bodies (#15904)
xirzec Jun 23, 2021
65a90e5
[Tables] Migration Guide (#15857)
joheredi Jun 23, 2021
99d53b6
[core] - GA core-rest-pipeline 1.1.0 (#15923)
maorleger Jun 23, 2021
2d2c656
[Tables] Support AAD Authentication (#15852)
joheredi Jun 23, 2021
46078e3
Doc improvements for blob storage file upload content type 2 (#12938)
diberry Jun 24, 2021
58b1993
[service-bus] Fixing issue where links were not removed from our inte…
richardpark-msft Jun 24, 2021
bb833fc
arm-trafficmanager-release (#15695)
colawwj Jun 24, 2021
b77a2a4
arm-eventgrid-release (#15791)
colawwj Jun 24, 2021
93d102b
Bump up version for storage packages (#15849)
chidozieononiwu Jun 24, 2021
23bb270
[Core Rest] Add pagination helper for rest clients @azure-rest/core-c…
joheredi Jun 24, 2021
5f71ecd
Rename master to main
chidozieononiwu Jun 23, 2021
24302c8
[Azure Monitor Exporter] Updating OpenTelemetry API to 1.0.0 (#15934)
hectorhdzg Jun 24, 2021
1f6b914
[Tables] Add missing browser mappings (#15944)
joheredi Jun 24, 2021
d3c3f90
[Storage] Use ES2017 (#15835)
deyaaeldeen Jun 24, 2021
cbaa410
[Tables] Expose client option allowInsecureConnection (#15938)
joheredi Jun 24, 2021
3c21c59
Sync eng/common directory with azure-sdk-tools for PR 1729 (#15927)
azure-sdk Jun 24, 2021
5903b7c
[core] - Bump core-http to 2.0.0 and core-lro to 2.0.0 (#15925)
maorleger Jun 24, 2021
9b9a9d1
[Identity] Samples aligned with other languages (v1 compatible) (#15031)
sadasant Jun 24, 2021
aa8db15
Tweak workspace settings for VS Code startup perf (#15956)
xirzec Jun 24, 2021
4ff4cef
Add Ubuntu 20 to local dns bypass template (#15951)
azure-sdk Jun 24, 2021
8afa5cf
[MetricsAdvisor] Generated code and latest swagger (#15748)
KarishmaGhiya Jun 24, 2021
d9066a2
Attestation\README listing links as a list (#15914)
bashimoha Jun 24, 2021
c6b82ee
Update references from master to main (#15977)
azure-sdk Jun 25, 2021
35739ab
[App config] Perf tests (#15763)
HarshaNalluru Jun 25, 2021
bb9896d
[core-http] Throttling retry policy fix in core-http (#15832)
HarshaNalluru Jun 25, 2021
d76e6f6
arm-support-identity-ten (#15942)
colawwj Jun 25, 2021
2f90a87
[event-hubs] migrate samples to v2 (#15053)
chradek Jun 25, 2021
9440254
update signaling package version to beta7 (#16001)
LuChen-Microsoft Jun 25, 2021
ca61eb9
[ContainerRegistry] Update delete image sample (#16002)
jeremymeng Jun 25, 2021
4ccc8d9
[Identity] Test improvements (#15999)
sadasant Jun 25, 2021
63b6236
Add dev dependencies for App Config perf tests(#16009)
HarshaNalluru Jun 25, 2021
f3a8efe
[KeyVault] - Add support for getRandomBytes operation (#15955)
maorleger Jun 25, 2021
4784937
Fix pipeline error for test-utils (#15899)
praveenkuttappan Jun 25, 2021
82085ff
Prepare to move to @types/node v12 (#16012)
ramya-rao-a Jun 25, 2021
b729674
Update Node.js & browser support in README (#16011)
ramya-rao-a Jun 25, 2021
1a5d100
remove _response from response types (#16019)
KarishmaGhiya Jun 26, 2021
b8da289
Automatic rush update recheck (#16022)
azure-sdk Jun 26, 2021
ff90eba
Prepare Storage packages to move to @types/node v12 (#16020)
ramya-rao-a Jun 28, 2021
23de687
Update KV readmes with support policy (#16013)
ramya-rao-a Jun 28, 2021
d3647f8
[Cosmos] Simple endpoint refresh interval (#15781)
zfoster Jun 28, 2021
00ea067
Support track2 management packages (#15975)
praveenkuttappan Jun 28, 2021
facf5c1
Fix lint script for app config perf test (#16046)
ramya-rao-a Jun 28, 2021
37d3ed9
[core-rest] - Update core-client-paging-rest to use the latest core-r…
maorleger Jun 28, 2021
13772c2
Fix linter errors in app config perf tests (#16048)
ramya-rao-a Jun 28, 2021
21f28dc
[web-pubsub] Migrate `@azure/web-pubsub` to new core pipeline (#16010)
xirzec Jun 28, 2021
5c5c2cf
[EventGrid] Move to Core V2 Generator (#16047)
ellismg Jun 28, 2021
018fd46
update the redundant responses (#16051)
KarishmaGhiya Jun 28, 2021
8919e6a
[Identity] node-fetch takes above 2 seconds to send the request on so…
sadasant Jun 28, 2021
ec4abba
[Identity] Add support for Bridge to Kubernetes to ManagedIdentityCre…
sadasant Jun 28, 2021
df68c3e
[Azure Monitor Exporter] Separate tests into internal and public fold…
xiao-lix Jun 28, 2021
5b4eac3
[synapse] - Ignore known rollup warnings (#15948)
maorleger Jun 28, 2021
5a7c129
Update engines, @types/node to Node.js v12 (#15996)
ramya-rao-a Jun 28, 2021
f854a85
Update contributing guide to reflect Node.js support (#16057)
ramya-rao-a Jun 29, 2021
9699830
Update identity to 2.0.0-beta.4 for quantum jobs (#15801)
sarangan12 Jun 29, 2021
c8126be
[core] Retry on 503 using the Retry-After header (#15906)
sadasant Jun 29, 2021
b17fb63
[digital-twins-core] rename test folder and enable minmax testing (#1…
vishnureddy17 Jun 29, 2021
36b468c
[Identity] [InteractiveBrowserCredential] [Node] Enable PKCE (#15853)
sadasant Jun 29, 2021
d4d5002
[monitor-query] Regenerate client with stable swaggers and add in inc…
richardpark-msft Jun 29, 2021
8236d61
Updating changelog with date and feature added and running PrepareRel…
richardpark-msft Jun 29, 2021
20321ef
Convenience Method to create a synonymmap object (#16054)
sarangan12 Jun 29, 2021
14fddf7
[Identity] InteractiveBrowserCredential loginHint (#15855)
sadasant Jun 30, 2021
528f940
Sync eng/common directory with azure-sdk-tools for PR 1725 (#16079)
azure-sdk Jun 30, 2021
702007a
[core] - Update release dates for July Release (#16069)
maorleger Jun 30, 2021
bbd295a
Update devops workitem helpers (#16083)
azure-sdk Jun 30, 2021
19d0e76
[event-hubs] add AmqpAnnotatedMessage support (#15939)
chradek Jun 30, 2021
39d2a80
update core-client version to 1.2.1 (#16109)
maorleger Jun 30, 2021
44ba530
fix core-http changelog (#16116)
maorleger Jun 30, 2021
f143bcf
Sync eng/common directory with azure-sdk-tools for PR 1763 (#16091)
azure-sdk Jun 30, 2021
40dd9e4
[App Config] changelog and update versions for GA (#16115)
HarshaNalluru Jun 30, 2021
761a4e6
[Text Analytics] Merge feature branch for v5.1.0 to main (#16121)
deyaaeldeen Jun 30, 2021
d8407ad
[Identity] Support for tenant Id Challenges / tenant discovery in Cli…
sadasant Jun 30, 2021
020a075
Increment version for core releases (#16113)
azure-sdk Jun 30, 2021
cec69b6
Increment version for core releases (#16125)
azure-sdk Jun 30, 2021
d75f119
[service-bus] Fix message loss issues with peekLock and receiveAndDel…
richardpark-msft Jul 1, 2021
dea0b2e
update pipeline to feature/v4 (#15993)
dw511214992 Jul 1, 2021
f34b099
arm-security-release (#16135)
colawwj Jul 1, 2021
c07f91d
disable orginal pipeline for mgmt in main branch (#16026)
dw511214992 Jul 1, 2021
9b75850
Making secrets non-required, adding ref-docs (#16087)
KarishmaGhiya Jul 1, 2021
1eea0bb
Update docs metadata mutation logic (#16132)
azure-sdk Jul 1, 2021
e93bfac
Ensure word alpha is present in dev build (#16089)
praveenkuttappan Jul 1, 2021
55adc3d
[Text Analytics] Add test for categories filter (#16145)
deyaaeldeen Jul 1, 2021
43ecf92
Daily reference docs for JS (#15749)
danieljurek Jul 1, 2021
400a1f2
[Text Analytics] Update CHANGELOG with release date (#16146)
deyaaeldeen Jul 1, 2021
bfff737
[Perf] Update dependency core-http (#16147)
mikeharder Jul 1, 2021
e356efd
bump core-auth (#16149)
KarishmaGhiya Jul 1, 2021
899fc0a
Sync eng/common directory with azure-sdk-tools for PR 1772 (#16151)
azure-sdk Jul 1, 2021
3bcdc0b
Merge branch 'main' into feature/v4
dw511214992 Jul 2, 2021
9a47f3d
Appconfiguration release (#16190)
colawwj Jul 5, 2021
785029b
arm-postgresql-flexible (#16136)
colawwj Jul 6, 2021
52ad992
ten identity (#16252)
colawwj Jul 8, 2021
b7ed37e
identity support 20 (#16253)
colawwj Jul 8, 2021
c6fb107
identity support 30 (#16254)
colawwj Jul 8, 2021
43c5bc4
identity support 40 (#16255)
colawwj Jul 8, 2021
b79e507
identity support 50 (#16256)
colawwj Jul 8, 2021
3fe4a1c
60 rp identity support (#16293)
colawwj Jul 9, 2021
5565230
70 rp identity support (#16294)
colawwj Jul 9, 2021
4dbf054
80 rp support identity (#16295)
colawwj Jul 9, 2021
719cb86
90 rp identity support (#16296)
colawwj Jul 9, 2021
35fc536
arm-databricks-release (#16327)
colawwj Jul 9, 2021
de107dd
arm-appplatform (#16139)
colawwj Jul 9, 2021
3804071
arm-avs-release (#16198)
colawwj Jul 9, 2021
18c9ac9
arm-postgresql-flexible-release (#16307)
colawwj Jul 9, 2021
24c4d46
bugfix (#16329)
dw511214992 Jul 12, 2021
eb5b44c
enable ci only when branch is feature/*
dw511214992 Jul 12, 2021
8455b68
CodeGen from PR 14752 in Azure/azure-rest-api-specs
Jul 12, 2021
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
Prev Previous commit
Next Next commit
ten identity (Azure#16252)
  • Loading branch information
colawwj authored Jul 8, 2021
commit 52ad992bdfccbd55804e5eab8f72bb8949716deb
108 changes: 59 additions & 49 deletions sdk/hybridkubernetes/arm-hybridkubernetes/README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,103 @@
## Azure ConnectedKubernetesClient SDK for JavaScript

This package contains an isomorphic SDK for ConnectedKubernetesClient.
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for ConnectedKubernetesClient.

### Currently supported environments

- Node.js version 6.x.x or higher
- Browser JavaScript
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
- Latest versions of Safari, Chrome, Edge, and Firefox.

### How to Install
### Prerequisites

You must have an [Azure subscription](https://azure.microsoft.com/free/).

### How to install

To use this SDK in your project, you will need to install two packages.
- `@azure/arm-hybridkubernetes` that contains the client.
- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.

Install both packages using the below command:
```bash
npm install @azure/arm-hybridkubernetes
npm install --save @azure/arm-hybridkubernetes @azure/identity
```

> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.

### How to use

#### nodejs - client creation and get connectedCluster as an example written in TypeScript.
- If you are writing a client side browser application,
- Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
- Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
- If you are writing a server side application,
- [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
- Complete the set up steps required by the credential if any.
- Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.

##### Install @azure/ms-rest-nodeauth
In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.

- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
```bash
npm install @azure/ms-rest-nodeauth@"^3.0.0"
```
#### nodejs - Authentication, client creation, and get connectedCluster as an example written in JavaScript.

##### Sample code

While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package
```typescript
const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
```javascript
const { DefaultAzureCredential } = require("@azure/identity");
const { ConnectedKubernetesClient } = require("@azure/arm-hybridkubernetes");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new ConnectedKubernetesClient(creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const clusterName = "testclusterName";
client.connectedCluster.get(resourceGroupName, clusterName).then((result) => {
console.log("The result is:");
console.log(result);
});
// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
const creds = new DefaultAzureCredential();
const client = new ConnectedKubernetesClient(creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const clusterName = "testclusterName";
client.connectedCluster.get(resourceGroupName, clusterName).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log("An error occurred:");
console.error(err);
});
```

#### browser - Authentication, client creation and get connectedCluster as an example written in JavaScript.
#### browser - Authentication, client creation, and get connectedCluster as an example written in JavaScript.

##### Install @azure/ms-rest-browserauth

```bash
npm install @azure/ms-rest-browserauth
```
In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
- See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
- Note down the client Id from the previous step and use it in the browser sample below.

##### Sample code

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-hybridkubernetes sample</title>
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
<script src="node_modules/@azure/identity/dist/index.js"></script>
<script src="node_modules/@azure/arm-hybridkubernetes/dist/arm-hybridkubernetes.js"></script>
<script type="text/javascript">
const subscriptionId = "<Subscription_Id>";
const authManager = new msAuth.AuthManager({
// Create credentials using the `@azure/identity` package.
// Please note that you can also use credentials from the `@azure/ms-rest-browserauth` package instead.
const credential = new InteractiveBrowserCredential(
{
clientId: "<client id for your Azure AD app>",
tenant: "<optional tenant for your organization>"
tenantId: "<optional tenant for your organization>"
});
authManager.finalizeLogin().then((res) => {
if (!res.isLoggedIn) {
// may cause redirects
authManager.login();
}
const client = new Azure.ArmHybridkubernetes.ConnectedKubernetesClient(res.creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const clusterName = "testclusterName";
client.connectedCluster.get(resourceGroupName, clusterName).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log("An error occurred:");
console.error(err);
});
const client = new Azure.ArmHybridkubernetes.ConnectedKubernetesClient(creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const clusterName = "testclusterName";
client.connectedCluster.get(resourceGroupName, clusterName).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log("An error occurred:");
console.error(err);
});
</script>
</head>
Expand Down
9 changes: 5 additions & 4 deletions sdk/hybridkubernetes/arm-hybridkubernetes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
"name": "@azure/arm-hybridkubernetes",
"author": "Microsoft Corporation",
"description": "ConnectedKubernetesClient Library with typescript type definitions for node.js and browser.",
"version": "1.0.0",
"version": "1.1.0",
"dependencies": {
"@azure/ms-rest-azure-js": "^2.0.1",
"@azure/ms-rest-js": "^2.0.4",
"@azure/ms-rest-azure-js": "^2.1.0",
"@azure/ms-rest-js": "^2.2.0",
"@azure/core-auth": "^1.1.4",
"tslib": "^1.10.0"
},
"keywords": [
Expand All @@ -20,7 +21,7 @@
"module": "./esm/connectedKubernetesClient.js",
"types": "./esm/connectedKubernetesClient.d.ts",
"devDependencies": {
"typescript": "^3.5.3",
"typescript": "^3.6.0",
"rollup": "^1.18.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "^0.4.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

import * as msRest from "@azure/ms-rest-js";
import { TokenCredential } from "@azure/core-auth";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as operations from "./operations";
Expand All @@ -21,11 +22,16 @@ class ConnectedKubernetesClient extends ConnectedKubernetesClientContext {

/**
* Initializes a new instance of the ConnectedKubernetesClient class.
* @param credentials Credentials needed for the client to connect to Azure.
* @param credentials Credentials needed for the client to connect to Azure. Credentials
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
* more information about these credentials, see
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
* @azure/ms-rest-browserauth are also supported.
* @param subscriptionId The ID of the target subscription.
* @param [options] The parameter options
*/
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ConnectedKubernetesClientOptions) {
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.ConnectedKubernetesClientOptions) {
super(credentials, subscriptionId, options);
this.connectedCluster = new operations.ConnectedClusterOperations(this);
this.operations = new operations.Operations(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,29 @@

import * as Models from "./models";
import * as msRest from "@azure/ms-rest-js";
import { TokenCredential } from "@azure/core-auth";
import * as msRestAzure from "@azure/ms-rest-azure-js";

const packageName = "@azure/arm-hybridkubernetes";
const packageVersion = "1.0.0";
const packageVersion = "1.1.0";

export class ConnectedKubernetesClientContext extends msRestAzure.AzureServiceClient {
credentials: msRest.ServiceClientCredentials;
credentials: msRest.ServiceClientCredentials | TokenCredential;
apiVersion?: string;
subscriptionId: string;

/**
* Initializes a new instance of the ConnectedKubernetesClient class.
* @param credentials Credentials needed for the client to connect to Azure.
* @param credentials Credentials needed for the client to connect to Azure. Credentials
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
* more information about these credentials, see
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
* @azure/ms-rest-browserauth are also supported.
* @param subscriptionId The ID of the target subscription.
* @param [options] The parameter options
*/
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ConnectedKubernetesClientOptions) {
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.ConnectedKubernetesClientOptions) {
if (credentials == undefined) {
throw new Error('\'credentials\' cannot be null.');
}
Expand Down
108 changes: 59 additions & 49 deletions sdk/iotcentral/arm-iotcentral/README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,103 @@
## Azure IotCentralClient SDK for JavaScript

This package contains an isomorphic SDK for IotCentralClient.
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for IotCentralClient.

### Currently supported environments

- Node.js version 6.x.x or higher
- Browser JavaScript
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
- Latest versions of Safari, Chrome, Edge, and Firefox.

### How to Install
### Prerequisites

You must have an [Azure subscription](https://azure.microsoft.com/free/).

### How to install

To use this SDK in your project, you will need to install two packages.
- `@azure/arm-iotcentral` that contains the client.
- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.

Install both packages using the below command:
```bash
npm install @azure/arm-iotcentral
npm install --save @azure/arm-iotcentral @azure/identity
```

> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.

### How to use

#### nodejs - client creation and get apps as an example written in TypeScript.
- If you are writing a client side browser application,
- Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
- Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
- If you are writing a server side application,
- [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
- Complete the set up steps required by the credential if any.
- Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.

##### Install @azure/ms-rest-nodeauth
In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.

- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
```bash
npm install @azure/ms-rest-nodeauth@"^3.0.0"
```
#### nodejs - Authentication, client creation, and get apps as an example written in JavaScript.

##### Sample code

While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package
```typescript
const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
```javascript
const { DefaultAzureCredential } = require("@azure/identity");
const { IotCentralClient } = require("@azure/arm-iotcentral");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new IotCentralClient(creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const resourceName = "testresourceName";
client.apps.get(resourceGroupName, resourceName).then((result) => {
console.log("The result is:");
console.log(result);
});
// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
const creds = new DefaultAzureCredential();
const client = new IotCentralClient(creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const resourceName = "testresourceName";
client.apps.get(resourceGroupName, resourceName).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log("An error occurred:");
console.error(err);
});
```

#### browser - Authentication, client creation and get apps as an example written in JavaScript.
#### browser - Authentication, client creation, and get apps as an example written in JavaScript.

##### Install @azure/ms-rest-browserauth

```bash
npm install @azure/ms-rest-browserauth
```
In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
- See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
- Note down the client Id from the previous step and use it in the browser sample below.

##### Sample code

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-iotcentral sample</title>
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
<script src="node_modules/@azure/identity/dist/index.js"></script>
<script src="node_modules/@azure/arm-iotcentral/dist/arm-iotcentral.js"></script>
<script type="text/javascript">
const subscriptionId = "<Subscription_Id>";
const authManager = new msAuth.AuthManager({
// Create credentials using the `@azure/identity` package.
// Please note that you can also use credentials from the `@azure/ms-rest-browserauth` package instead.
const credential = new InteractiveBrowserCredential(
{
clientId: "<client id for your Azure AD app>",
tenant: "<optional tenant for your organization>"
tenantId: "<optional tenant for your organization>"
});
authManager.finalizeLogin().then((res) => {
if (!res.isLoggedIn) {
// may cause redirects
authManager.login();
}
const client = new Azure.ArmIotcentral.IotCentralClient(res.creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const resourceName = "testresourceName";
client.apps.get(resourceGroupName, resourceName).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log("An error occurred:");
console.error(err);
});
const client = new Azure.ArmIotcentral.IotCentralClient(creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const resourceName = "testresourceName";
client.apps.get(resourceGroupName, resourceName).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log("An error occurred:");
console.error(err);
});
</script>
</head>
Expand Down
Loading