Search in sources :

Example 1 with AzureNetwork

use of bio.terra.janitor.model.AzureNetwork in project terra-cloud-resource-lib by DataBiosphere.

the class ComputeRequestDataTest method serializeCreateNetwork.

@Test
public void serializeCreateNetwork() {
    CreateNetworkRequestData createNetwork = CreateNetworkRequestData.builder().setName("my-network").setTenantId("my-tenant").setSubscriptionId("my-sub").setResourceGroupName("my-rg").setRegion(Region.US_EAST).setAddressSpaceCidr("192.168.0.0/16").setSubnetName("my-subnet").setAddressPrefix("192.168.1.0/24").setNetworkSecurityGroup(mockNetworkSecurityGroup()).build();
    assertEquals(ComputeManagerOperation.AZURE_CREATE_NETWORK, createNetwork.cloudOperation());
    assertEquals("{\"tenantId\":\"my-tenant\",\"subscriptionId\":\"my-sub\",\"resourceGroupName\":\"my-rg\"," + "\"name\":\"my-network\",\"region\":\"eastus\"," + "\"addressSpaceCidr\":\"192.168.0.0/16\",\"subnetName\":\"my-subnet\"," + "\"addressPrefix\":\"192.168.1.0/24\",\"networkSecurityGroupName\":\"my-nsg\"}", createNetwork.serialize().toString());
    assertEquals(Optional.of(new CloudResourceUid().azureNetwork(new AzureNetwork().resourceGroup(azureResourceGroup(createNetwork)).networkName("my-network"))), createNetwork.resourceUidCreation());
}
Also used : CloudResourceUid(bio.terra.janitor.model.CloudResourceUid) CreateNetworkRequestData(bio.terra.cloudres.azure.resourcemanager.compute.data.CreateNetworkRequestData) AzureNetwork(bio.terra.janitor.model.AzureNetwork) Test(org.junit.jupiter.api.Test)

Aggregations

CreateNetworkRequestData (bio.terra.cloudres.azure.resourcemanager.compute.data.CreateNetworkRequestData)1 AzureNetwork (bio.terra.janitor.model.AzureNetwork)1 CloudResourceUid (bio.terra.janitor.model.CloudResourceUid)1 Test (org.junit.jupiter.api.Test)1