Creating and Deleting Tenancy Units

A tenancy unit is a lightweight entity that represents the relationship of a consumer, typically a service consumer project that has enabled your APIs, and your managed service. Only one tenancy unit per service consumer can be active at a time.

The resource name of a tenancy unit has the form:

/services/{your cloud service name}/projects/{consumer project number}/tenancyUnits/{id}

The ID of the tenancy unit is autogenerated when you create it. You can also provide the ID when you call the services.tenancyUnits.create method. If you provide an ID, it must be unique in the scope of your managed service, for all service consumers. It is an error if a tenancy unit with a different ID already exists for the same service consumer.

Before you begin

To create and delete tenancy units you need to follow the initial setup instructions in Getting Started with the Service Consumer Management API.

Creating a tenancy unit

To create a tenancy unit using the REST API, call the following HTTP method, with the proper authorization tokens in the header:

POST https://serviceconsumermanagement.googleapis.com/v1/services/your-service.example.com/projects/12345678901/tenancyUnits

Here, projects/12345678901 is the service consumer of the managed service, and your-service.example.com is the name of your managed service.

The returned tenancy data structure has the name of the tenancy unit.

You can create a tenancy unit as soon as the service consumer enables your managed service.

When you don't provide an ID and a tenancy unit for the consumer already exists, that tenancy unit is returned as the result.

Deleting a tenancy unit

To delete a tenancy unit, first remove all projects in it using the services.tenancyUnits.removeProject method. Then, call the services.tenancyUnits.delete method to remove the tenancy unit:

DELETE https://serviceconsumermanagement.googleapis.com/v1/services/your-service.example.com/projects/12345678901/tenancyUnits/absdef
Oliko tästä sivusta apua? Kerro mielipiteesi

Palautteen aihe:

Tämä sivu
Service Infrastructure