Search in sources :

Example 1 with Tenant

use of com.google.cloud.talent.v4beta1.Tenant in project openstack4j by ContainX.

the class KeystoneTests method testAuthorizationFailure.

public void testAuthorizationFailure() throws IOException {
    // First we simulate a 401 Authorization error
    respondWith(401);
    // The retry logic should re-authenticate and would be expecting the
    // Access object
    respondWith(JSON_ACCESS);
    // The retry logic would then run the user lists expecting the proper
    // result
    respondWith(JSON_USERS);
    assertEquals(osv2.identity().users().list().size(), 8);
    // Positive test to make sure we are back in sync
    respondWith(JSON_TENANT);
    Tenant t = osv2.identity().tenants().get("b80f8d4e28b74188858b654cb1fccf7d");
    assertEquals(t.getName(), "admin");
}
Also used : Tenant(org.openstack4j.model.identity.v2.Tenant)

Example 2 with Tenant

use of com.google.cloud.talent.v4beta1.Tenant in project openstack4j by ContainX.

the class KeystoneTests method testTenants.

/**
 * Tests tenant based operations
 *
 * @throws Exception
 */
public void testTenants() throws Exception {
    respondWith(JSON_TENANTS);
    List<? extends Tenant> tenants = osv2().identity().tenants().list();
    assertEquals(tenants.size(), 3);
    respondWith(JSON_TENANT);
    Tenant t = osv2().identity().tenants().get("b80f8d4e28b74188858b654cb1fccf7d");
    assertEquals(t.getName(), "admin");
}
Also used : Tenant(org.openstack4j.model.identity.v2.Tenant)

Example 3 with Tenant

use of com.google.cloud.talent.v4beta1.Tenant in project java-docs-samples by GoogleCloudPlatform.

the class JobSearchGetTenant method getTenant.

// Get Tenant by name.
public static void getTenant(String projectId, String tenantId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) {
        TenantName name = TenantName.of(projectId, tenantId);
        GetTenantRequest request = GetTenantRequest.newBuilder().setName(name.toString()).build();
        Tenant response = tenantServiceClient.getTenant(request);
        System.out.format("Name: %s%n", response.getName());
        System.out.format("External ID: %s%n", response.getExternalId());
    }
}
Also used : TenantServiceClient(com.google.cloud.talent.v4beta1.TenantServiceClient) Tenant(com.google.cloud.talent.v4beta1.Tenant) TenantName(com.google.cloud.talent.v4beta1.TenantName) GetTenantRequest(com.google.cloud.talent.v4beta1.GetTenantRequest)

Example 4 with Tenant

use of com.google.cloud.talent.v4beta1.Tenant in project java-docs-samples by GoogleCloudPlatform.

the class JobSearchDeleteTenant method deleteTenant.

// Delete Tenant.
public static void deleteTenant(String projectId, String tenantId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) {
        TenantName name = TenantName.of(projectId, tenantId);
        DeleteTenantRequest request = DeleteTenantRequest.newBuilder().setName(name.toString()).build();
        tenantServiceClient.deleteTenant(request);
        System.out.println("Deleted Tenant.");
    }
}
Also used : TenantServiceClient(com.google.cloud.talent.v4beta1.TenantServiceClient) TenantName(com.google.cloud.talent.v4beta1.TenantName) DeleteTenantRequest(com.google.cloud.talent.v4beta1.DeleteTenantRequest)

Example 5 with Tenant

use of com.google.cloud.talent.v4beta1.Tenant in project java-docs-samples by GoogleCloudPlatform.

the class JobSearchListTenants method listTenants.

// List Tenants.
public static void listTenants(String projectId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) {
        ProjectName parent = ProjectName.of(projectId);
        ListTenantsRequest request = ListTenantsRequest.newBuilder().setParent(parent.toString()).build();
        for (Tenant responseItem : tenantServiceClient.listTenants(request).iterateAll()) {
            System.out.format("Tenant Name: %s%n", responseItem.getName());
            System.out.format("External ID: %s%n", responseItem.getExternalId());
        }
    }
}
Also used : TenantServiceClient(com.google.cloud.talent.v4beta1.TenantServiceClient) Tenant(com.google.cloud.talent.v4beta1.Tenant) ProjectName(com.google.cloud.talent.v4beta1.ProjectName) ListTenantsRequest(com.google.cloud.talent.v4beta1.ListTenantsRequest)

Aggregations

TenantServiceClient (com.google.cloud.talent.v4beta1.TenantServiceClient)4 Tenant (com.google.cloud.talent.v4beta1.Tenant)3 TenantName (com.google.cloud.talent.v4beta1.TenantName)3 ProjectName (com.google.cloud.talent.v4beta1.ProjectName)2 Tenant (org.openstack4j.model.identity.v2.Tenant)2 ClientEvent (com.google.cloud.talent.v4beta1.ClientEvent)1 CreateClientEventRequest (com.google.cloud.talent.v4beta1.CreateClientEventRequest)1 CreateTenantRequest (com.google.cloud.talent.v4beta1.CreateTenantRequest)1 DeleteTenantRequest (com.google.cloud.talent.v4beta1.DeleteTenantRequest)1 EventServiceClient (com.google.cloud.talent.v4beta1.EventServiceClient)1 GetTenantRequest (com.google.cloud.talent.v4beta1.GetTenantRequest)1 JobEvent (com.google.cloud.talent.v4beta1.JobEvent)1 ListTenantsRequest (com.google.cloud.talent.v4beta1.ListTenantsRequest)1 Timestamp (com.google.protobuf.Timestamp)1