use of com.google.cloud.billing.v1.ProjectBillingInfo in project terra-cloud-resource-lib by DataBiosphere.
the class CloudBillingClientCowTest method getSetProjectBillingInfo.
@Test
public void getSetProjectBillingInfo() throws Exception {
Project project = ProjectUtils.executeCreateProject();
try (CloudBillingClientCow billingCow = defaultBillingCow()) {
ProjectBillingInfo initialBilling = billingCow.getProjectBillingInfo("projects/" + project.getProjectId());
assertEquals(project.getProjectId(), initialBilling.getProjectId());
assertEquals("", initialBilling.getBillingAccountName());
ProjectBillingInfo setBilling = ProjectBillingInfo.newBuilder().setBillingAccountName(BILLING_ACCOUNT_NAME).build();
ProjectBillingInfo updatedBilling = billingCow.updateProjectBillingInfo("projects/" + project.getProjectId(), setBilling);
assertEquals(project.getProjectId(), updatedBilling.getProjectId());
assertEquals(BILLING_ACCOUNT_NAME, updatedBilling.getBillingAccountName());
}
ProjectUtils.getManagerCow().projects().delete(project.getProjectId());
}
Aggregations