Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vpc): add data annotation to vpc (backport #4534) #4535

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ static SecurityGroup findById(MortService mortService, String securityGroupId) {
}
}

@Data
class VPC {
String id;
String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import retrofit.converter.JacksonConverter
import retrofit.mime.TypedInput
import spock.lang.Specification
import spock.lang.Unroll
import com.netflix.spinnaker.orca.jackson.OrcaObjectMapper

import static com.netflix.spinnaker.orca.clouddriver.MortService.SecurityGroup.SecurityGroupIngress
import static com.netflix.spinnaker.orca.clouddriver.MortService.SecurityGroup.applyMappings
Expand Down Expand Up @@ -254,6 +255,28 @@ class MortServiceSpec extends Specification {
)
}

def "should correctly map VPC properties from JSON response"() {
given:
def objectMapper = OrcaObjectMapper.newInstance()
def vpcResponse = """
{
"account": "test",
"id": "vpc-12345",
"name": "vpc1",
"region": "us-west-1"
}
"""

when:
def vpc = objectMapper.readValue(vpcResponse, MortService.VPC.class)

then:
vpc.account == "test"
vpc.id == "vpc-12345"
vpc.region == "us-west-1"
vpc.name == "vpc1"
}

static class MockTypedInput implements TypedInput {
private final Converter converter
private final Object body
Expand Down
Loading