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-authorization] Addendum | Access Reviews reviewer and stats APIs #1672

Open
wants to merge 1 commit into
base: sdkAutomation/@azure_arm-authorization
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion sdk/authorization/arm-authorization/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2019 Microsoft
Copyright (c) 2020 Microsoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
73 changes: 39 additions & 34 deletions sdk/authorization/arm-authorization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,42 @@ npm install @azure/arm-authorization

### How to use

#### nodejs - Authentication, client creation and list classicAdministrators as an example written in TypeScript.
#### nodejs - Authentication, client creation and listForResource roleAssignments as an example written in TypeScript.

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

- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
```bash
npm install @azure/ms-rest-nodeauth
npm install @azure/ms-rest-nodeauth@"^3.0.0"
```

##### Sample code

```javascript
const { AuthorizationManagementClient } = require("@azure/arm-authorization");
const { interactiveLogin } = require("@azure/ms-rest-nodeauth");

```typescript
import * as msRest from "@azure/ms-rest-js";
import * as msRestAzure from "@azure/ms-rest-azure-js";
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
import { AuthorizationManagementClient, AuthorizationManagementModels, AuthorizationManagementMappers } from "@azure/arm-authorization";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

interactiveLogin()
.then((creds) => {
const client = new AuthorizationManagementClient(creds, subscriptionId);
client.classicAdministrators.list().then((result) => {
console.log("The result is:");
console.log(result);
});
})
.catch((err) => {
console.error(err);
msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new AuthorizationManagementClient(creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const resourceProviderNamespace = "testresourceProviderNamespace";
const parentResourcePath = "testparentResourcePath";
const resourceType = "testresourceType";
const resourceName = "testresourceName";
const filter = "testfilter";
client.roleAssignments.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter).then((result) => {
console.log("The result is:");
console.log(result);
});
}).catch((err) => {
console.error(err);
});
```

#### browser - Authentication, client creation and list classicAdministrators as an example written in JavaScript.
#### browser - Authentication, client creation and listForResource roleAssignments as an example written in JavaScript.

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

Expand All @@ -57,7 +63,6 @@ npm install @azure/ms-rest-browserauth
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">
Expand All @@ -71,27 +76,27 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
const subscriptionId = "<Subscription_Id>";
const authManager = new msAuth.AuthManager({
clientId: "<client id for your Azure AD app>",
tenant: "<optional tenant for your organization>",
tenant: "<optional tenant for your organization>"
});
authManager.finalizeLogin().then((res) => {
if (!res.isLoggedIn) {
// may cause redirects
authManager.login();
}
const client = new Azure.ArmAuthorization.AuthorizationManagementClient(
res.creds,
subscriptionId
);
client.classicAdministrators
.list()
.then((result) => {
console.log("The result is:");
console.log(result);
})
.catch((err) => {
console.log("An error occurred:");
console.error(err);
});
const client = new Azure.ArmAuthorization.AuthorizationManagementClient(res.creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const resourceProviderNamespace = "testresourceProviderNamespace";
const parentResourcePath = "testparentResourcePath";
const resourceType = "testresourceType";
const resourceName = "testresourceName";
const filter = "testfilter";
client.roleAssignments.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log("An error occurred:");
console.error(err);
});
});
</script>
</head>
Expand All @@ -103,4 +108,4 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to

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

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fauthorization%2Farm-authorization%2FREADME.png)
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/authorization/arm-authorization/README.png)
14 changes: 7 additions & 7 deletions sdk/authorization/arm-authorization/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"description": "AuthorizationManagementClient Library with typescript type definitions for node.js and browser.",
"version": "8.3.3",
"dependencies": {
"@azure/ms-rest-azure-js": "^2.0.0",
"@azure/ms-rest-js": "^2.0.3",
"tslib": "^1.9.3"
"@azure/ms-rest-azure-js": "^2.0.1",
"@azure/ms-rest-js": "^2.0.4",
"tslib": "^1.10.0"
},
"keywords": [
"node",
Expand All @@ -20,11 +20,11 @@
"module": "./esm/authorizationManagementClient.js",
"types": "./esm/authorizationManagementClient.d.ts",
"devDependencies": {
"typescript": "^3.1.1",
"rollup": "^0.66.2",
"rollup-plugin-node-resolve": "^3.4.0",
"typescript": "^3.5.3",
"rollup": "^1.18.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"uglify-js": "^3.4.9"
"uglify-js": "^3.6.0"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/authorization/arm-authorization",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion sdk/authorization/arm-authorization/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const config = {
*/`
},
plugins: [
nodeResolve({ module: true }),
nodeResolve({ mainFields: ['module', 'main'] }),
sourcemaps()
]
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@ import { AuthorizationManagementClientContext } from "./authorizationManagementC

class AuthorizationManagementClient extends AuthorizationManagementClientContext {
// Operation groups
classicAdministrators: operations.ClassicAdministrators;
globalAdministrator: operations.GlobalAdministrator;
providerOperationsMetadata: operations.ProviderOperationsMetadataOperations;
roleAssignments: operations.RoleAssignments;
permissions: operations.Permissions;
roleDefinitions: operations.RoleDefinitions;
denyAssignments: operations.DenyAssignments;

/**
* Initializes a new instance of the AuthorizationManagementClient class.
Expand All @@ -33,13 +27,7 @@ class AuthorizationManagementClient extends AuthorizationManagementClientContext
*/
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.AuthorizationManagementClientOptions) {
super(credentials, subscriptionId, options);
this.classicAdministrators = new operations.ClassicAdministrators(this);
this.globalAdministrator = new operations.GlobalAdministrator(this);
this.providerOperationsMetadata = new operations.ProviderOperationsMetadataOperations(this);
this.roleAssignments = new operations.RoleAssignments(this);
this.permissions = new operations.Permissions(this);
this.roleDefinitions = new operations.RoleDefinitions(this);
this.denyAssignments = new operations.DenyAssignments(this);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const packageVersion = "8.3.3";
export class AuthorizationManagementClientContext extends msRestAzure.AzureServiceClient {
credentials: msRest.ServiceClientCredentials;
subscriptionId: string;
apiVersion?: string;

/**
* Initializes a new instance of the AuthorizationManagementClient class.
Expand All @@ -43,6 +44,7 @@ export class AuthorizationManagementClientContext extends msRestAzure.AzureServi

super(credentials, options);

this.apiVersion = '2020-04-01-preview';
this.acceptLanguage = 'en-US';
this.longRunningOperationRetryTimeout = 30;
this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com";
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading