Search in sources :

Example 1 with AzureNetworkSecurityGroup

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

the class ComputeRequestDataTest method serializeCreateNetworkSecurityGroup.

@Test
public void serializeCreateNetworkSecurityGroup() {
    CreateNetworkSecurityGroupRequestData createNetworkSecurityGroup = CreateNetworkSecurityGroupRequestData.builder().setName("my-nsg").setTenantId("my-tenant").setSubscriptionId("my-sub").setResourceGroupName("my-rg").setRegion(Region.US_EAST).setRules(ImmutableList.of("rule1", "rule2")).build();
    assertEquals(ComputeManagerOperation.AZURE_CREATE_NETWORK_SECURITY_GROUP, createNetworkSecurityGroup.cloudOperation());
    assertEquals("{\"tenantId\":\"my-tenant\",\"subscriptionId\":\"my-sub\",\"resourceGroupName\":\"my-rg\"," + "\"name\":\"my-nsg\",\"region\":\"eastus\"," + "\"rules\":[\"rule1\",\"rule2\"]}", createNetworkSecurityGroup.serialize().toString());
    assertEquals(Optional.of(new CloudResourceUid().azureNetworkSecurityGroup(new AzureNetworkSecurityGroup().resourceGroup(azureResourceGroup(createNetworkSecurityGroup)).networkSecurityGroupName("my-nsg"))), createNetworkSecurityGroup.resourceUidCreation());
}
Also used : CloudResourceUid(bio.terra.janitor.model.CloudResourceUid) CreateNetworkSecurityGroupRequestData(bio.terra.cloudres.azure.resourcemanager.compute.data.CreateNetworkSecurityGroupRequestData) AzureNetworkSecurityGroup(bio.terra.janitor.model.AzureNetworkSecurityGroup) Test(org.junit.jupiter.api.Test)

Aggregations

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