1- //Copyright © 2025, Oracle and/or its affiliates. All rights reserved.
1+ //Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
22
33package odb
44
55import (
66 "context"
77 "github.com/aws/aws-sdk-go-v2/service/odb"
88 odbtypes "github.com/aws/aws-sdk-go-v2/service/odb/types"
9- "github.com/hashicorp/terraform-plugin-framework/attr "
9+ "github.com/hashicorp/terraform-plugin-framework-timetypes/timetypes "
1010 "github.com/hashicorp/terraform-plugin-framework/datasource"
1111 "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
1212 "github.com/hashicorp/terraform-plugin-framework/types"
@@ -16,11 +16,11 @@ import (
1616 fwtypes "github.com/hashicorp/terraform-provider-aws/internal/framework/types"
1717 tftags "github.com/hashicorp/terraform-provider-aws/internal/tags"
1818 "github.com/hashicorp/terraform-provider-aws/names"
19- "time"
2019)
2120
2221// Function annotations are used for datasource registration to the Provider. DO NOT EDIT.
2322// @FrameworkDataSource("aws_odb_network", name="Network")
23+ // @Tags(identifierAttribute="arn")
2424func newDataSourceNetwork (context.Context ) (datasource.DataSourceWithConfigure , error ) {
2525 return & dataSourceNetwork {}, nil
2626}
@@ -33,8 +33,6 @@ type dataSourceNetwork struct {
3333 framework.DataSourceWithModel [odbNetworkDataSourceModel ]
3434}
3535
36- var OdbNetworkDataSource dataSourceNetwork
37-
3836func (d * dataSourceNetwork ) Schema (ctx context.Context , req datasource.SchemaRequest , resp * datasource.SchemaResponse ) {
3937 statusType := fwtypes .StringEnumType [odbtypes.ResourceStatus ]()
4038 resp .Schema = schema.Schema {
@@ -112,61 +110,19 @@ func (d *dataSourceNetwork) Schema(ctx context.Context, req datasource.SchemaReq
112110 },
113111 "created_at" : schema.StringAttribute {
114112 Computed : true ,
113+ CustomType : timetypes.RFC3339Type {},
115114 Description : "The date and time when the ODB network was created." ,
116115 },
117- "managed_services" : schema.ObjectAttribute {
116+ "managed_services" : schema.ListAttribute {
118117 Computed : true ,
119- CustomType : fwtypes.NewObjectTypeOf [odbNetworkManagedServicesDataSourceModel ](ctx ),
118+ CustomType : fwtypes.NewListNestedObjectTypeOf [odbNetworkManagedServicesDataSourceModel ](ctx ),
120119 Description : "The managed services configuration for the ODB network." ,
121- AttributeTypes : map [string ]attr.Type {
122- "service_network_arn" : types .StringType ,
123- "resource_gateway_arn" : types .StringType ,
124- "managed_service_ipv4_cidrs" : types.ListType {
125- ElemType : types .StringType ,
126- },
127- "service_network_endpoint" : types.ObjectType {
128- AttrTypes : map [string ]attr.Type {
129- "vpc_endpoint_id" : types .StringType ,
130- "vpc_endpoint_type" : fwtypes .StringEnumType [odbtypes.VpcEndpointType ](),
131- },
132- },
133- "managed_s3_backup_access" : types.ObjectType {
134- AttrTypes : map [string ]attr.Type {
135- "status" : fwtypes .StringEnumType [odbtypes.ResourceStatus ](),
136- "ipv4_addresses" : types.ListType {
137- ElemType : types .StringType ,
138- },
139- },
140- },
141- "zero_tl_access" : types.ObjectType {
142- AttrTypes : map [string ]attr.Type {
143- "status" : fwtypes .StringEnumType [odbtypes.ManagedResourceStatus ](),
144- "cidr" : types .StringType ,
145- },
146- },
147- "s3_access" : types.ObjectType {
148- AttrTypes : map [string ]attr.Type {
149- "status" : fwtypes .StringEnumType [odbtypes.ManagedResourceStatus ](),
150- "ipv4_addresses" : types.ListType {
151- ElemType : types .StringType ,
152- },
153- "domain_name" : types .StringType ,
154- "s3_policy_document" : types .StringType ,
155- },
156- },
157- },
158120 },
159121 names .AttrTags : tftags .TagsAttributeComputedOnly (),
160122 "oci_dns_forwarding_configs" : schema.ListAttribute {
161123 Computed : true ,
162- Description : "The DNS resolver endpoint in OCI for forwarding DNS queries for the ociPrivateZone domain." ,
163124 CustomType : fwtypes.NewListNestedObjectTypeOf [odbNwkOciDnsForwardingConfigDataSourceModel ](ctx ),
164- ElementType : types.ObjectType {
165- AttrTypes : map [string ]attr.Type {
166- "domain_name" : types .StringType ,
167- "oci_dns_listener_ip" : types .StringType ,
168- },
169- },
125+ Description : "The DNS resolver endpoint in OCI for forwarding DNS queries for the ociPrivateZone domain." ,
170126 },
171127 },
172128 }
@@ -192,13 +148,10 @@ func (d *dataSourceNetwork) Read(ctx context.Context, req datasource.ReadRequest
192148 )
193149 return
194150 }
195-
196- data .CreatedAt = types .StringValue (out .OdbNetwork .CreatedAt .Format (time .RFC3339 ))
197- resp .Diagnostics .Append (flex .Flatten (ctx , out .OdbNetwork , & data , flex .WithIgnoredFieldNamesAppend ("CreatedAt" ))... )
151+ resp .Diagnostics .Append (flex .Flatten (ctx , out .OdbNetwork , & data )... )
198152 if resp .Diagnostics .HasError () {
199153 return
200154 }
201-
202155 resp .Diagnostics .Append (resp .State .Set (ctx , & data )... )
203156}
204157
@@ -223,8 +176,8 @@ type odbNetworkDataSourceModel struct {
223176 PercentProgress types.Float64 `tfsdk:"percent_progress"`
224177 Status fwtypes.StringEnum [odbtypes.ResourceStatus ] `tfsdk:"status"`
225178 StatusReason types.String `tfsdk:"status_reason"`
226- CreatedAt types. String `tfsdk:"created_at"`
227- ManagedServices fwtypes.ObjectValueOf [odbNetworkManagedServicesDataSourceModel ] `tfsdk:"managed_services"`
179+ CreatedAt timetypes. RFC3339 `tfsdk:"created_at"`
180+ ManagedServices fwtypes.ListNestedObjectValueOf [odbNetworkManagedServicesDataSourceModel ] `tfsdk:"managed_services"`
228181 Tags tftags.Map `tfsdk:"tags"`
229182}
230183
@@ -234,13 +187,13 @@ type odbNwkOciDnsForwardingConfigDataSourceModel struct {
234187}
235188
236189type odbNetworkManagedServicesDataSourceModel struct {
237- ServiceNetworkArn types.String `tfsdk:"service_network_arn"`
238- ResourceGatewayArn types.String `tfsdk:"resource_gateway_arn"`
239- ManagedServicesIpv4Cidrs fwtypes.ListOfString `tfsdk:"managed_service_ipv4_cidrs"`
240- ServiceNetworkEndpoint fwtypes.ObjectValueOf [serviceNetworkEndpointOdbNetworkDataSourceModel ] `tfsdk:"service_network_endpoint"`
241- ManagedS3BackupAccess fwtypes.ObjectValueOf [managedS3BackupAccessOdbNetworkDataSourceModel ] `tfsdk:"managed_s3_backup_access"`
242- ZeroEtlAccess fwtypes.ObjectValueOf [zeroEtlAccessOdbNetworkDataSourceModel ] `tfsdk:"zero_tl_access"`
243- S3Access fwtypes.ObjectValueOf [s3AccessOdbNetworkDataSourceModel ] `tfsdk:"s3_access"`
190+ ServiceNetworkArn types.String `tfsdk:"service_network_arn"`
191+ ResourceGatewayArn types.String `tfsdk:"resource_gateway_arn"`
192+ ManagedServicesIpv4Cidrs fwtypes.ListOfString `tfsdk:"managed_service_ipv4_cidrs"`
193+ ServiceNetworkEndpoint fwtypes.ListNestedObjectValueOf [serviceNetworkEndpointOdbNetworkDataSourceModel ] `tfsdk:"service_network_endpoint"`
194+ ManagedS3BackupAccess fwtypes.ListNestedObjectValueOf [managedS3BackupAccessOdbNetworkDataSourceModel ] `tfsdk:"managed_s3_backup_access"`
195+ ZeroEtlAccess fwtypes.ListNestedObjectValueOf [zeroEtlAccessOdbNetworkDataSourceModel ] `tfsdk:"zero_tl_access"`
196+ S3Access fwtypes.ListNestedObjectValueOf [s3AccessOdbNetworkDataSourceModel ] `tfsdk:"s3_access"`
244197}
245198
246199type serviceNetworkEndpointOdbNetworkDataSourceModel struct {
0 commit comments