Skip to content

Comments

Defines tenant management API on AuthRequestHandler.#559

Merged
bojeil-google merged 3 commits intoauth-multi-tenancyfrom
temp-multi-tenancy
Jun 12, 2019
Merged

Defines tenant management API on AuthRequestHandler.#559
bojeil-google merged 3 commits intoauth-multi-tenancyfrom
temp-multi-tenancy

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