@Test public void translateFromReadResponse_withLoggingConfig() { software.amazon.awssdk.services.cloudformation.model.LoggingConfig loggingConfig = software.amazon.awssdk.services.cloudformation.model.LoggingConfig.builder() .logGroupName("my-group") .logRoleArn("arn:aws:iam::123456789012:role/LoggingRole") .build(); DescribeTypeResponse response = DescribeTypeResponse.builder() .arn("arn:aws:cloudformation:us-west-2:123456789012:type/resource/AWS-Test-Resource/00000003") .description("some resource") .documentationUrl("https: .executionRoleArn("arn:aws:iam::123456789012:role/AppRole") .loggingConfig(loggingConfig) .provisioningType(ProvisioningType.FULLY_MUTABLE) .schema("{ schema }") .sourceUrl("https: .type(RegistryType.RESOURCE) .typeName("AWS::Test::Resource") .visibility(Visibility.PRIVATE) .defaultVersionId("1") .build(); ResourceModel model = Translator.translateFromReadResponse(response); assertThat(model.getIsDefaultVersion()).isEqualTo(response.isDefaultVersion()); assertThat(model.getDescription()).isEqualTo(response.description()); assertThat(model.getDocumentationUrl()).isEqualTo(response.documentationUrl()); assertThat(model.getExecutionRoleArn()).isEqualTo(response.executionRoleArn()); assertThat(model.getProvisioningType()).isEqualTo(response.provisioningTypeAsString()); assertThat(model.getSchema()).isEqualTo(response.schema()); assertThat(model.getSourceUrl()).isEqualTo(response.sourceUrl()); assertThat(model.getTypeName()).isEqualTo(response.typeName()); assertThat(model.getVisibility()).isEqualTo(response.visibilityAsString()); assertThat(model.getLastUpdated()).isNull(); assertThat(model.getTimeCreated()).isNull(); assertThat(model.getLoggingConfig().getLogGroupName()).isEqualTo(loggingConfig.logGroupName()); assertThat(model.getLoggingConfig().getLogRoleArn()).isEqualTo(loggingConfig.logRoleArn()); }
static ResourceModel translateFromReadResponse(@NonNull final DescribeTypeResponse awsResponse) { final ResourceModel.ResourceModelBuilder builder = ResourceModel.builder() .arn(awsResponse.arn()) .description(awsResponse.description()) .documentationUrl(awsResponse.documentationUrl()) .executionRoleArn(awsResponse.executionRoleArn()) .isDefaultVersion(awsResponse.isDefaultVersion()) .provisioningType(awsResponse.provisioningTypeAsString()) .schema(awsResponse.schema()) .sourceUrl(awsResponse.sourceUrl()) .typeName(awsResponse.typeName()) .versionId(awsResponse.arn().substring(awsResponse.arn().lastIndexOf('/') + 1)) .visibility(awsResponse.visibilityAsString()); if (awsResponse.lastUpdated() != null) { builder.lastUpdated(awsResponse.lastUpdated().toString()); } if (awsResponse.timeCreated() != null) { builder.timeCreated(awsResponse.timeCreated().toString()); } if (awsResponse.loggingConfig() != null) { builder.loggingConfig(translateFromSDK(awsResponse.loggingConfig())); } return builder.build(); }
Translator { static ResourceModel translateFromReadResponse(@NonNull final DescribeTypeResponse awsResponse) { final ResourceModel.ResourceModelBuilder builder = ResourceModel.builder() .arn(awsResponse.arn()) .description(awsResponse.description()) .documentationUrl(awsResponse.documentationUrl()) .executionRoleArn(awsResponse.executionRoleArn()) .isDefaultVersion(awsResponse.isDefaultVersion()) .provisioningType(awsResponse.provisioningTypeAsString()) .schema(awsResponse.schema()) .sourceUrl(awsResponse.sourceUrl()) .typeName(awsResponse.typeName()) .versionId(awsResponse.arn().substring(awsResponse.arn().lastIndexOf('/') + 1)) .visibility(awsResponse.visibilityAsString()); if (awsResponse.lastUpdated() != null) { builder.lastUpdated(awsResponse.lastUpdated().toString()); } if (awsResponse.timeCreated() != null) { builder.timeCreated(awsResponse.timeCreated().toString()); } if (awsResponse.loggingConfig() != null) { builder.loggingConfig(translateFromSDK(awsResponse.loggingConfig())); } return builder.build(); } }
Translator { static ResourceModel translateFromReadResponse(@NonNull final DescribeTypeResponse awsResponse) { final ResourceModel.ResourceModelBuilder builder = ResourceModel.builder() .arn(awsResponse.arn()) .description(awsResponse.description()) .documentationUrl(awsResponse.documentationUrl()) .executionRoleArn(awsResponse.executionRoleArn()) .isDefaultVersion(awsResponse.isDefaultVersion()) .provisioningType(awsResponse.provisioningTypeAsString()) .schema(awsResponse.schema()) .sourceUrl(awsResponse.sourceUrl()) .typeName(awsResponse.typeName()) .versionId(awsResponse.arn().substring(awsResponse.arn().lastIndexOf('/') + 1)) .visibility(awsResponse.visibilityAsString()); if (awsResponse.lastUpdated() != null) { builder.lastUpdated(awsResponse.lastUpdated().toString()); } if (awsResponse.timeCreated() != null) { builder.timeCreated(awsResponse.timeCreated().toString()); } if (awsResponse.loggingConfig() != null) { builder.loggingConfig(translateFromSDK(awsResponse.loggingConfig())); } return builder.build(); }  }
Translator { static ResourceModel translateFromReadResponse(@NonNull final DescribeTypeResponse awsResponse) { final ResourceModel.ResourceModelBuilder builder = ResourceModel.builder() .arn(awsResponse.arn()) .description(awsResponse.description()) .documentationUrl(awsResponse.documentationUrl()) .executionRoleArn(awsResponse.executionRoleArn()) .isDefaultVersion(awsResponse.isDefaultVersion()) .provisioningType(awsResponse.provisioningTypeAsString()) .schema(awsResponse.schema()) .sourceUrl(awsResponse.sourceUrl()) .typeName(awsResponse.typeName()) .versionId(awsResponse.arn().substring(awsResponse.arn().lastIndexOf('/') + 1)) .visibility(awsResponse.visibilityAsString()); if (awsResponse.lastUpdated() != null) { builder.lastUpdated(awsResponse.lastUpdated().toString()); } if (awsResponse.timeCreated() != null) { builder.timeCreated(awsResponse.timeCreated().toString()); } if (awsResponse.loggingConfig() != null) { builder.loggingConfig(translateFromSDK(awsResponse.loggingConfig())); } return builder.build(); }   }
Translator { static ResourceModel translateFromReadResponse(@NonNull final DescribeTypeResponse awsResponse) { final ResourceModel.ResourceModelBuilder builder = ResourceModel.builder() .arn(awsResponse.arn()) .description(awsResponse.description()) .documentationUrl(awsResponse.documentationUrl()) .executionRoleArn(awsResponse.executionRoleArn()) .isDefaultVersion(awsResponse.isDefaultVersion()) .provisioningType(awsResponse.provisioningTypeAsString()) .schema(awsResponse.schema()) .sourceUrl(awsResponse.sourceUrl()) .typeName(awsResponse.typeName()) .versionId(awsResponse.arn().substring(awsResponse.arn().lastIndexOf('/') + 1)) .visibility(awsResponse.visibilityAsString()); if (awsResponse.lastUpdated() != null) { builder.lastUpdated(awsResponse.lastUpdated().toString()); } if (awsResponse.timeCreated() != null) { builder.timeCreated(awsResponse.timeCreated().toString()); } if (awsResponse.loggingConfig() != null) { builder.loggingConfig(translateFromSDK(awsResponse.loggingConfig())); } return builder.build(); }    }