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] Adding "assignmentState" property to scope model in access review APIs #4255

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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) 2021 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
70 changes: 37 additions & 33 deletions sdk/authorization/arm-authorization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,41 @@ npm install @azure/arm-authorization

### How to use

#### nodejs - Authentication, client creation and list classicAdministrators as an example written in TypeScript.
#### nodejs - 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
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");
const { AuthorizationManagementClient } = require("@azure/arm-authorization");
const { interactiveLogin } = require("@azure/ms-rest-nodeauth");

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 +62,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 +75,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 +107,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
6 changes: 3 additions & 3 deletions sdk/authorization/arm-authorization/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ const config = {
"@azure/ms-rest-azure-js": "msRestAzure"
},
banner: `/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/`
},
plugins: [
nodeResolve({ module: true }),
nodeResolve({ mainFields: ['module', 'main'] }),
sourcemaps()
]
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
Expand All @@ -17,13 +16,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 +26,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
@@ -1,7 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
Expand All @@ -17,6 +16,7 @@ const packageVersion = "8.3.3";

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

/**
Expand All @@ -43,6 +43,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