DaanHoogland commented on code in PR #197:
URL: 
https://github.com/apache/cloudstack-terraform-provider/pull/197#discussion_r2329767108


##########
cloudstack/resource_cloudstack_limits.go:
##########
@@ -0,0 +1,471 @@
+// 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 cloudstack
+
+import (
+       "context"
+       "fmt"
+       "log"
+       "strconv"
+       "strings"
+
+       "github.com/apache/cloudstack-go/v2/cloudstack"
+       "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+       "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
+)
+
+// resourceTypeMap maps string resource types to their integer values
+var resourceTypeMap = map[string]int{
+       "instance":         0,
+       "ip":               1,
+       "volume":           2,
+       "snapshot":         3,
+       "template":         4,
+       "project":          5,
+       "network":          6,
+       "vpc":              7,
+       "cpu":              8,
+       "memory":           9,
+       "primarystorage":   10,
+       "secondarystorage": 11,
+}
+
+func resourceCloudStackLimits() *schema.Resource {
+       return &schema.Resource{
+               Read:   resourceCloudStackLimitsRead,
+               Update: resourceCloudStackLimitsUpdate,
+               Create: resourceCloudStackLimitsCreate,
+               Delete: resourceCloudStackLimitsDelete,
+               Schema: map[string]*schema.Schema{
+                       "type": {
+                               Type:     schema.TypeString,
+                               Required: true,
+                               ForceNew: true,
+                               ValidateFunc: validation.StringInSlice([]string{
+                                       "instance", "ip", "volume", "snapshot", 
"template", "project", "network", "vpc",
+                                       "cpu", "memory", "primarystorage", 
"secondarystorage",
+                               }, false), // false disables case-insensitive 
matching
+                               Description: "The type of resource to update 
the limits. Available types are: " +
+                                       "instance, ip, volume, snapshot, 
template, project, network, vpc, cpu, memory, " +
+                                       "primarystorage, secondarystorage",
+                       },
+                       "account": {
+                               Type:        schema.TypeString,
+                               Optional:    true,
+                               ForceNew:    true,
+                               Description: "Update resource for a specified 
account. Must be used with the domain_id parameter.",
+                       },
+                       "domain_id": {
+                               Type:        schema.TypeString,
+                               Optional:    true,
+                               ForceNew:    true,
+                               Description: "Update resource limits for all 
accounts in specified domain. If used with the account parameter, updates 
resource limits for a specified account in specified domain.",
+                       },
+                       "max": {
+                               Type:        schema.TypeInt,
+                               Optional:    true,
+                               Description: "Maximum resource limit. Use -1 
for unlimited resource limit. A value of 0 means zero resources are allowed, 
though the CloudStack API may return -1 for a limit set to 0.",
+                       },
+                       "configured_max": {
+                               Type:        schema.TypeInt,
+                               Computed:    true,
+                               Description: "Internal field to track the 
originally configured max value to distinguish between 0 and -1 when CloudStack 
returns -1.",
+                       },
+                       "projectid": {

Review Comment:
   see 
https://github.com/apache/cloudstack-terraform-provider/pull/197#discussion_r2329766002



-- 
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: dev-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to