Skip to content

Commit

Permalink
CodeGen from PR 16139 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
[Hub Generated] Review request for Microsoft.IoTCentral to add version stable/2021-06-01 (Azure#16139)

* [IoT-Central] Added identity request and response objects for IoT Central APIs to support Managed Identities

* Updated model as string

* Updated case for none

* Updated ArmIdentity to ManagedIdentity

* Added description and title for ManagedIdentity

* Updated casing for mI type

* Reset casing for MI type

* Updated comments for principalId and tenantId

* Use common-types for supported system-assigned managed identities

Co-authored-by: Ganesh Viswanathan <[email protected]>
  • Loading branch information
SDKAuto and Ganesh Viswanathan committed Oct 9, 2021
1 parent f25645d commit e032f00
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 14 deletions.
8 changes: 3 additions & 5 deletions sdk/iotcentral/arm-iotcentral/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
## Azure IotCentralClient SDK for JavaScript

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

### Currently supported environments

- [LTS versions of Node.js](https://nodejs.org/about/releases/)
- Latest versions of Safari, Chrome, Edge, and Firefox.
- Latest versions of Safari, Chrome, Edge and Firefox.

### Prerequisites

Expand All @@ -21,7 +21,6 @@ Install both packages using the below command:
```bash
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.

Expand All @@ -37,7 +36,6 @@ If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/

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.

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

##### Sample code
Expand Down Expand Up @@ -87,7 +85,7 @@ In browser applications, we recommend using the `InteractiveBrowserCredential` t
const credential = new InteractiveBrowserCredential(
{
clientId: "<client id for your Azure AD app>",
tenantId: "<optional tenant for your organization>"
tenant: "<optional tenant for your organization>"
});
const client = new Azure.ArmIotcentral.IotCentralClient(creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
Expand Down
2 changes: 1 addition & 1 deletion sdk/iotcentral/arm-iotcentral/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"rollup-plugin-sourcemaps": "^0.4.2",
"uglify-js": "^3.6.0"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/feature/v4/sdk/iotcentral/arm-iotcentral",
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/iotcentral/arm-iotcentral",
"repository": {
"type": "git",
"url": "https://github.com/Azure/azure-sdk-for-js.git"
Expand Down
4 changes: 2 additions & 2 deletions sdk/iotcentral/arm-iotcentral/src/iotCentralClientContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

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";
import { TokenCredential } from "@azure/core-auth";

const packageName = "@azure/arm-iotcentral";
const packageVersion = "4.2.1";
Expand Down Expand Up @@ -49,7 +49,7 @@ export class IotCentralClientContext extends msRestAzure.AzureServiceClient {

super(credentials, options);

this.apiVersion = '2018-09-01';
this.apiVersion = '2021-06-01';
this.acceptLanguage = 'en-US';
this.longRunningOperationRetryTimeout = 30;
this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com";
Expand Down
3 changes: 2 additions & 1 deletion sdk/iotcentral/arm-iotcentral/src/models/appsMappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ export {
BaseResource,
CloudError,
OperationInputs,
Resource
Resource,
SystemAssignedServiceIdentity
} from "../models/mappers";
60 changes: 57 additions & 3 deletions sdk/iotcentral/arm-iotcentral/src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,33 @@ export { BaseResource, CloudError };
*/
export interface AppSkuInfo {
/**
* The name of the SKU. Possible values include: 'F1', 'S1', 'ST0', 'ST1', 'ST2'
* The name of the SKU. Possible values include: 'ST0', 'ST1', 'ST2'
*/
name: AppSku;
}

/**
* Managed service identity (either system assigned, or none)
*/
export interface SystemAssignedServiceIdentity {
/**
* The service principal ID of the system assigned identity. This property will only be provided
* for a system assigned identity.
* **NOTE: This property will not be serialized. It can only be populated by the server.**
*/
readonly principalId?: string;
/**
* The tenant ID of the system assigned identity. This property will only be provided for a
* system assigned identity.
* **NOTE: This property will not be serialized. It can only be populated by the server.**
*/
readonly tenantId?: string;
/**
* Possible values include: 'None', 'SystemAssigned'
*/
type: SystemAssignedServiceIdentityType;
}

/**
* The common properties of an ARM resource.
*/
Expand Down Expand Up @@ -73,10 +95,18 @@ export interface App extends Resource {
* allows the application to be defined from scratch.
*/
template?: string;
/**
* The current state of the application. Possible values include: 'created', 'suspended'
*/
state?: AppState;
/**
* A valid instance SKU.
*/
sku: AppSkuInfo;
/**
* The managed identities for the IoT Central application.
*/
identity?: SystemAssignedServiceIdentity;
}

/**
Expand Down Expand Up @@ -110,6 +140,14 @@ export interface AppPatch {
* allows the application to be defined from scratch.
*/
template?: string;
/**
* The current state of the application. Possible values include: 'created', 'suspended'
*/
state?: AppState;
/**
* The managed identities for the IoT Central application.
*/
identity?: SystemAssignedServiceIdentity;
}

/**
Expand Down Expand Up @@ -330,13 +368,29 @@ export interface OperationListResult extends Array<Operation> {
nextLink?: string;
}

/**
* Defines values for AppState.
* Possible values include: 'created', 'suspended'
* @readonly
* @enum {string}
*/
export type AppState = 'created' | 'suspended';

/**
* Defines values for AppSku.
* Possible values include: 'F1', 'S1', 'ST0', 'ST1', 'ST2'
* Possible values include: 'ST0', 'ST1', 'ST2'
* @readonly
* @enum {string}
*/
export type AppSku = 'ST0' | 'ST1' | 'ST2';

/**
* Defines values for SystemAssignedServiceIdentityType.
* Possible values include: 'None', 'SystemAssigned'
* @readonly
* @enum {string}
*/
export type AppSku = 'F1' | 'S1' | 'ST0' | 'ST1' | 'ST2';
export type SystemAssignedServiceIdentityType = 'None' | 'SystemAssigned';

/**
* Contains response data for the get operation.
Expand Down
57 changes: 57 additions & 0 deletions sdk/iotcentral/arm-iotcentral/src/models/mappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,37 @@ export const AppSkuInfo: msRest.CompositeMapper = {
}
};

export const SystemAssignedServiceIdentity: msRest.CompositeMapper = {
serializedName: "SystemAssignedServiceIdentity",
type: {
name: "Composite",
className: "SystemAssignedServiceIdentity",
modelProperties: {
principalId: {
readOnly: true,
serializedName: "principalId",
type: {
name: "Uuid"
}
},
tenantId: {
readOnly: true,
serializedName: "tenantId",
type: {
name: "Uuid"
}
},
type: {
required: true,
serializedName: "type",
type: {
name: "String"
}
}
}
}
};

export const Resource: msRest.CompositeMapper = {
serializedName: "Resource",
type: {
Expand Down Expand Up @@ -113,13 +144,26 @@ export const App: msRest.CompositeMapper = {
name: "String"
}
},
state: {
serializedName: "properties.state",
type: {
name: "String"
}
},
sku: {
required: true,
serializedName: "sku",
type: {
name: "Composite",
className: "AppSkuInfo"
}
},
identity: {
serializedName: "identity",
type: {
name: "Composite",
className: "SystemAssignedServiceIdentity"
}
}
}
}
Expand Down Expand Up @@ -173,6 +217,19 @@ export const AppPatch: msRest.CompositeMapper = {
type: {
name: "String"
}
},
state: {
serializedName: "properties.state",
type: {
name: "String"
}
},
identity: {
serializedName: "identity",
type: {
name: "Composite",
className: "SystemAssignedServiceIdentity"
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions sdk/iotcentral/arm-iotcentral/src/operations/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class Operations {
}

/**
* Lists all of the available IoT Central application REST API operations.
* Lists all of the available IoT Central Resource Provider operations.
* @param [options] The optional parameters
* @returns Promise<Models.OperationsListResponse>
*/
Expand All @@ -50,7 +50,7 @@ export class Operations {
}

/**
* Lists all of the available IoT Central application REST API operations.
* Lists all of the available IoT Central Resource Provider operations.
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @param [options] The optional parameters
* @returns Promise<Models.OperationsListNextResponse>
Expand Down

0 comments on commit e032f00

Please sign in to comment.