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");
}
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");
}
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());
}
}
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.");
}
}
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());
}
}
}
Aggregations