Search in sources :

Example 1 with GCR_MANAGED_ZONE_NAME

use of bio.terra.buffer.service.resource.flight.GoogleUtils.GCR_MANAGED_ZONE_NAME in project terra-resource-buffer by DataBiosphere.

the class CreateProjectFlightIntegrationTest method assertGcrDnsExists.

private void assertGcrDnsExists(Project project) throws Exception {
    String projectId = project.getProjectId();
    ManagedZone managedZone = dnsCow.managedZones().get(projectId, GCR_MANAGED_ZONE_NAME).execute();
    Map<String, ResourceRecordSet> resourceRecordSets = dnsCow.resourceRecordSets().list(project.getProjectId(), GCR_MANAGED_ZONE_NAME).execute().getRrsets().stream().collect(Collectors.toMap(ResourceRecordSet::getType, r -> r));
    ResourceRecordSet aRecordSet = resourceRecordSets.get(GCR_A_RECORD.getType());
    ResourceRecordSet cnameRecordSet = resourceRecordSets.get(GCR_CNAME_RECORD.getType());
    assertEquals(GCR_MANAGED_ZONE_TEMPLATE.getName(), managedZone.getName());
    assertEquals(GCR_MANAGED_ZONE_TEMPLATE.getVisibility(), managedZone.getVisibility().toLowerCase());
    assertEquals(GCR_MANAGED_ZONE_TEMPLATE.getDescription(), managedZone.getDescription());
    assertResourceRecordSetMatch(GCR_A_RECORD, aRecordSet);
    assertResourceRecordSetMatch(GCR_CNAME_RECORD, cnameRecordSet);
}
Also used : ResourceRecordSet(com.google.api.services.dns.model.ResourceRecordSet) LEONARDO_ALLOW_INTERNAL_RULE_NAME_LABEL_KEY(bio.terra.buffer.service.resource.flight.CreateProjectStep.LEONARDO_ALLOW_INTERNAL_RULE_NAME_LABEL_KEY) RESTRICT_API_CNAME_RECORD(bio.terra.buffer.service.resource.flight.CreateResourceRecordSetStep.RESTRICT_API_CNAME_RECORD) LEONARDO_SSL_FOR_DEFAULT_NETWORK_RULE_NAME(bio.terra.buffer.service.resource.flight.CreateFirewallRuleStep.LEONARDO_SSL_FOR_DEFAULT_NETWORK_RULE_NAME) ROUTE_NAME(bio.terra.buffer.service.resource.flight.CreateRouteStep.ROUTE_NAME) RetryRule(bio.terra.stairway.RetryRule) Autowired(org.springframework.beans.factory.annotation.Autowired) Network(com.google.api.services.compute.model.Network) Route(com.google.api.services.compute.model.Route) LEONARDO_SSL_FOR_VPC_NETWORK_RULE_NAME(bio.terra.buffer.service.resource.flight.CreateFirewallRuleStep.LEONARDO_SSL_FOR_VPC_NETWORK_RULE_NAME) Disabled(org.junit.jupiter.api.Disabled) ResourceId(bio.terra.buffer.common.ResourceId) BigDecimal(java.math.BigDecimal) CreateSubnetsStep.getSubnetLogConfig(bio.terra.buffer.service.resource.flight.CreateSubnetsStep.getSubnetLogConfig) DENY_EGRESS_LEONARDO_WORKER_RULE_NAME(bio.terra.buffer.service.resource.flight.CreateFirewallRuleStep.DENY_EGRESS_LEONARDO_WORKER_RULE_NAME) Map(java.util.Map) GoogleUtils.resourceExists(bio.terra.buffer.service.resource.flight.GoogleUtils.resourceExists) IntegrationUtils.blockUntilFlightComplete(bio.terra.buffer.integration.IntegrationUtils.blockUntilFlightComplete) TEST_CONFIG_NAME(bio.terra.buffer.integration.IntegrationUtils.TEST_CONFIG_NAME) ServiceAccountName(bio.terra.cloudres.google.iam.ServiceAccountName) StorageCow(bio.terra.cloudres.google.storage.StorageCow) ResourceRecordSet(com.google.api.services.dns.model.ResourceRecordSet) ALLOW_INTERNAL_VPC_NETWORK(bio.terra.buffer.service.resource.flight.CreateFirewallRuleStep.ALLOW_INTERNAL_VPC_NETWORK) GCR_CNAME_RECORD(bio.terra.buffer.service.resource.flight.CreateResourceRecordSetStep.GCR_CNAME_RECORD) BucketInfo(com.google.cloud.storage.BucketInfo) StubSubmissionFlightFactory(bio.terra.buffer.integration.IntegrationUtils.StubSubmissionFlightFactory) ALLOW_EGRESS_INTERNAL(bio.terra.buffer.service.resource.flight.CreateFirewallRuleStep.ALLOW_EGRESS_INTERNAL) SUB_NETWORK_LABEL_KEY(bio.terra.buffer.service.resource.flight.CreateProjectStep.SUB_NETWORK_LABEL_KEY) NETWORK_NAME(bio.terra.buffer.service.resource.flight.GoogleUtils.NETWORK_NAME) Pool(bio.terra.buffer.common.Pool) GKE_SA_NAME(bio.terra.buffer.service.resource.flight.CreateGkeDefaultSAStep.GKE_SA_NAME) Flight(bio.terra.stairway.Flight) CreateProjectStep.createValidLabelValue(bio.terra.buffer.service.resource.flight.CreateProjectStep.createValidLabelValue) Service(com.google.api.services.serviceusage.v1beta1.model.Service) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) StepStatus(bio.terra.stairway.StepStatus) ALLOW_EGRESS_INTERNAL_RULE_NAME(bio.terra.buffer.service.resource.flight.CreateFirewallRuleStep.ALLOW_EGRESS_INTERNAL_RULE_NAME) FlightContext(bio.terra.stairway.FlightContext) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) FlightSubmissionFactoryImpl(bio.terra.buffer.service.resource.FlightSubmissionFactoryImpl) ServiceAccount(com.google.api.services.iam.v1.model.ServiceAccount) Policy(com.google.cloud.Policy) ListConsumerOverridesResponse(com.google.api.services.serviceusage.v1beta1.model.ListConsumerOverridesResponse) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) IntegrationUtils.newBasicGcpConfig(bio.terra.buffer.integration.IntegrationUtils.newBasicGcpConfig) Project(com.google.api.services.cloudresourcemanager.v3.model.Project) ArrayList(java.util.ArrayList) REGION_TO_IP_RANGE(bio.terra.buffer.service.resource.flight.CreateSubnetsStep.REGION_TO_IP_RANGE) GoogleUtils.projectIdToName(bio.terra.buffer.service.resource.flight.GoogleUtils.projectIdToName) GenerateProjectIdStep(bio.terra.buffer.service.resource.flight.GenerateProjectIdStep) Firewall(com.google.api.services.compute.model.Firewall) GCR_MANAGED_ZONE_NAME(bio.terra.buffer.service.resource.flight.GoogleUtils.GCR_MANAGED_ZONE_NAME) IntegrationUtils.preparePool(bio.terra.buffer.integration.IntegrationUtils.preparePool) GKE_SA_ROLES(bio.terra.buffer.service.resource.flight.CreateGkeDefaultSAStep.GKE_SA_ROLES) LEONARDO_ALLOW_HTTPS_FIREWALL_RULE_NAME_LABEL_KEY(bio.terra.buffer.service.resource.flight.CreateProjectStep.LEONARDO_ALLOW_HTTPS_FIREWALL_RULE_NAME_LABEL_KEY) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) GoogleApiServiceusageV1Service(com.google.api.services.serviceusage.v1beta1.model.GoogleApiServiceusageV1Service) Resource(bio.terra.buffer.common.Resource) ALLOW_INGRESS_LEONARDO_SSL_DEFAULT(bio.terra.buffer.service.resource.flight.CreateFirewallRuleStep.ALLOW_INGRESS_LEONARDO_SSL_DEFAULT) Subnetwork(com.google.api.services.compute.model.Subnetwork) FlightMap(bio.terra.stairway.FlightMap) GoogleProjectCreationFlight(bio.terra.buffer.service.resource.flight.GoogleProjectCreationFlight) CloudResourceManagerCow(bio.terra.cloudres.google.cloudresourcemanager.CloudResourceManagerCow) IOException(java.io.IOException) GcpProjectIdGenerator(bio.terra.buffer.service.resource.projectid.GcpProjectIdGenerator) ALLOW_INTERNAL_DEFAULT_NETWORK(bio.terra.buffer.service.resource.flight.CreateFirewallRuleStep.ALLOW_INTERNAL_DEFAULT_NETWORK) FinishResourceCreationStep(bio.terra.buffer.service.resource.flight.FinishResourceCreationStep) CloudBillingClientCow(bio.terra.cloudres.google.billing.CloudBillingClientCow) DEFAULT_FIREWALL_NAMES(bio.terra.buffer.service.resource.flight.DeleteDefaultFirewallRulesStep.DEFAULT_FIREWALL_NAMES) SUBNETWORK_NAME(bio.terra.buffer.service.resource.flight.GoogleUtils.SUBNETWORK_NAME) DnsCow(bio.terra.cloudres.google.dns.DnsCow) DirtiesContext(org.springframework.test.annotation.DirtiesContext) RESTRICTED_GOOGLE_IP_ADDRESS(bio.terra.buffer.service.resource.flight.GoogleUtils.RESTRICTED_GOOGLE_IP_ADDRESS) MANAGED_ZONE_TEMPLATE(bio.terra.buffer.service.resource.flight.CreateDnsZoneStep.MANAGED_ZONE_TEMPLATE) ALLOW_EGRESS_LEONARDO(bio.terra.buffer.service.resource.flight.CreateFirewallRuleStep.ALLOW_EGRESS_LEONARDO) StorageOptions(com.google.cloud.storage.StorageOptions) IntegrationUtils.newFullGcpConfig(bio.terra.buffer.integration.IntegrationUtils.newFullGcpConfig) NETWORK_LABEL_KEY(bio.terra.buffer.service.resource.flight.CreateProjectStep.NETWORK_LABEL_KEY) DEFAULT_NETWORK_NAME(bio.terra.buffer.service.resource.flight.GoogleUtils.DEFAULT_NETWORK_NAME) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) ResourceState(bio.terra.buffer.common.ResourceState) GetIamPolicyRequest(com.google.api.services.cloudresourcemanager.v3.model.GetIamPolicyRequest) ErrorStep(bio.terra.buffer.service.resource.flight.ErrorStep) RESTRICT_API_A_RECORD(bio.terra.buffer.service.resource.flight.CreateResourceRecordSetStep.RESTRICT_API_A_RECORD) IamCow(bio.terra.cloudres.google.iam.IamCow) IntegrationUtils.extractResourceIdFromFlightState(bio.terra.buffer.integration.IntegrationUtils.extractResourceIdFromFlightState) Binding(com.google.api.services.cloudresourcemanager.v3.model.Binding) Collectors(java.util.stream.Collectors) Test(org.junit.jupiter.api.Test) GCR_MANAGED_ZONE_TEMPLATE(bio.terra.buffer.service.resource.flight.CreateDnsZoneStep.GCR_MANAGED_ZONE_TEMPLATE) List(java.util.List) STORAGE_LOGS_IDENTITY(bio.terra.buffer.service.resource.flight.CreateStorageLogBucketStep.STORAGE_LOGS_IDENTITY) SubnetworkList(com.google.api.services.compute.model.SubnetworkList) GCR_A_RECORD(bio.terra.buffer.service.resource.flight.CreateResourceRecordSetStep.GCR_A_RECORD) CloudComputeCow(bio.terra.cloudres.google.compute.CloudComputeCow) ManagedZone(com.google.api.services.dns.model.ManagedZone) DENY_EGRESS(bio.terra.buffer.service.resource.flight.CreateFirewallRuleStep.DENY_EGRESS) DENY_EGRESS_LEONARDO_WORKER(bio.terra.buffer.service.resource.flight.CreateFirewallRuleStep.DENY_EGRESS_LEONARDO_WORKER) CreateProjectStep(bio.terra.buffer.service.resource.flight.CreateProjectStep) ALLOW_INGRESS_LEONARDO_SSL_NETWORK(bio.terra.buffer.service.resource.flight.CreateFirewallRuleStep.ALLOW_INGRESS_LEONARDO_SSL_NETWORK) ALLOW_INTERNAL_FOR_DEFAULT_NETWORK_RULE_NAME(bio.terra.buffer.service.resource.flight.CreateFirewallRuleStep.ALLOW_INTERNAL_FOR_DEFAULT_NETWORK_RULE_NAME) StairwayComponent(bio.terra.common.stairway.StairwayComponent) BufferDao(bio.terra.buffer.db.BufferDao) BaseIntegrationTest(bio.terra.buffer.common.BaseIntegrationTest) DENY_EGRESS_RULE_NAME(bio.terra.buffer.service.resource.flight.CreateFirewallRuleStep.DENY_EGRESS_RULE_NAME) StepResult(bio.terra.stairway.StepResult) QuotaOverride(com.google.api.services.serviceusage.v1beta1.model.QuotaOverride) Step(bio.terra.stairway.Step) ImmutableList(com.google.common.collect.ImmutableList) CONFIG_NAME_LABEL_KEY(bio.terra.buffer.service.resource.flight.CreateProjectStep.CONFIG_NAME_LABEL_KEY) FlightManager(bio.terra.buffer.service.resource.FlightManager) ServiceUsageCow(bio.terra.cloudres.google.serviceusage.ServiceUsageCow) DEFAULT_GATEWAY(bio.terra.buffer.service.resource.flight.CreateRouteStep.DEFAULT_GATEWAY) IntegrationUtils.pollUntilResourcesMatch(bio.terra.buffer.integration.IntegrationUtils.pollUntilResourcesMatch) UndoCreatingDbEntityStep(bio.terra.buffer.service.resource.flight.UndoCreatingDbEntityStep) ClientConfig(bio.terra.cloudres.common.ClientConfig) StorageRoles(com.google.cloud.storage.StorageRoles) Matchers(org.hamcrest.Matchers) ALLOW_EGRESS_PRIVATE_ACCESS_RULE_NAME(bio.terra.buffer.service.resource.flight.CreateFirewallRuleStep.ALLOW_EGRESS_PRIVATE_ACCESS_RULE_NAME) ApplicationContext(org.springframework.context.ApplicationContext) MANAGED_ZONE_NAME(bio.terra.buffer.service.resource.flight.GoogleUtils.MANAGED_ZONE_NAME) LatchStep(bio.terra.buffer.service.resource.flight.LatchStep) IAM_BINDINGS(bio.terra.buffer.integration.IntegrationUtils.IAM_BINDINGS) AssertResourceCreatingStep(bio.terra.buffer.service.resource.flight.AssertResourceCreatingStep) AutoConfigureMockMvc(org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc) ALLOW_EGRESS_LEONARDO_RULE_NAME(bio.terra.buffer.service.resource.flight.CreateFirewallRuleStep.ALLOW_EGRESS_LEONARDO_RULE_NAME) TransactionTemplate(org.springframework.transaction.support.TransactionTemplate) FlightStatus(bio.terra.stairway.FlightStatus) bio.terra.buffer.generated.model(bio.terra.buffer.generated.model) ALLOW_INTERNAL_FOR_VPC_NETWORK_RULE_NAME(bio.terra.buffer.service.resource.flight.CreateFirewallRuleStep.ALLOW_INTERNAL_FOR_VPC_NETWORK_RULE_NAME) RESOURCE_CONFIG(bio.terra.buffer.service.resource.FlightMapKeys.RESOURCE_CONFIG) ALLOW_EGRESS_PRIVATE_ACCESS(bio.terra.buffer.service.resource.flight.CreateFirewallRuleStep.ALLOW_EGRESS_PRIVATE_ACCESS) ManagedZone(com.google.api.services.dns.model.ManagedZone)

