kevinjqliu commented on code in PR #8:
URL: https://github.com/apache/iceberg-terraform/pull/8#discussion_r2680843012


##########
internal/provider/resource_namespace.go:
##########
@@ -0,0 +1,289 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package provider
+
+import (
+       "context"
+       "errors"
+       "strings"
+
+       "github.com/apache/iceberg-go"
+       "github.com/apache/iceberg-go/catalog"
+       "github.com/hashicorp/terraform-plugin-framework/resource"
+       "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+       
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+       
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+       "github.com/hashicorp/terraform-plugin-framework/types"
+       "github.com/hashicorp/terraform-plugin-log/tflog"
+)
+
+var (
+       _ resource.Resource = &icebergNamespaceResource{}
+)
+
+func NewNamespaceResource() resource.Resource {
+       return &icebergNamespaceResource{}
+}
+
+type icebergNamespaceResourceModel struct {
+       ID             types.String `tfsdk:"id"`
+       Name           types.List   `tfsdk:"name"`
+       Description    types.String `tfsdk:"description"`
+       FullProperties types.Map    `tfsdk:"full_properties"`
+}
+
+type icebergNamespaceResource struct {
+       catalog catalog.Catalog
+}
+
+func (r *icebergNamespaceResource) Metadata(_ context.Context, req 
resource.MetadataRequest, resp *resource.MetadataResponse) {
+       resp.TypeName = req.ProviderTypeName + "_namespace"
+}
+
+func (r *icebergNamespaceResource) Schema(_ context.Context, _ 
resource.SchemaRequest, resp *resource.SchemaResponse) {
+       resp.Schema = schema.Schema{
+               Description: "A resource for managing Iceberg namespaces.",
+               Attributes: map[string]schema.Attribute{
+                       "id": schema.StringAttribute{
+                               Computed: true,
+                               PlanModifiers: []planmodifier.String{
+                                       stringplanmodifier.UseStateForUnknown(),
+                               },
+                       },
+                       "name": schema.ListAttribute{
+                               Description: "The name of the namespace.",
+                               Required:    true,
+                               ElementType: types.StringType,
+                       },
+                       "description": schema.StringAttribute{
+                               Description: "A description for the namespace.",
+                               Optional:    true,
+                       },
+                       // full_properties includes properties on the namespace 
set by the IRC.
+                       // User-settable properties should be individually 
added to the list of Attributes above.

Review Comment:
   The create namespace api allows for user provided properties
   
https://github.com/apache/iceberg/blob/b7d9817cc97fb7b3c11bd105a91f1550b05dc63e/open-api/rest-catalog-open-api.yaml#L2054-L2067
   
   Is that allowed here? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to