def create_tenant(project_id, external_id):
    """Create Tenant for scoping resources, e.g. companies and jobs"""

    client = talent.TenantServiceClient()

    # project_id = 'Your Google Cloud Project ID'
    # external_id = 'Your Unique Identifier for Tenant'

    if isinstance(project_id, six.binary_type):
        project_id = project_id.decode("utf-8")
    if isinstance(external_id, six.binary_type):
        external_id = external_id.decode("utf-8")
    parent = f"projects/{project_id}"
    tenant = talent.Tenant(external_id=external_id)

    response = client.create_tenant(parent=parent, tenant=tenant)
    print("Created Tenant")
    print(f"Name: {response.name}")
    print(f"External ID: {response.external_id}")
    return response.name
Пример #2
0
 def update(self):
     tenant = talent.Tenant(**self.dict())
     _ = client_tenant.update_tenant(tenant=tenant)
Пример #3
0
 def create(self):
     tenant = talent.Tenant(**self.dict())
     response = client_tenant.create_tenant(parent=self._parent,
                                            tenant=tenant)
     self.name = response.name