Aggregations

BaseIntegrationTest (bio.terra.buffer.common.BaseIntegrationTest)1 Pool (bio.terra.buffer.common.Pool)1 Resource (bio.terra.buffer.common.Resource)1 ResourceId (bio.terra.buffer.common.ResourceId)1 ResourceState (bio.terra.buffer.common.ResourceState)1 BufferDao (bio.terra.buffer.db.BufferDao)1 bio.terra.buffer.generated.model (bio.terra.buffer.generated.model)1 IAM_BINDINGS (bio.terra.buffer.integration.IntegrationUtils.IAM_BINDINGS)1 StubSubmissionFlightFactory (bio.terra.buffer.integration.IntegrationUtils.StubSubmissionFlightFactory)1 TEST_CONFIG_NAME (bio.terra.buffer.integration.IntegrationUtils.TEST_CONFIG_NAME)1 IntegrationUtils.blockUntilFlightComplete (bio.terra.buffer.integration.IntegrationUtils.blockUntilFlightComplete)1 IntegrationUtils.extractResourceIdFromFlightState (bio.terra.buffer.integration.IntegrationUtils.extractResourceIdFromFlightState)1 IntegrationUtils.newBasicGcpConfig (bio.terra.buffer.integration.IntegrationUtils.newBasicGcpConfig)1 IntegrationUtils.newFullGcpConfig (bio.terra.buffer.integration.IntegrationUtils.newFullGcpConfig)1 IntegrationUtils.pollUntilResourcesMatch (bio.terra.buffer.integration.IntegrationUtils.pollUntilResourcesMatch)1 IntegrationUtils.preparePool (bio.terra.buffer.integration.IntegrationUtils.preparePool)1 FlightManager (bio.terra.buffer.service.resource.FlightManager)1 RESOURCE_CONFIG (bio.terra.buffer.service.resource.FlightMapKeys.RESOURCE_CONFIG)1 FlightSubmissionFactoryImpl (bio.terra.buffer.service.resource.FlightSubmissionFactoryImpl)1 AssertResourceCreatingStep (bio.terra.buffer.service.resource.flight.AssertResourceCreatingStep)1