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

Defines tenant management API on AuthRequestHandler. #559

Merged
merged 3 commits into from
Jun 12, 2019

Conversation

bojeil-google
Copy link
Contributor

Defines tenant management API on AuthRequestHandler.

Copy link
Contributor

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good. I just pointed out a few nits.

* @param {TenantOptions} tenantOptions The properties to set on the new tenant to be created.
* @return {Promise<TenantServerResponse>} A promise that resolves with the newly created tenant object.
*/
public createTenant(tenantOptions: TenantOptions): Promise<object> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set return type to Promise<TenantServerResponse>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

} catch (e) {
return Promise.reject(e);
}
return this.invokeRequestHandler(this.tenantMgmtResourceBuilder, CREATE_TENANT, request)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: You can move this inside the try block. Then request can be a const. Here and other places where this pattern is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* @param {TenantOptions} tenantOptions The properties to update on the existing tenant.
* @return {Promise<TenantServerResponse>} A promise that resolves with the modified tenant object.
*/
public updateTenant(tenantId: string, tenantOptions: TenantOptions): Promise<object> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set the more specific return type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


describe('updateTenant', () => {
const path = '/v2beta1/projects/project_id/tenants/tenant_id';
const method = 'PATCH';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be call this patchMethod? That will make the code that uses it more readable:

expect(stub).to.have.been.calledOnce.and.calledWith(callParams(expectedPath, patchMethod, expectedRequest));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


describe('createTenant', () => {
const path = '/v2beta1/projects/project_id/tenants';
const method = 'POST';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Perhaps call it postMethod for clarity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@bojeil-google bojeil-google merged commit 5a36d39 into auth-multi-tenancy Jun 12, 2019
@bojeil-google bojeil-google deleted the temp-multi-tenancy branch June 13, 2019 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants