@@ -1945,3 +1945,79 @@ func TestSetResource_SQS_Queue_GetAttributes(t *testing.T) {
19451945 code .SetResourceGetAttributes (crd .Config (), crd , "resp" , "ko" , 1 ),
19461946 )
19471947}
1948+
1949+ func TestSetResource_RDS_DBSubnetGroup_ReadMany (t * testing.T ) {
1950+ assert := assert .New (t )
1951+ require := require .New (t )
1952+
1953+ g := testutil .NewGeneratorForService (t , "rds" )
1954+
1955+ crd := testutil .GetCRDByName (t , g , "DBSubnetGroup" )
1956+ require .NotNil (crd )
1957+
1958+ // There are renamed fields for Name and Description in order to
1959+ // "de-stutter" the field names. We want to verify that the SetResource for
1960+ // the DescribeDBSubnetGroups API operation sets these fields in the Spec
1961+ // properly
1962+ expected := `
1963+ found := false
1964+ for _, elem := range resp.DBSubnetGroups {
1965+ if elem.DBSubnetGroupArn != nil {
1966+ if ko.Status.ACKResourceMetadata == nil {
1967+ ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{}
1968+ }
1969+ tmpARN := ackv1alpha1.AWSResourceName(*elem.DBSubnetGroupArn)
1970+ ko.Status.ACKResourceMetadata.ARN = &tmpARN
1971+ }
1972+ if elem.DBSubnetGroupDescription != nil {
1973+ ko.Spec.Description = elem.DBSubnetGroupDescription
1974+ }
1975+ if elem.DBSubnetGroupName != nil {
1976+ ko.Spec.Name = elem.DBSubnetGroupName
1977+ }
1978+ if elem.SubnetGroupStatus != nil {
1979+ ko.Status.SubnetGroupStatus = elem.SubnetGroupStatus
1980+ }
1981+ if elem.Subnets != nil {
1982+ f4 := []*svcapitypes.Subnet{}
1983+ for _, f4iter := range elem.Subnets {
1984+ f4elem := &svcapitypes.Subnet{}
1985+ if f4iter.SubnetAvailabilityZone != nil {
1986+ f4elemf0 := &svcapitypes.AvailabilityZone{}
1987+ if f4iter.SubnetAvailabilityZone.Name != nil {
1988+ f4elemf0.Name = f4iter.SubnetAvailabilityZone.Name
1989+ }
1990+ f4elem.SubnetAvailabilityZone = f4elemf0
1991+ }
1992+ if f4iter.SubnetIdentifier != nil {
1993+ f4elem.SubnetIdentifier = f4iter.SubnetIdentifier
1994+ }
1995+ if f4iter.SubnetOutpost != nil {
1996+ f4elemf2 := &svcapitypes.Outpost{}
1997+ if f4iter.SubnetOutpost.Arn != nil {
1998+ f4elemf2.ARN = f4iter.SubnetOutpost.Arn
1999+ }
2000+ f4elem.SubnetOutpost = f4elemf2
2001+ }
2002+ if f4iter.SubnetStatus != nil {
2003+ f4elem.SubnetStatus = f4iter.SubnetStatus
2004+ }
2005+ f4 = append(f4, f4elem)
2006+ }
2007+ ko.Status.Subnets = f4
2008+ }
2009+ if elem.VpcId != nil {
2010+ ko.Status.VPCID = elem.VpcId
2011+ }
2012+ found = true
2013+ break
2014+ }
2015+ if !found {
2016+ return nil, ackerr.NotFound
2017+ }
2018+ `
2019+ assert .Equal (
2020+ expected ,
2021+ code .SetResource (crd .Config (), crd , model .OpTypeList , "resp" , "ko" , 1 , false ),
2022+ )
2023+ }
0 commit comments