From 00961aa3d7cdd079d74baaffbba47db9991f98cb Mon Sep 17 00:00:00 2001 From: Lachezar Tsonov Date: Fri, 29 Nov 2024 16:53:33 +0200 Subject: [PATCH 1/2] CSU-2476: Add NIC-based backend pools to AKS load balancer (#428) * Generate SDK * Add NIC based pools to node config --- castai/resource_node_configuration.go | 140 +++++--- castai/sdk/api.gen.go | 196 ++++++++++- castai/sdk/client.gen.go | 472 ++++++++++++++++++++++++++ castai/sdk/mock/client.go | 175 ++++++++++ docs/resources/node_configuration.md | 17 +- 5 files changed, 949 insertions(+), 51 deletions(-) diff --git a/castai/resource_node_configuration.go b/castai/resource_node_configuration.go index 5a4a45ba..d339add8 100644 --- a/castai/resource_node_configuration.go +++ b/castai/resource_node_configuration.go @@ -21,26 +21,28 @@ import ( ) const ( - FieldNodeConfigurationName = "name" - FieldNodeConfigurationDiskCpuRatio = "disk_cpu_ratio" - FieldNodeConfigurationMinDiskSize = "min_disk_size" - FieldNodeConfigurationDrainTimeoutSec = "drain_timeout_sec" - FieldNodeConfigurationSubnets = "subnets" - FieldNodeConfigurationSSHPublicKey = "ssh_public_key" - FieldNodeConfigurationImage = "image" - FieldNodeConfigurationTags = "tags" - FieldNodeConfigurationInitScript = "init_script" - FieldNodeConfigurationContainerRuntime = "container_runtime" - FieldNodeConfigurationDockerConfig = "docker_config" - FieldNodeConfigurationKubeletConfig = "kubelet_config" - FieldNodeConfigurationAKS = "aks" - FieldNodeConfigurationEKS = "eks" - FieldNodeConfigurationKOPS = "kops" - FieldNodeConfigurationGKE = "gke" - FieldNodeConfigurationEKSTargetGroup = "target_group" - FieldNodeConfigurationAKSImageFamily = "aks_image_family" - FieldNodeConfigurationEKSImageFamily = "eks_image_family" - FieldNodeConfigurationLoadbalancers = "loadbalancers" + FieldNodeConfigurationName = "name" + FieldNodeConfigurationDiskCpuRatio = "disk_cpu_ratio" + FieldNodeConfigurationMinDiskSize = "min_disk_size" + FieldNodeConfigurationDrainTimeoutSec = "drain_timeout_sec" + FieldNodeConfigurationSubnets = "subnets" + FieldNodeConfigurationSSHPublicKey = "ssh_public_key" + FieldNodeConfigurationImage = "image" + FieldNodeConfigurationTags = "tags" + FieldNodeConfigurationInitScript = "init_script" + FieldNodeConfigurationContainerRuntime = "container_runtime" + FieldNodeConfigurationDockerConfig = "docker_config" + FieldNodeConfigurationKubeletConfig = "kubelet_config" + FieldNodeConfigurationAKS = "aks" + FieldNodeConfigurationEKS = "eks" + FieldNodeConfigurationKOPS = "kops" + FieldNodeConfigurationGKE = "gke" + FieldNodeConfigurationEKSTargetGroup = "target_group" + FieldNodeConfigurationAKSImageFamily = "aks_image_family" + FieldNodeConfigurationEKSImageFamily = "eks_image_family" + FieldNodeConfigurationLoadbalancers = "loadbalancers" + FieldNodeConfigurationAKSLoadbalancerIPPools = "ip_based_backend_pools" + FieldNodeConfigurationAKSLoadbalancerNICPools = "nic_based_backend_pools" ) const ( @@ -333,15 +335,21 @@ func resourceNodeConfiguration() *schema.Resource { FieldNodeConfigurationLoadbalancers: { Type: schema.TypeList, Optional: true, - Description: "Loadboalancer configuration for CAST provisioned nodes", + Description: "Load balancer configuration for CAST provisioned nodes", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Description: "The full ID of the load balancer in azure.", + Optional: true, // Can't make it required as it was added after `name` so it'd be a breaking change. + }, "name": { Type: schema.TypeString, - Required: true, - Description: "Name of loadbalancer", + Description: "Name of load balancer", + Optional: true, + Deprecated: "name field is deprecated, use ID instead. Will be removed in future versions.", }, - "ip_based_backend_pools": { + FieldNodeConfigurationAKSLoadbalancerIPPools: { Type: schema.TypeList, Optional: true, Description: "IP based backend pools configuration for CAST provisioned nodes", @@ -355,6 +363,20 @@ func resourceNodeConfiguration() *schema.Resource { }, }, }, + FieldNodeConfigurationAKSLoadbalancerNICPools: { + Type: schema.TypeList, + Optional: true, + Description: "NIC based backend pools configuration for CAST provisioned nodes.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + Description: "Name of the NIC based backend pool", + }, + }, + }, + }, }, }, }, @@ -981,12 +1003,19 @@ func toAksLoadBalancers(obj []interface{}) *[]sdk.NodeconfigV1AKSConfigLoadBalan for _, lbRaw := range obj { if lb, ok := lbRaw.(map[string]interface{}); ok { sdkLB := sdk.NodeconfigV1AKSConfigLoadBalancers{} + if id, ok := lb["id"].(string); ok && id != "" { + sdkLB.Id = lo.ToPtr(id) + } if name, ok := lb["name"].(string); ok && name != "" { + //nolint:staticcheck //We have to do this until we drop the field in TF major provider version. sdkLB.Name = lo.ToPtr(name) } - if ipBasedBackendPools, ok := lb["ip_based_backend_pools"].([]interface{}); ok && len(ipBasedBackendPools) > 0 { + if ipBasedBackendPools, ok := lb[FieldNodeConfigurationAKSLoadbalancerIPPools].([]interface{}); ok && len(ipBasedBackendPools) > 0 { sdkLB.IpBasedBackendPools = toAksIpBasedBackendPools(ipBasedBackendPools) } + if nicBasedBackendPools, ok := lb[FieldNodeConfigurationAKSLoadbalancerNICPools].([]interface{}); ok && len(nicBasedBackendPools) > 0 { + sdkLB.NicBasedBackendPools = toAksNICBasedBackendPools(nicBasedBackendPools) + } out = append(out, sdkLB) } } @@ -999,18 +1028,33 @@ func toAksIpBasedBackendPools(obj []interface{}) *[]sdk.NodeconfigV1AKSConfigLoa return nil } - out := make([]sdk.NodeconfigV1AKSConfigLoadBalancersIPBasedBackendPool, 0, len(obj)) - for _, poolRaw := range obj { + pools := lo.Map(extractAksBackendPoolNames(obj), func(name string, _ int) sdk.NodeconfigV1AKSConfigLoadBalancersIPBasedBackendPool { + return sdk.NodeconfigV1AKSConfigLoadBalancersIPBasedBackendPool{Name: lo.ToPtr(name)} + }) + return &pools +} + +func toAksNICBasedBackendPools(obj []any) *[]sdk.NodeconfigV1AKSConfigLoadBalancersNICBasedBackendPool { + if obj == nil { + return nil + } + + pools := lo.Map(extractAksBackendPoolNames(obj), func(name string, _ int) sdk.NodeconfigV1AKSConfigLoadBalancersNICBasedBackendPool { + return sdk.NodeconfigV1AKSConfigLoadBalancersNICBasedBackendPool{Name: lo.ToPtr(name)} + }) + return &pools +} + +func extractAksBackendPoolNames(pools []any) []string { + return lo.Reduce(pools, func(names []string, poolRaw any, _ int) []string { if pool, ok := poolRaw.(map[string]interface{}); ok { - sdkPool := sdk.NodeconfigV1AKSConfigLoadBalancersIPBasedBackendPool{} if name, ok := pool["name"].(string); ok && name != "" { - sdkPool.Name = lo.ToPtr(name) + names = append(names, name) } - out = append(out, sdkPool) } - } - return &out + return names + }, make([]string, 0)) } func toAKSOSDiskType(v string) *sdk.NodeconfigV1AKSConfigOsDiskType { @@ -1077,11 +1121,29 @@ func fromAksLoadBalancers(lbs []sdk.NodeconfigV1AKSConfigLoadBalancers) []map[st out := make([]map[string]interface{}, 0, len(lbs)) for _, lb := range lbs { m := map[string]interface{}{} + if lb.Id != nil { + m["id"] = *lb.Id + } + //nolint:staticcheck //We have to do this until we drop the field in TF major provider version. if lb.Name != nil { + //nolint:staticcheck //We have to do this until we drop the field in TF major provider version. m["name"] = *lb.Name } if lb.IpBasedBackendPools != nil && len(*lb.IpBasedBackendPools) > 0 { - m["ip_based_backend_pools"] = fromAksIpBasedBackendPools(*lb.IpBasedBackendPools) + m[FieldNodeConfigurationAKSLoadbalancerIPPools] = fromAksIpBasedBackendPoolNames(lo.FilterMap(*lb.IpBasedBackendPools, func(pool sdk.NodeconfigV1AKSConfigLoadBalancersIPBasedBackendPool, _ int) (string, bool) { + if pool.Name != nil { + return *pool.Name, true + } + return "", false + })) + } + if lb.NicBasedBackendPools != nil && len(*lb.NicBasedBackendPools) > 0 { + m[FieldNodeConfigurationAKSLoadbalancerNICPools] = fromAksIpBasedBackendPoolNames(lo.FilterMap(*lb.NicBasedBackendPools, func(pool sdk.NodeconfigV1AKSConfigLoadBalancersNICBasedBackendPool, _ int) (string, bool) { + if pool.Name != nil { + return *pool.Name, true + } + return "", false + })) } out = append(out, m) } @@ -1089,17 +1151,15 @@ func fromAksLoadBalancers(lbs []sdk.NodeconfigV1AKSConfigLoadBalancers) []map[st return out } -func fromAksIpBasedBackendPools(pools []sdk.NodeconfigV1AKSConfigLoadBalancersIPBasedBackendPool) []map[string]interface{} { - if pools == nil { +func fromAksIpBasedBackendPoolNames(names []string) []map[string]interface{} { + if names == nil { return nil } - out := make([]map[string]interface{}, 0, len(pools)) - for _, pool := range pools { + out := make([]map[string]interface{}, 0, len(names)) + for _, name := range names { m := map[string]interface{}{} - if pool.Name != nil { - m["name"] = *pool.Name - } + m["name"] = name out = append(out, m) } diff --git a/castai/sdk/api.gen.go b/castai/sdk/api.gen.go index b21e9005..87687d17 100644 --- a/castai/sdk/api.gen.go +++ b/castai/sdk/api.gen.go @@ -23,6 +23,28 @@ const ( CastaiEvictorV1LabelSelectorExpressionOperatorNotIn CastaiEvictorV1LabelSelectorExpressionOperator = "NotIn" ) +// Defines values for CastaiFeaturesV1EntityType. +const ( + ClusterId CastaiFeaturesV1EntityType = "clusterId" + Environment CastaiFeaturesV1EntityType = "environment" + OrganizationId CastaiFeaturesV1EntityType = "organizationId" + UserId CastaiFeaturesV1EntityType = "userId" +) + +// Defines values for CastaiFeaturesV1LogicalOperator. +const ( + And CastaiFeaturesV1LogicalOperator = "and" + LogicalUnspecified CastaiFeaturesV1LogicalOperator = "logical_unspecified" + Or CastaiFeaturesV1LogicalOperator = "or" +) + +// Defines values for CastaiFeaturesV1Operator. +const ( + Equals CastaiFeaturesV1Operator = "equals" + NotEquals CastaiFeaturesV1Operator = "not_equals" + OperatorUnspecified CastaiFeaturesV1Operator = "operator_unspecified" +) + // Defines values for CastaiInventoryV1beta1AttachableGPUDeviceManufacturer. const ( CastaiInventoryV1beta1AttachableGPUDeviceManufacturerAMD CastaiInventoryV1beta1AttachableGPUDeviceManufacturer = "AMD" @@ -333,6 +355,18 @@ const ( WorkloadoptimizationV1ResourcePoliciesFunctionQUANTILE WorkloadoptimizationV1ResourcePoliciesFunction = "QUANTILE" ) +// CommitmentsAPIBatchDeleteCommitmentsRequest defines model for CommitmentsAPI_BatchDeleteCommitments_request. +type CommitmentsAPIBatchDeleteCommitmentsRequest struct { + // IDs of commitments to delete. A maximum of 1000 commitments can be deleted in a batch. + CommitmentIds []string `json:"commitmentIds"` +} + +// CommitmentsAPIBatchUpdateCommitmentsRequest defines model for CommitmentsAPI_BatchUpdateCommitments_request. +type CommitmentsAPIBatchUpdateCommitmentsRequest struct { + // Commitments to update. A maximum of 1000 commitments can be modified in a batch. + Requests []CastaiInventoryV1beta1UpdateCommitmentRequest `json:"requests"` +} + // ExternalClusterAPIGKECreateSARequest defines model for ExternalClusterAPI_GKECreateSA_request. type ExternalClusterAPIGKECreateSARequest struct { // UpdateGKEClusterParams defines updatable GKE cluster configuration. @@ -471,6 +505,63 @@ type CastaiEvictorV1PodSelector struct { Namespace *string `json:"namespace,omitempty"` } +// Comparison represents a entity to entity ID comparison. +type CastaiFeaturesV1Comparison struct { + // The entity ID to compare against (e.g., "da7a9f8d-ed18-40c3-89a7-93a81283af62"). + EntityId *string `json:"entityId,omitempty"` + + // EntityType defines available entity types for feature flag enablement. + // + // - organizationId: Represents the main identifier(organization_id) for organization in Cast AI. + // - clusterId: Represents the main identifier(cluster_id) for cluster in Cast AI. + // - userId: Represents the user identifier(username) which is used to identify a user in users service. + // - environment: Represents the identifier which is used to identify an environment in Cast AI. + EntityType *CastaiFeaturesV1EntityType `json:"entityType,omitempty"` + + // Operator defines available operators for targeting rules. + // + // - operator_unspecified: unspecified operator. + // - equals: Represents the equals operator, ==. + // - not_equals: Represents the not equals operator, !=. + Operator *CastaiFeaturesV1Operator `json:"operator,omitempty"` +} + +// Represents a condition, which can be a comparison or a nested query. +type CastaiFeaturesV1Condition struct { + // Comparison represents a entity to entity ID comparison. + Comparison *CastaiFeaturesV1Comparison `json:"comparison,omitempty"` + + // QueryExpression represents a logical operation with conditions. + NestedQuery *CastaiFeaturesV1QueryExpression `json:"nestedQuery,omitempty"` +} + +// EntityType defines available entity types for feature flag enablement. +// +// - organizationId: Represents the main identifier(organization_id) for organization in Cast AI. +// - clusterId: Represents the main identifier(cluster_id) for cluster in Cast AI. +// - userId: Represents the user identifier(username) which is used to identify a user in users service. +// - environment: Represents the identifier which is used to identify an environment in Cast AI. +type CastaiFeaturesV1EntityType string + +// LogicalOperator defines available logical operators for targeting rules. +type CastaiFeaturesV1LogicalOperator string + +// Operator defines available operators for targeting rules. +// +// - operator_unspecified: unspecified operator. +// - equals: Represents the equals operator, ==. +// - not_equals: Represents the not equals operator, !=. +type CastaiFeaturesV1Operator string + +// QueryExpression represents a logical operation with conditions. +type CastaiFeaturesV1QueryExpression struct { + // Represents evaluation conditions. + Conditions []CastaiFeaturesV1Condition `json:"conditions"` + + // LogicalOperator defines available logical operators for targeting rules. + LogicalOperator CastaiFeaturesV1LogicalOperator `json:"logicalOperator"` +} + // CastaiInventoryV1beta1AddReservationResponse defines model for castai.inventory.v1beta1.AddReservationResponse. type CastaiInventoryV1beta1AddReservationResponse struct { Reservation *CastaiInventoryV1beta1ReservationDetails `json:"reservation,omitempty"` @@ -549,6 +640,11 @@ type CastaiInventoryV1beta1AzureReservationImport struct { Type *string `json:"type,omitempty"` } +// CastaiInventoryV1beta1BatchUpdateCommitmentsResponse defines model for castai.inventory.v1beta1.BatchUpdateCommitmentsResponse. +type CastaiInventoryV1beta1BatchUpdateCommitmentsResponse struct { + Commitments *[]CastaiInventoryV1beta1Commitment `json:"commitments,omitempty"` +} + // CPUPlatform describes the CPU platforms the instance type can be equipped with. type CastaiInventoryV1beta1CPUPlatform struct { // All Core Turbo Frequency (GHz). Only available for GCP. @@ -582,7 +678,10 @@ type CastaiInventoryV1beta1ClusterAggregatedUsage struct { // CastaiInventoryV1beta1Commitment defines model for castai.inventory.v1beta1.Commitment. type CastaiInventoryV1beta1Commitment struct { // Allowed usage specifies the part of the commitment that is allowed to be used. 1.0 means 100% of the commitment. Currently it's only supported for GCP CUDs. - AllowedUsage *float32 `json:"allowedUsage,omitempty"` + AllowedUsage *float32 `json:"allowedUsage,omitempty"` + + // Assign commitment to all existing and future clusters that fall within the region of this commitment. + AutoAssignment *bool `json:"autoAssignment,omitempty"` AzureReservationContext *CastaiInventoryV1beta1AzureReservation `json:"azureReservationContext,omitempty"` EndDate *time.Time `json:"endDate"` GcpResourceCudContext *CastaiInventoryV1beta1GCPResourceCUD `json:"gcpResourceCudContext,omitempty"` @@ -771,6 +870,12 @@ type CastaiInventoryV1beta1GetCommitmentResponse struct { Commitment *CastaiInventoryV1beta1Commitment `json:"commitment,omitempty"` } +// CastaiInventoryV1beta1GetCommitmentUsageHistoryResponse defines model for castai.inventory.v1beta1.GetCommitmentUsageHistoryResponse. +type CastaiInventoryV1beta1GetCommitmentUsageHistoryResponse struct { + Items *[]CastaiInventoryV1beta1UsageAtTime `json:"items,omitempty"` + Summary *CastaiInventoryV1beta1Usage `json:"summary,omitempty"` +} + // CastaiInventoryV1beta1GetCommitmentsAssignmentsResponse defines model for castai.inventory.v1beta1.GetCommitmentsAssignmentsResponse. type CastaiInventoryV1beta1GetCommitmentsAssignmentsResponse struct { CommitmentsAssignments *[]CastaiInventoryV1beta1CommitmentAssignment `json:"commitmentsAssignments,omitempty"` @@ -1109,8 +1214,11 @@ type CastaiInventoryV1beta1StorageInfoDeviceType string // CastaiInventoryV1beta1UpdateCommitmentInput defines model for castai.inventory.v1beta1.UpdateCommitmentInput. type CastaiInventoryV1beta1UpdateCommitmentInput struct { // Allowed usage specifies the part of the commitment that is allowed to be used. 1.0 means 100% of the commitment. Currently it's only supported for GCP CUDs. - AllowedUsage *float32 `json:"allowedUsage"` - Prioritization *bool `json:"prioritization"` + AllowedUsage *float32 `json:"allowedUsage"` + + // Assign commitment to all existing and future clusters that fall within the region of this commitment. + AutoAssignment *bool `json:"autoAssignment"` + Prioritization *bool `json:"prioritization"` // Scaling strategy specifies how to use commitment by autoscaler. // @@ -1125,11 +1233,33 @@ type CastaiInventoryV1beta1UpdateCommitmentInput struct { Status *CastaiInventoryV1beta1CommitmentStatus `json:"status,omitempty"` } +// CastaiInventoryV1beta1UpdateCommitmentRequest defines model for castai.inventory.v1beta1.UpdateCommitmentRequest. +type CastaiInventoryV1beta1UpdateCommitmentRequest struct { + Commitment *CastaiInventoryV1beta1UpdateCommitmentInput `json:"commitment,omitempty"` + CommitmentId string `json:"commitmentId"` +} + // CastaiInventoryV1beta1UpdateCommitmentResponse defines model for castai.inventory.v1beta1.UpdateCommitmentResponse. type CastaiInventoryV1beta1UpdateCommitmentResponse struct { Commitments *CastaiInventoryV1beta1Commitment `json:"commitments,omitempty"` } +// CastaiInventoryV1beta1Usage defines model for castai.inventory.v1beta1.Usage. +type CastaiInventoryV1beta1Usage struct { + CpuCommitted *float64 `json:"cpuCommitted,omitempty"` + CpuUsed *float64 `json:"cpuUsed,omitempty"` + CpuUsedPercent *float64 `json:"cpuUsedPercent,omitempty"` + MemoryCommittedMib *float64 `json:"memoryCommittedMib,omitempty"` + MemoryUsedMib *float64 `json:"memoryUsedMib,omitempty"` + MemoryUsedPercent *float64 `json:"memoryUsedPercent,omitempty"` +} + +// CastaiInventoryV1beta1UsageAtTime defines model for castai.inventory.v1beta1.UsageAtTime. +type CastaiInventoryV1beta1UsageAtTime struct { + Usage *CastaiInventoryV1beta1Usage `json:"usage,omitempty"` + UsageTime *time.Time `json:"usageTime,omitempty"` +} + // CastaiInventoryV1beta1UsageDistribution defines model for castai.inventory.v1beta1.UsageDistribution. type CastaiInventoryV1beta1UsageDistribution struct { Cpu *float64 `json:"cpu,omitempty"` @@ -1566,6 +1696,15 @@ type ExternalclusterV1AddNodeResponse struct { OperationId string `json:"operationId"` } +// AnywhereClusterParams defines Anywhere-specific arguments. +type ExternalclusterV1AnywhereClusterParams struct { + // Name of the cluster. + ClusterName *string `json:"clusterName,omitempty"` + + // NamespaceID as unique identifier for the cluster. + KubeSystemNamespaceId string `json:"kubeSystemNamespaceId"` +} + // CloudEvent represents a remote event that happened in the cloud, e.g. "node added". type ExternalclusterV1CloudEvent struct { // Event type. @@ -1595,6 +1734,9 @@ type ExternalclusterV1Cluster struct { // All available zones in cluster's region. AllRegionZones *[]ExternalclusterV1Zone `json:"allRegionZones,omitempty"` + // AnywhereClusterParams defines Anywhere-specific arguments. + Anywhere *ExternalclusterV1AnywhereClusterParams `json:"anywhere,omitempty"` + // User friendly unique cluster identifier. ClusterNameId *string `json:"clusterNameId,omitempty"` @@ -2104,6 +2246,9 @@ type ExternalclusterV1RegisterClusterRequest struct { // AKSClusterParams defines AKS-specific arguments. Aks *ExternalclusterV1AKSClusterParams `json:"aks,omitempty"` + // AnywhereClusterParams defines Anywhere-specific arguments. + Anywhere *ExternalclusterV1AnywhereClusterParams `json:"anywhere,omitempty"` + // EKSClusterParams defines EKS-specific arguments. Eks *ExternalclusterV1EKSClusterParams `json:"eks,omitempty"` @@ -2234,7 +2379,7 @@ type NodeconfigV1AKSConfig struct { // List of supported image families (OSes) for AKS. ImageFamily *NodeconfigV1AKSConfigImageFamily `json:"imageFamily,omitempty"` - // List of load balancers to be used for the cluster. + // List of load balancers to attach nodes to. Populating this field disables Cast's default load balancer autodiscovery mechanism. LoadBalancers *[]NodeconfigV1AKSConfigLoadBalancers `json:"loadBalancers,omitempty"` // Maximum number of pods that can be run on a node, which affects how many IP addresses you will need for each node. @@ -2251,15 +2396,31 @@ type NodeconfigV1AKSConfigImageFamily string // NodeconfigV1AKSConfigLoadBalancers defines model for nodeconfig.v1.AKSConfig.LoadBalancers. type NodeconfigV1AKSConfigLoadBalancers struct { - // List of backend pools to be used for the load balancer. + // The full ID of the load balancer in Azure. + // For backwards compatibility, the field is not required but it should be treated as required for any new clients. + Id *string `json:"id,omitempty"` + + // List of IP-based backend pools to attach each node's IP to. IpBasedBackendPools *[]NodeconfigV1AKSConfigLoadBalancersIPBasedBackendPool `json:"ipBasedBackendPools,omitempty"` - // Name of the load balancer. + // Deprecated: Use ID instead + // Name of the load balancer. It is assumed to reside in the cluster's infrastructure resource group. + // Only available for backwards compatibility and only accounted for in IP-based backend pools. Name *string `json:"name,omitempty"` + + // List of NIC-based backend pools to attach each node's NIC to. + NicBasedBackendPools *[]NodeconfigV1AKSConfigLoadBalancersNICBasedBackendPool `json:"nicBasedBackendPools,omitempty"` } // NodeconfigV1AKSConfigLoadBalancersIPBasedBackendPool defines model for nodeconfig.v1.AKSConfig.LoadBalancers.IPBasedBackendPool. type NodeconfigV1AKSConfigLoadBalancersIPBasedBackendPool struct { + // Name of the backend pool as defined in Azure. Backend pools must have unique names within the load balancer. + Name *string `json:"name,omitempty"` +} + +// NodeconfigV1AKSConfigLoadBalancersNICBasedBackendPool defines model for nodeconfig.v1.AKSConfig.LoadBalancers.NICBasedBackendPool. +type NodeconfigV1AKSConfigLoadBalancersNICBasedBackendPool struct { + // Name of the backend pool as defined in Azure. Backend pools must have unique names within the load balancer. Name *string `json:"name,omitempty"` } @@ -3643,6 +3804,7 @@ type WorkloadoptimizationV1RecommendedPodCountChangedEvent struct { type WorkloadoptimizationV1RecommendedRequestsChangedEvent struct { ApplyType WorkloadoptimizationV1ApplyType `json:"applyType"` Current WorkloadoptimizationV1RecommendedRequestsChangedEventChange `json:"current"` + DebugData *map[string]interface{} `json:"debugData,omitempty"` Previous WorkloadoptimizationV1RecommendedRequestsChangedEventChange `json:"previous"` } @@ -4038,6 +4200,22 @@ type WorkloadoptimizationV1WorkloadScalingPolicy struct { UpdatedAt time.Time `json:"updatedAt"` } +// CommitmentsAPIBatchDeleteCommitmentsJSONBody defines parameters for CommitmentsAPIBatchDeleteCommitments. +type CommitmentsAPIBatchDeleteCommitmentsJSONBody = CommitmentsAPIBatchDeleteCommitmentsRequest + +// CommitmentsAPIBatchUpdateCommitmentsJSONBody defines parameters for CommitmentsAPIBatchUpdateCommitments. +type CommitmentsAPIBatchUpdateCommitmentsJSONBody = CommitmentsAPIBatchUpdateCommitmentsRequest + +// CommitmentsAPIGetCommitmentUsageHistoryParams defines parameters for CommitmentsAPIGetCommitmentUsageHistory. +type CommitmentsAPIGetCommitmentUsageHistoryParams struct { + StartTime time.Time `form:"startTime" json:"startTime"` + EndTime time.Time `form:"endTime" json:"endTime"` + AggregationInterval CommitmentsAPIGetCommitmentUsageHistoryParamsAggregationInterval `form:"aggregationInterval" json:"aggregationInterval"` +} + +// CommitmentsAPIGetCommitmentUsageHistoryParamsAggregationInterval defines parameters for CommitmentsAPIGetCommitmentUsageHistory. +type CommitmentsAPIGetCommitmentUsageHistoryParamsAggregationInterval string + // AuthTokenAPIListAuthTokensParams defines parameters for AuthTokenAPIListAuthTokens. type AuthTokenAPIListAuthTokensParams struct { // User id to filter by, if this is set we will only return tokens that have this user id. @@ -4394,6 +4572,12 @@ type InventoryAPIListZonesParams struct { // WorkloadOptimizationAPIUpdateWorkloadV2JSONBody defines parameters for WorkloadOptimizationAPIUpdateWorkloadV2. type WorkloadOptimizationAPIUpdateWorkloadV2JSONBody = WorkloadoptimizationV1UpdateWorkloadV2 +// CommitmentsAPIBatchDeleteCommitmentsJSONRequestBody defines body for CommitmentsAPIBatchDeleteCommitments for application/json ContentType. +type CommitmentsAPIBatchDeleteCommitmentsJSONRequestBody = CommitmentsAPIBatchDeleteCommitmentsJSONBody + +// CommitmentsAPIBatchUpdateCommitmentsJSONRequestBody defines body for CommitmentsAPIBatchUpdateCommitments for application/json ContentType. +type CommitmentsAPIBatchUpdateCommitmentsJSONRequestBody = CommitmentsAPIBatchUpdateCommitmentsJSONBody + // AuthTokenAPICreateAuthTokenJSONRequestBody defines body for AuthTokenAPICreateAuthToken for application/json ContentType. type AuthTokenAPICreateAuthTokenJSONRequestBody = AuthTokenAPICreateAuthTokenJSONBody diff --git a/castai/sdk/client.gen.go b/castai/sdk/client.gen.go index d4cb5ab9..2585659b 100644 --- a/castai/sdk/client.gen.go +++ b/castai/sdk/client.gen.go @@ -90,6 +90,19 @@ func WithRequestEditorFn(fn RequestEditorFn) ClientOption { // The interface specification for the client above. type ClientInterface interface { + // CommitmentsAPIBatchDeleteCommitments request with any body + CommitmentsAPIBatchDeleteCommitmentsWithBody(ctx context.Context, organizationId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + CommitmentsAPIBatchDeleteCommitments(ctx context.Context, organizationId string, body CommitmentsAPIBatchDeleteCommitmentsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // CommitmentsAPIBatchUpdateCommitments request with any body + CommitmentsAPIBatchUpdateCommitmentsWithBody(ctx context.Context, organizationId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + CommitmentsAPIBatchUpdateCommitments(ctx context.Context, organizationId string, body CommitmentsAPIBatchUpdateCommitmentsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // CommitmentsAPIGetCommitmentUsageHistory request + CommitmentsAPIGetCommitmentUsageHistory(ctx context.Context, organizationId string, commitmentId string, params *CommitmentsAPIGetCommitmentUsageHistoryParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // AuthTokenAPIListAuthTokens request AuthTokenAPIListAuthTokens(ctx context.Context, params *AuthTokenAPIListAuthTokensParams, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -555,6 +568,66 @@ type ClientInterface interface { WorkloadOptimizationAPIUpdateWorkloadV2(ctx context.Context, clusterId string, workloadId string, body WorkloadOptimizationAPIUpdateWorkloadV2JSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) } +func (c *Client) CommitmentsAPIBatchDeleteCommitmentsWithBody(ctx context.Context, organizationId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCommitmentsAPIBatchDeleteCommitmentsRequestWithBody(c.Server, organizationId, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) CommitmentsAPIBatchDeleteCommitments(ctx context.Context, organizationId string, body CommitmentsAPIBatchDeleteCommitmentsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCommitmentsAPIBatchDeleteCommitmentsRequest(c.Server, organizationId, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) CommitmentsAPIBatchUpdateCommitmentsWithBody(ctx context.Context, organizationId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCommitmentsAPIBatchUpdateCommitmentsRequestWithBody(c.Server, organizationId, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) CommitmentsAPIBatchUpdateCommitments(ctx context.Context, organizationId string, body CommitmentsAPIBatchUpdateCommitmentsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCommitmentsAPIBatchUpdateCommitmentsRequest(c.Server, organizationId, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) CommitmentsAPIGetCommitmentUsageHistory(ctx context.Context, organizationId string, commitmentId string, params *CommitmentsAPIGetCommitmentUsageHistoryParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCommitmentsAPIGetCommitmentUsageHistoryRequest(c.Server, organizationId, commitmentId, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) AuthTokenAPIListAuthTokens(ctx context.Context, params *AuthTokenAPIListAuthTokensParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewAuthTokenAPIListAuthTokensRequest(c.Server, params) if err != nil { @@ -2583,6 +2656,181 @@ func (c *Client) WorkloadOptimizationAPIUpdateWorkloadV2(ctx context.Context, cl return c.Client.Do(req) } +// NewCommitmentsAPIBatchDeleteCommitmentsRequest calls the generic CommitmentsAPIBatchDeleteCommitments builder with application/json body +func NewCommitmentsAPIBatchDeleteCommitmentsRequest(server string, organizationId string, body CommitmentsAPIBatchDeleteCommitmentsJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewCommitmentsAPIBatchDeleteCommitmentsRequestWithBody(server, organizationId, "application/json", bodyReader) +} + +// NewCommitmentsAPIBatchDeleteCommitmentsRequestWithBody generates requests for CommitmentsAPIBatchDeleteCommitments with any type of body +func NewCommitmentsAPIBatchDeleteCommitmentsRequestWithBody(server string, organizationId string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationId", runtime.ParamLocationPath, organizationId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/savings/v1/organizations/%s/commitments:batchDelete", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewCommitmentsAPIBatchUpdateCommitmentsRequest calls the generic CommitmentsAPIBatchUpdateCommitments builder with application/json body +func NewCommitmentsAPIBatchUpdateCommitmentsRequest(server string, organizationId string, body CommitmentsAPIBatchUpdateCommitmentsJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewCommitmentsAPIBatchUpdateCommitmentsRequestWithBody(server, organizationId, "application/json", bodyReader) +} + +// NewCommitmentsAPIBatchUpdateCommitmentsRequestWithBody generates requests for CommitmentsAPIBatchUpdateCommitments with any type of body +func NewCommitmentsAPIBatchUpdateCommitmentsRequestWithBody(server string, organizationId string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationId", runtime.ParamLocationPath, organizationId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/savings/v1/organizations/%s/commitments:batchUpdate", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewCommitmentsAPIGetCommitmentUsageHistoryRequest generates requests for CommitmentsAPIGetCommitmentUsageHistory +func NewCommitmentsAPIGetCommitmentUsageHistoryRequest(server string, organizationId string, commitmentId string, params *CommitmentsAPIGetCommitmentUsageHistoryParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationId", runtime.ParamLocationPath, organizationId) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "commitmentId", runtime.ParamLocationPath, commitmentId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/savings/v1beta/organizations/%s/commitments/%s:getUsageHistory", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + queryValues := queryURL.Query() + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "startTime", runtime.ParamLocationQuery, params.StartTime); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "endTime", runtime.ParamLocationQuery, params.EndTime); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "aggregationInterval", runtime.ParamLocationQuery, params.AggregationInterval); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + queryURL.RawQuery = queryValues.Encode() + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + // NewAuthTokenAPIListAuthTokensRequest generates requests for AuthTokenAPIListAuthTokens func NewAuthTokenAPIListAuthTokensRequest(server string, params *AuthTokenAPIListAuthTokensParams) (*http.Request, error) { var err error @@ -8485,6 +8733,19 @@ func WithBaseURL(baseURL string) ClientOption { // ClientWithResponsesInterface is the interface specification for the client with responses above. type ClientWithResponsesInterface interface { + // CommitmentsAPIBatchDeleteCommitments request with any body + CommitmentsAPIBatchDeleteCommitmentsWithBodyWithResponse(ctx context.Context, organizationId string, contentType string, body io.Reader) (*CommitmentsAPIBatchDeleteCommitmentsResponse, error) + + CommitmentsAPIBatchDeleteCommitmentsWithResponse(ctx context.Context, organizationId string, body CommitmentsAPIBatchDeleteCommitmentsJSONRequestBody) (*CommitmentsAPIBatchDeleteCommitmentsResponse, error) + + // CommitmentsAPIBatchUpdateCommitments request with any body + CommitmentsAPIBatchUpdateCommitmentsWithBodyWithResponse(ctx context.Context, organizationId string, contentType string, body io.Reader) (*CommitmentsAPIBatchUpdateCommitmentsResponse, error) + + CommitmentsAPIBatchUpdateCommitmentsWithResponse(ctx context.Context, organizationId string, body CommitmentsAPIBatchUpdateCommitmentsJSONRequestBody) (*CommitmentsAPIBatchUpdateCommitmentsResponse, error) + + // CommitmentsAPIGetCommitmentUsageHistory request + CommitmentsAPIGetCommitmentUsageHistoryWithResponse(ctx context.Context, organizationId string, commitmentId string, params *CommitmentsAPIGetCommitmentUsageHistoryParams) (*CommitmentsAPIGetCommitmentUsageHistoryResponse, error) + // AuthTokenAPIListAuthTokens request AuthTokenAPIListAuthTokensWithResponse(ctx context.Context, params *AuthTokenAPIListAuthTokensParams) (*AuthTokenAPIListAuthTokensResponse, error) @@ -8959,6 +9220,96 @@ type Response interface { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 +type CommitmentsAPIBatchDeleteCommitmentsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *map[string]interface{} +} + +// Status returns HTTPResponse.Status +func (r CommitmentsAPIBatchDeleteCommitmentsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r CommitmentsAPIBatchDeleteCommitmentsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 +// Body returns body of byte array +func (r CommitmentsAPIBatchDeleteCommitmentsResponse) GetBody() []byte { + return r.Body +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 + +type CommitmentsAPIBatchUpdateCommitmentsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *CastaiInventoryV1beta1BatchUpdateCommitmentsResponse +} + +// Status returns HTTPResponse.Status +func (r CommitmentsAPIBatchUpdateCommitmentsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r CommitmentsAPIBatchUpdateCommitmentsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 +// Body returns body of byte array +func (r CommitmentsAPIBatchUpdateCommitmentsResponse) GetBody() []byte { + return r.Body +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 + +type CommitmentsAPIGetCommitmentUsageHistoryResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *CastaiInventoryV1beta1GetCommitmentUsageHistoryResponse +} + +// Status returns HTTPResponse.Status +func (r CommitmentsAPIGetCommitmentUsageHistoryResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r CommitmentsAPIGetCommitmentUsageHistoryResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 +// Body returns body of byte array +func (r CommitmentsAPIGetCommitmentUsageHistoryResponse) GetBody() []byte { + return r.Body +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 + type AuthTokenAPIListAuthTokensResponse struct { Body []byte HTTPResponse *http.Response @@ -12734,6 +13085,49 @@ func (r WorkloadOptimizationAPIUpdateWorkloadV2Response) GetBody() []byte { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 +// CommitmentsAPIBatchDeleteCommitmentsWithBodyWithResponse request with arbitrary body returning *CommitmentsAPIBatchDeleteCommitmentsResponse +func (c *ClientWithResponses) CommitmentsAPIBatchDeleteCommitmentsWithBodyWithResponse(ctx context.Context, organizationId string, contentType string, body io.Reader) (*CommitmentsAPIBatchDeleteCommitmentsResponse, error) { + rsp, err := c.CommitmentsAPIBatchDeleteCommitmentsWithBody(ctx, organizationId, contentType, body) + if err != nil { + return nil, err + } + return ParseCommitmentsAPIBatchDeleteCommitmentsResponse(rsp) +} + +func (c *ClientWithResponses) CommitmentsAPIBatchDeleteCommitmentsWithResponse(ctx context.Context, organizationId string, body CommitmentsAPIBatchDeleteCommitmentsJSONRequestBody) (*CommitmentsAPIBatchDeleteCommitmentsResponse, error) { + rsp, err := c.CommitmentsAPIBatchDeleteCommitments(ctx, organizationId, body) + if err != nil { + return nil, err + } + return ParseCommitmentsAPIBatchDeleteCommitmentsResponse(rsp) +} + +// CommitmentsAPIBatchUpdateCommitmentsWithBodyWithResponse request with arbitrary body returning *CommitmentsAPIBatchUpdateCommitmentsResponse +func (c *ClientWithResponses) CommitmentsAPIBatchUpdateCommitmentsWithBodyWithResponse(ctx context.Context, organizationId string, contentType string, body io.Reader) (*CommitmentsAPIBatchUpdateCommitmentsResponse, error) { + rsp, err := c.CommitmentsAPIBatchUpdateCommitmentsWithBody(ctx, organizationId, contentType, body) + if err != nil { + return nil, err + } + return ParseCommitmentsAPIBatchUpdateCommitmentsResponse(rsp) +} + +func (c *ClientWithResponses) CommitmentsAPIBatchUpdateCommitmentsWithResponse(ctx context.Context, organizationId string, body CommitmentsAPIBatchUpdateCommitmentsJSONRequestBody) (*CommitmentsAPIBatchUpdateCommitmentsResponse, error) { + rsp, err := c.CommitmentsAPIBatchUpdateCommitments(ctx, organizationId, body) + if err != nil { + return nil, err + } + return ParseCommitmentsAPIBatchUpdateCommitmentsResponse(rsp) +} + +// CommitmentsAPIGetCommitmentUsageHistoryWithResponse request returning *CommitmentsAPIGetCommitmentUsageHistoryResponse +func (c *ClientWithResponses) CommitmentsAPIGetCommitmentUsageHistoryWithResponse(ctx context.Context, organizationId string, commitmentId string, params *CommitmentsAPIGetCommitmentUsageHistoryParams) (*CommitmentsAPIGetCommitmentUsageHistoryResponse, error) { + rsp, err := c.CommitmentsAPIGetCommitmentUsageHistory(ctx, organizationId, commitmentId, params) + if err != nil { + return nil, err + } + return ParseCommitmentsAPIGetCommitmentUsageHistoryResponse(rsp) +} + // AuthTokenAPIListAuthTokensWithResponse request returning *AuthTokenAPIListAuthTokensResponse func (c *ClientWithResponses) AuthTokenAPIListAuthTokensWithResponse(ctx context.Context, params *AuthTokenAPIListAuthTokensParams) (*AuthTokenAPIListAuthTokensResponse, error) { rsp, err := c.AuthTokenAPIListAuthTokens(ctx, params) @@ -14212,6 +14606,84 @@ func (c *ClientWithResponses) WorkloadOptimizationAPIUpdateWorkloadV2WithRespons return ParseWorkloadOptimizationAPIUpdateWorkloadV2Response(rsp) } +// ParseCommitmentsAPIBatchDeleteCommitmentsResponse parses an HTTP response from a CommitmentsAPIBatchDeleteCommitmentsWithResponse call +func ParseCommitmentsAPIBatchDeleteCommitmentsResponse(rsp *http.Response) (*CommitmentsAPIBatchDeleteCommitmentsResponse, error) { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + defer rsp.Body.Close() + if err != nil { + return nil, err + } + + response := &CommitmentsAPIBatchDeleteCommitmentsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest map[string]interface{} + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseCommitmentsAPIBatchUpdateCommitmentsResponse parses an HTTP response from a CommitmentsAPIBatchUpdateCommitmentsWithResponse call +func ParseCommitmentsAPIBatchUpdateCommitmentsResponse(rsp *http.Response) (*CommitmentsAPIBatchUpdateCommitmentsResponse, error) { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + defer rsp.Body.Close() + if err != nil { + return nil, err + } + + response := &CommitmentsAPIBatchUpdateCommitmentsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest CastaiInventoryV1beta1BatchUpdateCommitmentsResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseCommitmentsAPIGetCommitmentUsageHistoryResponse parses an HTTP response from a CommitmentsAPIGetCommitmentUsageHistoryWithResponse call +func ParseCommitmentsAPIGetCommitmentUsageHistoryResponse(rsp *http.Response) (*CommitmentsAPIGetCommitmentUsageHistoryResponse, error) { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + defer rsp.Body.Close() + if err != nil { + return nil, err + } + + response := &CommitmentsAPIGetCommitmentUsageHistoryResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest CastaiInventoryV1beta1GetCommitmentUsageHistoryResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + // ParseAuthTokenAPIListAuthTokensResponse parses an HTTP response from a AuthTokenAPIListAuthTokensWithResponse call func ParseAuthTokenAPIListAuthTokensResponse(rsp *http.Response) (*AuthTokenAPIListAuthTokensResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) diff --git a/castai/sdk/mock/client.go b/castai/sdk/mock/client.go index 255a1092..4127246a 100644 --- a/castai/sdk/mock/client.go +++ b/castai/sdk/mock/client.go @@ -215,6 +215,86 @@ func (mr *MockClientInterfaceMockRecorder) AuthTokenAPIUpdateAuthTokenWithBody(c return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AuthTokenAPIUpdateAuthTokenWithBody", reflect.TypeOf((*MockClientInterface)(nil).AuthTokenAPIUpdateAuthTokenWithBody), varargs...) } +// CommitmentsAPIBatchDeleteCommitments mocks base method. +func (m *MockClientInterface) CommitmentsAPIBatchDeleteCommitments(ctx context.Context, organizationId string, body sdk.CommitmentsAPIBatchDeleteCommitmentsJSONRequestBody, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, organizationId, body} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CommitmentsAPIBatchDeleteCommitments", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CommitmentsAPIBatchDeleteCommitments indicates an expected call of CommitmentsAPIBatchDeleteCommitments. +func (mr *MockClientInterfaceMockRecorder) CommitmentsAPIBatchDeleteCommitments(ctx, organizationId, body interface{}, reqEditors ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, organizationId, body}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitmentsAPIBatchDeleteCommitments", reflect.TypeOf((*MockClientInterface)(nil).CommitmentsAPIBatchDeleteCommitments), varargs...) +} + +// CommitmentsAPIBatchDeleteCommitmentsWithBody mocks base method. +func (m *MockClientInterface) CommitmentsAPIBatchDeleteCommitmentsWithBody(ctx context.Context, organizationId, contentType string, body io.Reader, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, organizationId, contentType, body} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CommitmentsAPIBatchDeleteCommitmentsWithBody", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CommitmentsAPIBatchDeleteCommitmentsWithBody indicates an expected call of CommitmentsAPIBatchDeleteCommitmentsWithBody. +func (mr *MockClientInterfaceMockRecorder) CommitmentsAPIBatchDeleteCommitmentsWithBody(ctx, organizationId, contentType, body interface{}, reqEditors ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, organizationId, contentType, body}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitmentsAPIBatchDeleteCommitmentsWithBody", reflect.TypeOf((*MockClientInterface)(nil).CommitmentsAPIBatchDeleteCommitmentsWithBody), varargs...) +} + +// CommitmentsAPIBatchUpdateCommitments mocks base method. +func (m *MockClientInterface) CommitmentsAPIBatchUpdateCommitments(ctx context.Context, organizationId string, body sdk.CommitmentsAPIBatchUpdateCommitmentsJSONRequestBody, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, organizationId, body} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CommitmentsAPIBatchUpdateCommitments", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CommitmentsAPIBatchUpdateCommitments indicates an expected call of CommitmentsAPIBatchUpdateCommitments. +func (mr *MockClientInterfaceMockRecorder) CommitmentsAPIBatchUpdateCommitments(ctx, organizationId, body interface{}, reqEditors ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, organizationId, body}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitmentsAPIBatchUpdateCommitments", reflect.TypeOf((*MockClientInterface)(nil).CommitmentsAPIBatchUpdateCommitments), varargs...) +} + +// CommitmentsAPIBatchUpdateCommitmentsWithBody mocks base method. +func (m *MockClientInterface) CommitmentsAPIBatchUpdateCommitmentsWithBody(ctx context.Context, organizationId, contentType string, body io.Reader, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, organizationId, contentType, body} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CommitmentsAPIBatchUpdateCommitmentsWithBody", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CommitmentsAPIBatchUpdateCommitmentsWithBody indicates an expected call of CommitmentsAPIBatchUpdateCommitmentsWithBody. +func (mr *MockClientInterfaceMockRecorder) CommitmentsAPIBatchUpdateCommitmentsWithBody(ctx, organizationId, contentType, body interface{}, reqEditors ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, organizationId, contentType, body}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitmentsAPIBatchUpdateCommitmentsWithBody", reflect.TypeOf((*MockClientInterface)(nil).CommitmentsAPIBatchUpdateCommitmentsWithBody), varargs...) +} + // CommitmentsAPICreateCommitmentAssignment mocks base method. func (m *MockClientInterface) CommitmentsAPICreateCommitmentAssignment(ctx context.Context, params *sdk.CommitmentsAPICreateCommitmentAssignmentParams, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { m.ctrl.T.Helper() @@ -315,6 +395,26 @@ func (mr *MockClientInterfaceMockRecorder) CommitmentsAPIGetCommitmentAssignment return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitmentsAPIGetCommitmentAssignments", reflect.TypeOf((*MockClientInterface)(nil).CommitmentsAPIGetCommitmentAssignments), varargs...) } +// CommitmentsAPIGetCommitmentUsageHistory mocks base method. +func (m *MockClientInterface) CommitmentsAPIGetCommitmentUsageHistory(ctx context.Context, organizationId, commitmentId string, params *sdk.CommitmentsAPIGetCommitmentUsageHistoryParams, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, organizationId, commitmentId, params} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CommitmentsAPIGetCommitmentUsageHistory", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CommitmentsAPIGetCommitmentUsageHistory indicates an expected call of CommitmentsAPIGetCommitmentUsageHistory. +func (mr *MockClientInterfaceMockRecorder) CommitmentsAPIGetCommitmentUsageHistory(ctx, organizationId, commitmentId, params interface{}, reqEditors ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, organizationId, commitmentId, params}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitmentsAPIGetCommitmentUsageHistory", reflect.TypeOf((*MockClientInterface)(nil).CommitmentsAPIGetCommitmentUsageHistory), varargs...) +} + // CommitmentsAPIGetCommitments mocks base method. func (m *MockClientInterface) CommitmentsAPIGetCommitments(ctx context.Context, params *sdk.CommitmentsAPIGetCommitmentsParams, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { m.ctrl.T.Helper() @@ -3583,6 +3683,66 @@ func (mr *MockClientWithResponsesInterfaceMockRecorder) AuthTokenAPIUpdateAuthTo return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AuthTokenAPIUpdateAuthTokenWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).AuthTokenAPIUpdateAuthTokenWithResponse), ctx, id, body) } +// CommitmentsAPIBatchDeleteCommitmentsWithBodyWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) CommitmentsAPIBatchDeleteCommitmentsWithBodyWithResponse(ctx context.Context, organizationId, contentType string, body io.Reader) (*sdk.CommitmentsAPIBatchDeleteCommitmentsResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CommitmentsAPIBatchDeleteCommitmentsWithBodyWithResponse", ctx, organizationId, contentType, body) + ret0, _ := ret[0].(*sdk.CommitmentsAPIBatchDeleteCommitmentsResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CommitmentsAPIBatchDeleteCommitmentsWithBodyWithResponse indicates an expected call of CommitmentsAPIBatchDeleteCommitmentsWithBodyWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) CommitmentsAPIBatchDeleteCommitmentsWithBodyWithResponse(ctx, organizationId, contentType, body interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitmentsAPIBatchDeleteCommitmentsWithBodyWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).CommitmentsAPIBatchDeleteCommitmentsWithBodyWithResponse), ctx, organizationId, contentType, body) +} + +// CommitmentsAPIBatchDeleteCommitmentsWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) CommitmentsAPIBatchDeleteCommitmentsWithResponse(ctx context.Context, organizationId string, body sdk.CommitmentsAPIBatchDeleteCommitmentsJSONRequestBody) (*sdk.CommitmentsAPIBatchDeleteCommitmentsResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CommitmentsAPIBatchDeleteCommitmentsWithResponse", ctx, organizationId, body) + ret0, _ := ret[0].(*sdk.CommitmentsAPIBatchDeleteCommitmentsResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CommitmentsAPIBatchDeleteCommitmentsWithResponse indicates an expected call of CommitmentsAPIBatchDeleteCommitmentsWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) CommitmentsAPIBatchDeleteCommitmentsWithResponse(ctx, organizationId, body interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitmentsAPIBatchDeleteCommitmentsWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).CommitmentsAPIBatchDeleteCommitmentsWithResponse), ctx, organizationId, body) +} + +// CommitmentsAPIBatchUpdateCommitmentsWithBodyWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) CommitmentsAPIBatchUpdateCommitmentsWithBodyWithResponse(ctx context.Context, organizationId, contentType string, body io.Reader) (*sdk.CommitmentsAPIBatchUpdateCommitmentsResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CommitmentsAPIBatchUpdateCommitmentsWithBodyWithResponse", ctx, organizationId, contentType, body) + ret0, _ := ret[0].(*sdk.CommitmentsAPIBatchUpdateCommitmentsResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CommitmentsAPIBatchUpdateCommitmentsWithBodyWithResponse indicates an expected call of CommitmentsAPIBatchUpdateCommitmentsWithBodyWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) CommitmentsAPIBatchUpdateCommitmentsWithBodyWithResponse(ctx, organizationId, contentType, body interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitmentsAPIBatchUpdateCommitmentsWithBodyWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).CommitmentsAPIBatchUpdateCommitmentsWithBodyWithResponse), ctx, organizationId, contentType, body) +} + +// CommitmentsAPIBatchUpdateCommitmentsWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) CommitmentsAPIBatchUpdateCommitmentsWithResponse(ctx context.Context, organizationId string, body sdk.CommitmentsAPIBatchUpdateCommitmentsJSONRequestBody) (*sdk.CommitmentsAPIBatchUpdateCommitmentsResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CommitmentsAPIBatchUpdateCommitmentsWithResponse", ctx, organizationId, body) + ret0, _ := ret[0].(*sdk.CommitmentsAPIBatchUpdateCommitmentsResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CommitmentsAPIBatchUpdateCommitmentsWithResponse indicates an expected call of CommitmentsAPIBatchUpdateCommitmentsWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) CommitmentsAPIBatchUpdateCommitmentsWithResponse(ctx, organizationId, body interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitmentsAPIBatchUpdateCommitmentsWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).CommitmentsAPIBatchUpdateCommitmentsWithResponse), ctx, organizationId, body) +} + // CommitmentsAPICreateCommitmentAssignmentWithResponse mocks base method. func (m *MockClientWithResponsesInterface) CommitmentsAPICreateCommitmentAssignmentWithResponse(ctx context.Context, params *sdk.CommitmentsAPICreateCommitmentAssignmentParams) (*sdk.CommitmentsAPICreateCommitmentAssignmentResponse, error) { m.ctrl.T.Helper() @@ -3643,6 +3803,21 @@ func (mr *MockClientWithResponsesInterfaceMockRecorder) CommitmentsAPIGetCommitm return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitmentsAPIGetCommitmentAssignmentsWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).CommitmentsAPIGetCommitmentAssignmentsWithResponse), ctx, commitmentId) } +// CommitmentsAPIGetCommitmentUsageHistoryWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) CommitmentsAPIGetCommitmentUsageHistoryWithResponse(ctx context.Context, organizationId, commitmentId string, params *sdk.CommitmentsAPIGetCommitmentUsageHistoryParams) (*sdk.CommitmentsAPIGetCommitmentUsageHistoryResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CommitmentsAPIGetCommitmentUsageHistoryWithResponse", ctx, organizationId, commitmentId, params) + ret0, _ := ret[0].(*sdk.CommitmentsAPIGetCommitmentUsageHistoryResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CommitmentsAPIGetCommitmentUsageHistoryWithResponse indicates an expected call of CommitmentsAPIGetCommitmentUsageHistoryWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) CommitmentsAPIGetCommitmentUsageHistoryWithResponse(ctx, organizationId, commitmentId, params interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CommitmentsAPIGetCommitmentUsageHistoryWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).CommitmentsAPIGetCommitmentUsageHistoryWithResponse), ctx, organizationId, commitmentId, params) +} + // CommitmentsAPIGetCommitmentWithResponse mocks base method. func (m *MockClientWithResponsesInterface) CommitmentsAPIGetCommitmentWithResponse(ctx context.Context, commitmentId string, params *sdk.CommitmentsAPIGetCommitmentParams) (*sdk.CommitmentsAPIGetCommitmentResponse, error) { m.ctrl.T.Helper() diff --git a/docs/resources/node_configuration.md b/docs/resources/node_configuration.md index 08f35f4a..669a4edb 100644 --- a/docs/resources/node_configuration.md +++ b/docs/resources/node_configuration.md @@ -88,20 +88,19 @@ resource "castai_node_configuration" "default" { Optional: - `aks_image_family` (String) Image OS Family to use when provisioning node in AKS. If both image and family are provided, the system will use provided image and provisioning logic for given family. If only image family is provided, the system will attempt to resolve the latest image from that family based on kubernetes version and node architecture. If image family is omitted, a default family (based on cloud provider) will be used. See Cast.ai documentation for details. Possible values: (ubuntu,azure-linux) -- `loadbalancers` (Block List) Loadboalancer configuration for CAST provisioned nodes (see [below for nested schema](#nestedblock--aks--loadbalancers)) +- `loadbalancers` (Block List) Load balancer configuration for CAST provisioned nodes (see [below for nested schema](#nestedblock--aks--loadbalancers)) - `max_pods_per_node` (Number) Maximum number of pods that can be run on a node, which affects how many IP addresses you will need for each node. Defaults to 30 - `os_disk_type` (String) Type of managed os disk attached to the node. (See [disk types](https://learn.microsoft.com/en-us/azure/virtual-machines/disks-types)). One of: standard, standard-ssd, premium-ssd (ultra and premium-ssd-v2 are not supported for os disk) ### Nested Schema for `aks.loadbalancers` -Required: - -- `name` (String) Name of loadbalancer - Optional: +- `id` (String) The full ID of the load balancer in azure. - `ip_based_backend_pools` (Block List) IP based backend pools configuration for CAST provisioned nodes (see [below for nested schema](#nestedblock--aks--loadbalancers--ip_based_backend_pools)) +- `name` (String, Deprecated) Name of load balancer +- `nic_based_backend_pools` (Block List) NIC based backend pools configuration for CAST provisioned nodes. (see [below for nested schema](#nestedblock--aks--loadbalancers--nic_based_backend_pools)) ### Nested Schema for `aks.loadbalancers.ip_based_backend_pools` @@ -111,6 +110,14 @@ Required: - `name` (String) Name of the ip based backend pool + +### Nested Schema for `aks.loadbalancers.nic_based_backend_pools` + +Required: + +- `name` (String) Name of the NIC based backend pool + + From 1cd3c9613c43fe33c44ca500d4c33c1bc3329e71 Mon Sep 17 00:00:00 2001 From: Oskar Wojciski Date: Mon, 9 Dec 2024 12:13:00 +0200 Subject: [PATCH 2/2] WIRE-838 - Support for managing organization groups (#427) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * WIRE-838 - Support for managing organization groups * Reformat code * WIRE-838 - Member kind support * WIRE-838 - Format TF * WIRE-838 - Update tests to support member kinds * WIRE-838 - More tests * WIRE-838 - Fix test names and add parallelism * Update castai/resource_organization_group.go Co-authored-by: Radosław Skałbania <48757764+radekska@users.noreply.github.com> * WIRE-838 - Param fix --------- Co-authored-by: Radosław Skałbania <48757764+radekska@users.noreply.github.com> --- Makefile | 2 +- castai/provider.go | 1 + castai/resource_organization_group.go | 304 ++++ castai/resource_organization_group_test.go | 667 ++++++++ castai/sdk/api.gen.go | 359 ++++- castai/sdk/client.gen.go | 1645 ++++++++++++++++---- castai/sdk/mock/client.go | 490 +++++- docs/resources/organization_group.md | 63 + examples/organization_groups/main.tf | 50 + 9 files changed, 3120 insertions(+), 461 deletions(-) create mode 100644 castai/resource_organization_group.go create mode 100644 castai/resource_organization_group_test.go create mode 100644 docs/resources/organization_group.md create mode 100644 examples/organization_groups/main.tf diff --git a/Makefile b/Makefile index efd47214..a1ad7ad5 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ SHELL := /bin/bash -export API_TAGS ?= ExternalClusterAPI,PoliciesAPI,NodeConfigurationAPI,NodeTemplatesAPI,AuthTokenAPI,ScheduledRebalancingAPI,InventoryAPI,UsersAPI,OperationsAPI,EvictorAPI,SSOAPI,CommitmentsAPI,WorkloadOptimizationAPI +export API_TAGS ?= ExternalClusterAPI,PoliciesAPI,NodeConfigurationAPI,NodeTemplatesAPI,AuthTokenAPI,ScheduledRebalancingAPI,InventoryAPI,UsersAPI,OperationsAPI,EvictorAPI,SSOAPI,CommitmentsAPI,WorkloadOptimizationAPI,RbacServiceAPI export SWAGGER_LOCATION ?= https://api.cast.ai/v1/spec/openapi.json default: build diff --git a/castai/provider.go b/castai/provider.go index a227f8b8..30c86bc2 100644 --- a/castai/provider.go +++ b/castai/provider.go @@ -53,6 +53,7 @@ func Provider(version string) *schema.Provider { "castai_organization_members": resourceOrganizationMembers(), "castai_sso_connection": resourceSSOConnection(), "castai_workload_scaling_policy": resourceWorkloadScalingPolicy(), + "castai_organization_group": resourceOrganizationGroup(), }, DataSourcesMap: map[string]*schema.Resource{ diff --git a/castai/resource_organization_group.go b/castai/resource_organization_group.go new file mode 100644 index 00000000..eb02f053 --- /dev/null +++ b/castai/resource_organization_group.go @@ -0,0 +1,304 @@ +package castai + +import ( + "context" + "errors" + "fmt" + "net/http" + "strings" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/samber/lo" + + "github.com/castai/terraform-provider-castai/castai/sdk" +) + +const ( + FieldOrganizationGroupOrganizationID = "organization_id" + FieldOrganizationGroupName = "name" + FieldOrganizationGroupDescription = "description" + FieldOrganizationGroupMembers = "members" + FieldOrganizationGroupMember = "member" + FieldOrganizationGroupMemberKind = "kind" + FieldOrganizationGroupMemberID = "id" + FieldOrganizationGroupMemberEmail = "email" + + GroupMemberKindUser = "user" + GroupMemberKindServiceAccount = "service_account" +) + +var ( + supportedMemberKinds = []string{GroupMemberKindUser, GroupMemberKindServiceAccount} +) + +func resourceOrganizationGroup() *schema.Resource { + return &schema.Resource{ + ReadContext: resourceOrganizationGroupRead, + CreateContext: resourceOrganizationGroupCreate, + UpdateContext: resourceOrganizationGroupUpdate, + DeleteContext: resourceOrganizationGroupDelete, + Description: "CAST AI organization group resource to manage organization groups", + Importer: &schema.ResourceImporter{ + StateContext: schema.ImportStatePassthroughContext, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(2 * time.Minute), + Update: schema.DefaultTimeout(2 * time.Minute), + Delete: schema.DefaultTimeout(2 * time.Minute), + }, + Schema: map[string]*schema.Schema{ + FieldOrganizationGroupOrganizationID: { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "CAST AI organization ID.", + }, + FieldOrganizationGroupName: { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Name of the group.", + }, + FieldOrganizationGroupDescription: { + Type: schema.TypeString, + Optional: true, + Description: "Description of the group.", + }, + FieldOrganizationGroupMembers: { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + FieldOrganizationGroupMember: { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + FieldOrganizationGroupMemberKind: { + Type: schema.TypeString, + Required: true, + Description: fmt.Sprintf("Kind of the member. Supported values include: %s.", strings.Join(supportedMemberKinds, ", ")), + ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice(supportedMemberKinds, true)), + DiffSuppressFunc: func(k, oldValue, newValue string, d *schema.ResourceData) bool { + return strings.EqualFold(oldValue, newValue) + }, + }, + FieldOrganizationGroupMemberID: { + Type: schema.TypeString, + Required: true, + }, + FieldOrganizationGroupMemberEmail: { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func resourceOrganizationGroupCreate(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { + organizationID := data.Get(FieldOrganizationGroupOrganizationID).(string) + if organizationID == "" { + var err error + organizationID, err = getDefaultOrganizationId(ctx, meta) + if err != nil { + return diag.Errorf("getting default organization: %v", err) + } + } + + client := meta.(*ProviderConfig).api + + members := convertMembersToSDK(data) + + resp, err := client.RbacServiceAPICreateGroupWithResponse(ctx, organizationID, sdk.RbacServiceAPICreateGroupJSONRequestBody{ + Definition: sdk.CastaiRbacV1beta1CreateGroupRequestGroupDefinition{ + Members: &members, + }, + Description: lo.ToPtr(data.Get(FieldOrganizationGroupDescription).(string)), + Name: data.Get(FieldOrganizationName).(string), + }) + + if err := sdk.CheckOKResponse(resp, err); err != nil { + return diag.FromErr(fmt.Errorf("create group: %w", err)) + } + + data.SetId(*resp.JSON200.Id) + + return resourceOrganizationGroupRead(ctx, data, meta) +} + +func resourceOrganizationGroupRead(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { + groupID := data.Id() + if groupID == "" { + return diag.Errorf("group ID is not set") + } + + organizationID := data.Get(FieldOrganizationGroupOrganizationID).(string) + if organizationID == "" { + var err error + organizationID, err = getDefaultOrganizationId(ctx, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("getting default organization: %w", err)) + } + } + + client := meta.(*ProviderConfig).api + + group, err := getGroup(client, ctx, organizationID, groupID) + if err != nil { + return diag.FromErr(fmt.Errorf("getting group for read: %w", err)) + } + + if err := assignGroupData(group, data); err != nil { + return diag.FromErr(fmt.Errorf("assigning group data for read: %w", err)) + } + + return nil +} + +func resourceOrganizationGroupUpdate(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { + groupID := data.Id() + if groupID == "" { + return diag.Errorf("group ID is not set") + } + + organizationID := data.Get(FieldOrganizationGroupOrganizationID).(string) + if organizationID == "" { + var err error + organizationID, err = getDefaultOrganizationId(ctx, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("getting default organization: %w", err)) + } + } + + client := meta.(*ProviderConfig).api + + members := convertMembersToSDK(data) + + resp, err := client.RbacServiceAPIUpdateGroupWithResponse(ctx, organizationID, groupID, sdk.RbacServiceAPIUpdateGroupJSONRequestBody{ + Definition: sdk.CastaiRbacV1beta1UpdateGroupRequestGroupDefinition{ + Members: members, + }, + Description: lo.ToPtr(data.Get(FieldOrganizationGroupDescription).(string)), + Name: data.Get(FieldOrganizationName).(string), + }) + if err := sdk.CheckOKResponse(resp, err); err != nil { + return diag.FromErr(fmt.Errorf("update group: %w", err)) + } + + return resourceOrganizationGroupRead(ctx, data, meta) +} + +func resourceOrganizationGroupDelete(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { + groupID := data.Id() + if groupID == "" { + return diag.Errorf("group ID is not set") + } + + organizationID := data.Get(FieldOrganizationGroupOrganizationID).(string) + if organizationID == "" { + var err error + organizationID, err = getDefaultOrganizationId(ctx, meta) + if err != nil { + return diag.FromErr(fmt.Errorf("getting default organization: %w", err)) + } + } + + client := meta.(*ProviderConfig).api + + resp, err := client.RbacServiceAPIDeleteGroupWithResponse(ctx, organizationID, groupID) + if err := sdk.CheckOKResponse(resp, err); err != nil { + return diag.FromErr(fmt.Errorf("destroy group: %w", err)) + } + + return nil +} + +func getGroup(client *sdk.ClientWithResponses, ctx context.Context, organizationID, groupID string) (*sdk.CastaiRbacV1beta1Group, error) { + groupsResp, err := client.RbacServiceAPIGetGroupWithResponse(ctx, organizationID, groupID) + if err != nil { + return nil, fmt.Errorf("fetching group: %w", err) + } + + if groupsResp.StatusCode() == http.StatusNotFound { + return nil, fmt.Errorf("group %s not found", groupID) + } + if err := sdk.CheckOKResponse(groupsResp, err); err != nil { + return nil, fmt.Errorf("retrieving group: %w", err) + } + if groupsResp.JSON200 == nil { + return nil, errors.New("group not found") + } + return groupsResp.JSON200, nil +} + +func assignGroupData(group *sdk.CastaiRbacV1beta1Group, data *schema.ResourceData) error { + if err := data.Set(FieldOrganizationGroupOrganizationID, group.OrganizationId); err != nil { + return fmt.Errorf("setting organization_id: %w", err) + } + if err := data.Set(FieldOrganizationGroupDescription, group.Description); err != nil { + return fmt.Errorf("setting description: %w", err) + } + if err := data.Set(FieldOrganizationGroupName, group.Name); err != nil { + return fmt.Errorf("setting group name: %w", err) + } + + if group.Definition.Members != nil { + var members []map[string]string + for _, member := range *group.Definition.Members { + var kind string + switch member.Kind { + case sdk.USER: + kind = GroupMemberKindUser + case sdk.SERVICEACCOUNT: + kind = GroupMemberKindServiceAccount + } + members = append(members, map[string]string{ + FieldOrganizationGroupMemberKind: kind, + FieldOrganizationGroupMemberID: member.Id, + FieldOrganizationGroupMemberEmail: member.Email, + }) + } + err := data.Set(FieldOrganizationGroupMembers, []any{ + map[string]any{ + FieldOrganizationGroupMember: members, + }, + }) + if err != nil { + return fmt.Errorf("parsing group members: %w", err) + } + } + + return nil +} + +func convertMembersToSDK(data *schema.ResourceData) []sdk.CastaiRbacV1beta1Member { + var members []sdk.CastaiRbacV1beta1Member + + for _, dataMembersDef := range data.Get(FieldOrganizationGroupMembers).([]any) { + for _, dataMember := range dataMembersDef.(map[string]any)[FieldOrganizationGroupMember].([]any) { + var kind sdk.CastaiRbacV1beta1MemberKind + switch dataMember.(map[string]any)[FieldOrganizationGroupMemberKind].(string) { + case GroupMemberKindUser: + kind = sdk.USER + case GroupMemberKindServiceAccount: + kind = sdk.SERVICEACCOUNT + } + members = append(members, sdk.CastaiRbacV1beta1Member{ + Kind: kind, + Email: dataMember.(map[string]any)[FieldOrganizationGroupMemberEmail].(string), + Id: dataMember.(map[string]any)[FieldOrganizationGroupMemberID].(string), + }) + } + } + + return members +} diff --git a/castai/resource_organization_group_test.go b/castai/resource_organization_group_test.go new file mode 100644 index 00000000..8af5967c --- /dev/null +++ b/castai/resource_organization_group_test.go @@ -0,0 +1,667 @@ +package castai + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "io" + "net/http" + "testing" + + "github.com/golang/mock/gomock" + "github.com/google/uuid" + "github.com/hashicorp/go-cty/cty" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/samber/lo" + "github.com/stretchr/testify/require" + + "github.com/castai/terraform-provider-castai/castai/sdk" + mock_sdk "github.com/castai/terraform-provider-castai/castai/sdk/mock" +) + +func TestOrganizationGroupReadContext(t *testing.T) { + t.Parallel() + + t.Run("when state is missing group ID then return error", func(t *testing.T) { + t.Parallel() + r := require.New(t) + + ctx := context.Background() + provider := &ProviderConfig{} + + stateValue := cty.ObjectVal(map[string]cty.Value{}) + state := terraform.NewInstanceStateShimmedFromValue(stateValue, 0) + + resource := resourceOrganizationGroup() + data := resource.Data(state) + + result := resource.ReadContext(ctx, data, provider) + + r.NotNil(result) + r.True(result.HasError()) + r.Len(result, 1) + r.Equal("group ID is not set", result[0].Summary) + }) + + t.Run("when RbacServiceAPI respond with 404 then return error", func(t *testing.T) { + t.Parallel() + r := require.New(t) + mockClient := mock_sdk.NewMockClientInterface(gomock.NewController(t)) + + ctx := context.Background() + provider := &ProviderConfig{ + api: &sdk.ClientWithResponses{ + ClientInterface: mockClient, + }, + } + + organizationID := uuid.NewString() + groupID := uuid.NewString() + + body := io.NopCloser(bytes.NewReader([]byte(""))) + + mockClient.EXPECT(). + RbacServiceAPIGetGroup(gomock.Any(), organizationID, groupID). + Return(&http.Response{StatusCode: http.StatusNotFound, Body: body, Header: map[string][]string{"Content-Type": {"json"}}}, nil) + + stateValue := cty.ObjectVal(map[string]cty.Value{ + "organization_id": cty.StringVal(organizationID), + }) + state := terraform.NewInstanceStateShimmedFromValue(stateValue, 0) + state.ID = groupID + + resource := resourceOrganizationGroup() + data := resource.Data(state) + + result := resource.ReadContext(ctx, data, provider) + r.NotNil(result) + r.True(result.HasError()) + r.Len(result, 1) + r.Equal("getting group for read: group "+groupID+" not found", result[0].Summary) + }) + + t.Run("when RbacServiceAPI respond with 500 then return error", func(t *testing.T) { + t.Parallel() + r := require.New(t) + mockClient := mock_sdk.NewMockClientInterface(gomock.NewController(t)) + + ctx := context.Background() + provider := &ProviderConfig{ + api: &sdk.ClientWithResponses{ + ClientInterface: mockClient, + }, + } + + organizationID := uuid.NewString() + groupID := uuid.NewString() + + body := io.NopCloser(bytes.NewReader([]byte("internal error"))) + + mockClient.EXPECT(). + RbacServiceAPIGetGroup(gomock.Any(), organizationID, groupID). + Return(&http.Response{StatusCode: http.StatusInternalServerError, Body: body, Header: map[string][]string{"Content-Type": {"json"}}}, nil) + + stateValue := cty.ObjectVal(map[string]cty.Value{ + "organization_id": cty.StringVal(organizationID), + }) + state := terraform.NewInstanceStateShimmedFromValue(stateValue, 0) + state.ID = groupID + + resource := resourceOrganizationGroup() + data := resource.Data(state) + + result := resource.ReadContext(ctx, data, provider) + r.NotNil(result) + r.True(result.HasError()) + r.Len(result, 1) + r.Equal("getting group for read: retrieving group: expected status code 200, received: status=500 body=internal error", result[0].Summary) + }) + + t.Run("when calling RbacServiceAPI throws error then return error", func(t *testing.T) { + t.Parallel() + r := require.New(t) + mockClient := mock_sdk.NewMockClientInterface(gomock.NewController(t)) + + ctx := context.Background() + provider := &ProviderConfig{ + api: &sdk.ClientWithResponses{ + ClientInterface: mockClient, + }, + } + + organizationID := uuid.NewString() + groupID := uuid.NewString() + + mockClient.EXPECT(). + RbacServiceAPIGetGroup(gomock.Any(), organizationID, groupID). + Return(nil, errors.New("unexpected error")) + + stateValue := cty.ObjectVal(map[string]cty.Value{ + "organization_id": cty.StringVal(organizationID), + }) + state := terraform.NewInstanceStateShimmedFromValue(stateValue, 0) + state.ID = groupID + + resource := resourceOrganizationGroup() + data := resource.Data(state) + + result := resource.ReadContext(ctx, data, provider) + r.NotNil(result) + r.True(result.HasError()) + r.Len(result, 1) + r.Equal("getting group for read: fetching group: unexpected error", result[0].Summary) + }) + + t.Run("when RbacServiceAPI respond with 200 then populate the state", func(t *testing.T) { + t.Parallel() + r := require.New(t) + mockClient := mock_sdk.NewMockClientInterface(gomock.NewController(t)) + + ctx := context.Background() + provider := &ProviderConfig{ + api: &sdk.ClientWithResponses{ + ClientInterface: mockClient, + }, + } + + organizationID := uuid.NewString() + groupID := uuid.NewString() + + firstUserID := uuid.NewString() + secondUserID := uuid.NewString() + + body := io.NopCloser(bytes.NewReader([]byte(`{ + "id": "` + groupID + `", + "organizationId": "` + organizationID + `", + "name": "test group", + "description": "test group description", + "definition": { + "members": [ + { + "id": "` + firstUserID + `", + "email": "test-user-1@test.com" + }, + { + "id": "` + secondUserID + `", + "email": "test-user-2@test.com" + } + ] + } + }`))) + + mockClient.EXPECT(). + RbacServiceAPIGetGroup(gomock.Any(), organizationID, groupID). + Return(&http.Response{StatusCode: http.StatusOK, Body: body, Header: map[string][]string{"Content-Type": {"json"}}}, nil) + + stateValue := cty.ObjectVal(map[string]cty.Value{ + "organization_id": cty.StringVal(organizationID), + }) + state := terraform.NewInstanceStateShimmedFromValue(stateValue, 0) + state.ID = groupID + + resource := resourceOrganizationGroup() + data := resource.Data(state) + + result := resource.ReadContext(ctx, data, provider) + r.Nil(result) + r.False(result.HasError()) + r.Equal(`ID = `+groupID+` +description = test group description +members.# = 1 +members.0.member.# = 2 +members.0.member.0.email = test-user-1@test.com +members.0.member.0.id = `+firstUserID+` +members.0.member.0.kind = +members.0.member.1.email = test-user-2@test.com +members.0.member.1.id = `+secondUserID+` +members.0.member.1.kind = +name = test group +organization_id = `+organizationID+` +Tainted = false +`, data.State().String()) + }) + + t.Run("when organization is not defined, use default one for the token", func(t *testing.T) { + t.Parallel() + r := require.New(t) + + mockClient := mock_sdk.NewMockClientInterface(gomock.NewController(t)) + + ctx := context.Background() + provider := &ProviderConfig{ + api: &sdk.ClientWithResponses{ + ClientInterface: mockClient, + }, + } + + organizationID := "b6bfc024-a267-400f-b8f1-db0850c369b4" + groupID := "e9a3f787-15d4-4850-ae7c-b4864809aa55" + + organizationsBody := io.NopCloser(bytes.NewReader([]byte(`{ + "organizations": [ + { + "id": "b6bfc024-a267-400f-b8f1-db0850c369b4", + "name": "Test 1", + "createdAt": "2023-04-18T16:03:18.800099Z", + "role": "owner" + } + ] +}`))) + + mockClient.EXPECT(). + UsersAPIListOrganizations(gomock.Any(), gomock.Any()). + Return(&http.Response{StatusCode: http.StatusOK, Body: organizationsBody, Header: map[string][]string{"Content-Type": {"json"}}}, nil) + + body := io.NopCloser(bytes.NewReader([]byte(`{ + "id": "e9a3f787-15d4-4850-ae7c-b4864809aa55", + "organizationId": "b6bfc024-a267-400f-b8f1-db0850c369b4", + "name": "test group", + "description": "test group description", + "definition": { + "members": [ + { + "id": "5d832285-c263-4d27-9ba5-7d8cf5759782", + "email": "test-user-1@test.com" + }, + { + "id": "5d832285-c263-4d27-9ba5-7d8cf5759783", + "email": "test-user-2@test.com" + } + ] + } + }`))) + + mockClient.EXPECT(). + RbacServiceAPIGetGroup(gomock.Any(), organizationID, groupID). + Return(&http.Response{StatusCode: http.StatusOK, Body: body, Header: map[string][]string{"Content-Type": {"json"}}}, nil) + + stateValue := cty.ObjectVal(map[string]cty.Value{}) + state := terraform.NewInstanceStateShimmedFromValue(stateValue, 0) + state.ID = groupID + + resource := resourceOrganizationGroup() + data := resource.Data(state) + + result := resource.ReadContext(ctx, data, provider) + r.Nil(result) + r.False(result.HasError()) + r.Equal(`ID = e9a3f787-15d4-4850-ae7c-b4864809aa55 +description = test group description +members.# = 1 +members.0.member.# = 2 +members.0.member.0.email = test-user-1@test.com +members.0.member.0.id = 5d832285-c263-4d27-9ba5-7d8cf5759782 +members.0.member.0.kind = +members.0.member.1.email = test-user-2@test.com +members.0.member.1.id = 5d832285-c263-4d27-9ba5-7d8cf5759783 +members.0.member.1.kind = +name = test group +organization_id = b6bfc024-a267-400f-b8f1-db0850c369b4 +Tainted = false +`, data.State().String()) + }) + +} + +func TestOrganizationGroupUpdateContext(t *testing.T) { + t.Parallel() + + t.Run("when state is missing group ID then return error", func(t *testing.T) { + t.Parallel() + r := require.New(t) + + ctx := context.Background() + provider := &ProviderConfig{} + + stateValue := cty.ObjectVal(map[string]cty.Value{}) + state := terraform.NewInstanceStateShimmedFromValue(stateValue, 0) + + resource := resourceOrganizationGroup() + data := resource.Data(state) + + result := resource.UpdateContext(ctx, data, provider) + + r.NotNil(result) + r.True(result.HasError()) + r.Len(result, 1) + r.Equal("group ID is not set", result[0].Summary) + }) + + t.Run("when RbacServiceAPI UpdateGroup respond with 500 then throw error", func(t *testing.T) { + t.Parallel() + r := require.New(t) + mockClient := mock_sdk.NewMockClientInterface(gomock.NewController(t)) + + ctx := context.Background() + provider := &ProviderConfig{ + api: &sdk.ClientWithResponses{ + ClientInterface: mockClient, + }, + } + + organizationID := uuid.NewString() + groupID := uuid.NewString() + + mockClient.EXPECT(). + RbacServiceAPIUpdateGroup(gomock.Any(), organizationID, groupID, gomock.Any()). + DoAndReturn(func(ctx context.Context, reqOrgID string, reqGroupID string, req sdk.RbacServiceAPIUpdateGroupJSONRequestBody) (*http.Response, error) { + r.Equal(organizationID, reqOrgID) + r.Equal(groupID, reqGroupID) + + body := &bytes.Buffer{} + err := json.NewEncoder(body).Encode(&sdk.CastaiRbacV1beta1Group{}) + r.NoError(err) + return &http.Response{StatusCode: http.StatusInternalServerError, Body: io.NopCloser(body), Header: map[string][]string{"Content-Type": {"json"}}}, nil + }) + + stateValue := cty.ObjectVal(map[string]cty.Value{ + "organization_id": cty.StringVal(organizationID), + }) + state := terraform.NewInstanceStateShimmedFromValue(stateValue, 0) + state.ID = groupID + + resource := resourceOrganizationGroup() + data := resource.Data(state) + + result := resource.UpdateContext(ctx, data, provider) + + r.NotNil(result) + r.True(result.HasError()) + r.Len(result, 1) + r.Contains(result[0].Summary, "update group: expected status code 200, received: status=500") + }) + + t.Run("when RbacServiceAPI UpdateGroup respond with 200 then no errors", func(t *testing.T) { + t.Parallel() + r := require.New(t) + mockClient := mock_sdk.NewMockClientInterface(gomock.NewController(t)) + + ctx := context.Background() + provider := &ProviderConfig{ + api: &sdk.ClientWithResponses{ + ClientInterface: mockClient, + }, + } + + organizationID := uuid.NewString() + groupID := uuid.NewString() + + firstUserID := uuid.NewString() + secondUserID := uuid.NewString() + + body := io.NopCloser(bytes.NewReader([]byte(`{ + "id": "` + groupID + `", + "organizationId": "` + organizationID + `", + "name": "test group", + "description": "test group description changed", + "definition": { + "members": [ + { + "id": "` + firstUserID + `", + "email": "test-user-1@test.com" + }, + { + "id": "` + secondUserID + `", + "email": "test-user-2@test.com" + } + ] + } + }`))) + + mockClient.EXPECT(). + RbacServiceAPIGetGroup(gomock.Any(), organizationID, groupID). + Return(&http.Response{StatusCode: http.StatusOK, Body: body, Header: map[string][]string{"Content-Type": {"json"}}}, nil) + + mockClient.EXPECT(). + RbacServiceAPIUpdateGroup(gomock.Any(), organizationID, groupID, gomock.Any()). + DoAndReturn(func(ctx context.Context, reqOrgID string, reqGroupID string, req sdk.RbacServiceAPIUpdateGroupJSONRequestBody) (*http.Response, error) { + r.Equal(organizationID, reqOrgID) + r.Equal(groupID, reqGroupID) + + body := &bytes.Buffer{} + err := json.NewEncoder(body).Encode(&sdk.CastaiRbacV1beta1Group{}) + r.NoError(err) + return &http.Response{StatusCode: http.StatusOK, Body: io.NopCloser(body), Header: map[string][]string{"Content-Type": {"json"}}}, nil + }) + + stateValue := cty.ObjectVal(map[string]cty.Value{ + "organization_id": cty.StringVal(organizationID), + }) + state := terraform.NewInstanceStateShimmedFromValue(stateValue, 0) + state.ID = groupID + + resource := resourceOrganizationGroup() + data := resource.Data(state) + + result := resource.UpdateContext(ctx, data, provider) + + r.Nil(result) + r.False(result.HasError()) + }) +} + +func TestOrganizationGroupCreateContext(t *testing.T) { + t.Parallel() + + t.Run("when RbacServiceAPI CreateGroup respond with 500 then throw error", func(t *testing.T) { + t.Parallel() + r := require.New(t) + mockClient := mock_sdk.NewMockClientInterface(gomock.NewController(t)) + + ctx := context.Background() + provider := &ProviderConfig{ + api: &sdk.ClientWithResponses{ + ClientInterface: mockClient, + }, + } + + organizationID := uuid.NewString() + + mockClient.EXPECT(). + RbacServiceAPICreateGroup(gomock.Any(), organizationID, gomock.Any()). + DoAndReturn(func(ctx context.Context, reqOrgID string, req sdk.RbacServiceAPICreateGroupJSONRequestBody) (*http.Response, error) { + r.Equal(organizationID, reqOrgID) + + body := &bytes.Buffer{} + err := json.NewEncoder(body).Encode(&sdk.CastaiRbacV1beta1Group{}) + r.NoError(err) + return &http.Response{StatusCode: http.StatusInternalServerError, Body: io.NopCloser(body), Header: map[string][]string{"Content-Type": {"json"}}}, nil + }) + + stateValue := cty.ObjectVal(map[string]cty.Value{ + "organization_id": cty.StringVal(organizationID), + }) + state := terraform.NewInstanceStateShimmedFromValue(stateValue, 0) + + resource := resourceOrganizationGroup() + data := resource.Data(state) + + result := resource.CreateContext(ctx, data, provider) + + r.NotNil(result) + r.True(result.HasError()) + r.Len(result, 1) + r.Contains(result[0].Summary, "create group: expected status code 200, received: status=500") + }) + + t.Run("when RbacServiceAPI CreateGroup respond with 200 then assume group was created", func(t *testing.T) { + t.Parallel() + r := require.New(t) + mockClient := mock_sdk.NewMockClientInterface(gomock.NewController(t)) + + ctx := context.Background() + provider := &ProviderConfig{ + api: &sdk.ClientWithResponses{ + ClientInterface: mockClient, + }, + } + + organizationID := uuid.NewString() + groupID := uuid.NewString() + + firstUserID := uuid.NewString() + secondUserID := uuid.NewString() + + body := io.NopCloser(bytes.NewReader([]byte(`{ + "id": "` + groupID + `", + "organizationId": "` + organizationID + `", + "name": "test group", + "description": "test group description changed", + "definition": { + "members": [ + { + "id": "` + firstUserID + `", + "email": "test-user-1@test.com" + }, + { + "id": "` + secondUserID + `", + "email": "test-user-2@test.com" + } + ] + } + }`))) + + mockClient.EXPECT(). + RbacServiceAPIGetGroup(gomock.Any(), organizationID, groupID). + Return(&http.Response{StatusCode: http.StatusOK, Body: body, Header: map[string][]string{"Content-Type": {"json"}}}, nil) + + mockClient.EXPECT(). + RbacServiceAPICreateGroup(gomock.Any(), organizationID, gomock.Any()). + DoAndReturn(func(ctx context.Context, reqOrgID string, req sdk.RbacServiceAPICreateGroupJSONRequestBody) (*http.Response, error) { + r.Equal(organizationID, reqOrgID) + + body := bytes.NewBuffer([]byte("")) + err := json.NewEncoder(body).Encode(&sdk.CastaiRbacV1beta1Group{ + Id: lo.ToPtr(groupID), + }) + r.NoError(err) + return &http.Response{StatusCode: http.StatusOK, Body: io.NopCloser(body), Header: map[string][]string{"Content-Type": {"json"}}}, nil + }) + + stateValue := cty.ObjectVal(map[string]cty.Value{ + "organization_id": cty.StringVal(organizationID), + }) + state := terraform.NewInstanceStateShimmedFromValue(stateValue, 0) + state.ID = groupID + + resource := resourceOrganizationGroup() + data := resource.Data(state) + + result := resource.CreateContext(ctx, data, provider) + + r.Nil(result) + r.False(result.HasError()) + }) +} + +func TestOrganizationGroupDeleteContext(t *testing.T) { + t.Parallel() + + t.Run("when state is missing group ID then return error", func(t *testing.T) { + t.Parallel() + r := require.New(t) + + ctx := context.Background() + provider := &ProviderConfig{} + + stateValue := cty.ObjectVal(map[string]cty.Value{}) + state := terraform.NewInstanceStateShimmedFromValue(stateValue, 0) + + resource := resourceOrganizationGroup() + data := resource.Data(state) + + result := resource.DeleteContext(ctx, data, provider) + + r.NotNil(result) + r.True(result.HasError()) + r.Len(result, 1) + r.Equal("group ID is not set", result[0].Summary) + }) + + t.Run("when RbacServiceAPI DeleteGroup respond with 500 then throw error", func(t *testing.T) { + t.Parallel() + r := require.New(t) + mockClient := mock_sdk.NewMockClientInterface(gomock.NewController(t)) + + ctx := context.Background() + provider := &ProviderConfig{ + api: &sdk.ClientWithResponses{ + ClientInterface: mockClient, + }, + } + + organizationID := uuid.NewString() + groupID := uuid.NewString() + + mockClient.EXPECT(). + RbacServiceAPIDeleteGroup(gomock.Any(), organizationID, groupID, gomock.Any()). + DoAndReturn(func(ctx context.Context, reqOrgID string, reqGroupID string) (*http.Response, error) { + r.Equal(organizationID, reqOrgID) + r.Equal(groupID, reqGroupID) + + body := &bytes.Buffer{} + err := json.NewEncoder(body).Encode(&sdk.CastaiRbacV1beta1Group{}) + r.NoError(err) + return &http.Response{StatusCode: http.StatusInternalServerError, Body: io.NopCloser(body), Header: map[string][]string{"Content-Type": {"json"}}}, nil + }) + + stateValue := cty.ObjectVal(map[string]cty.Value{ + "organization_id": cty.StringVal(organizationID), + }) + state := terraform.NewInstanceStateShimmedFromValue(stateValue, 0) + state.ID = groupID + + resource := resourceOrganizationGroup() + data := resource.Data(state) + + result := resource.DeleteContext(ctx, data, provider) + + r.NotNil(result) + r.True(result.HasError()) + r.Len(result, 1) + r.Contains(result[0].Summary, "destroy group: expected status code 200, received: status=500") + }) + + t.Run("when RbacServiceAPI DeleteGroup respond with 200 then no errors", func(t *testing.T) { + t.Parallel() + r := require.New(t) + mockClient := mock_sdk.NewMockClientInterface(gomock.NewController(t)) + + ctx := context.Background() + provider := &ProviderConfig{ + api: &sdk.ClientWithResponses{ + ClientInterface: mockClient, + }, + } + + organizationID := uuid.NewString() + groupID := uuid.NewString() + + mockClient.EXPECT(). + RbacServiceAPIDeleteGroup(gomock.Any(), organizationID, groupID, gomock.Any()). + DoAndReturn(func(ctx context.Context, reqOrgID string, reqGroupID string) (*http.Response, error) { + r.Equal(organizationID, reqOrgID) + r.Equal(groupID, reqGroupID) + + body := &bytes.Buffer{} + err := json.NewEncoder(body).Encode(&sdk.CastaiRbacV1beta1Group{}) + r.NoError(err) + return &http.Response{StatusCode: http.StatusOK, Body: io.NopCloser(body), Header: map[string][]string{"Content-Type": {"json"}}}, nil + }) + + stateValue := cty.ObjectVal(map[string]cty.Value{ + "organization_id": cty.StringVal(organizationID), + }) + state := terraform.NewInstanceStateShimmedFromValue(stateValue, 0) + state.ID = groupID + + resource := resourceOrganizationGroup() + data := resource.Data(state) + + result := resource.DeleteContext(ctx, data, provider) + + r.Nil(result) + r.False(result.HasError()) + }) +} diff --git a/castai/sdk/api.gen.go b/castai/sdk/api.gen.go index 87687d17..07076e1f 100644 --- a/castai/sdk/api.gen.go +++ b/castai/sdk/api.gen.go @@ -122,6 +122,20 @@ const ( Ssd CastaiInventoryV1beta1StorageInfoDeviceType = "ssd" ) +// Defines values for CastaiRbacV1beta1MemberKind. +const ( + SERVICEACCOUNT CastaiRbacV1beta1MemberKind = "SERVICE_ACCOUNT" + USER CastaiRbacV1beta1MemberKind = "USER" +) + +// Defines values for CastaiRbacV1beta1PoliciesState. +const ( + CastaiRbacV1beta1PoliciesStateACCEPTED CastaiRbacV1beta1PoliciesState = "ACCEPTED" + CastaiRbacV1beta1PoliciesStateCREATED CastaiRbacV1beta1PoliciesState = "CREATED" + CastaiRbacV1beta1PoliciesStateFAILED CastaiRbacV1beta1PoliciesState = "FAILED" + CastaiRbacV1beta1PoliciesStateUNKNOWN CastaiRbacV1beta1PoliciesState = "UNKNOWN" +) + // Defines values for CastaiSsoV1beta1OIDCType. const ( CastaiSsoV1beta1OIDCTypeTYPEBACKCHANNEL CastaiSsoV1beta1OIDCType = "TYPE_BACK_CHANNEL" @@ -297,9 +311,9 @@ const ( // Defines values for WorkloadoptimizationV1ApplyType. const ( - DEFERRED WorkloadoptimizationV1ApplyType = "DEFERRED" - IMMEDIATE WorkloadoptimizationV1ApplyType = "IMMEDIATE" - UNKNOWN WorkloadoptimizationV1ApplyType = "UNKNOWN" + WorkloadoptimizationV1ApplyTypeDEFERRED WorkloadoptimizationV1ApplyType = "DEFERRED" + WorkloadoptimizationV1ApplyTypeIMMEDIATE WorkloadoptimizationV1ApplyType = "IMMEDIATE" + WorkloadoptimizationV1ApplyTypeUNKNOWN WorkloadoptimizationV1ApplyType = "UNKNOWN" ) // Defines values for WorkloadoptimizationV1EventType. @@ -373,6 +387,29 @@ type ExternalClusterAPIGKECreateSARequest struct { Gke *ExternalclusterV1UpdateGKEClusterParams `json:"gke,omitempty"` } +// GroupsIsTheGroupsToBeUpdated defines model for Groups_is_the_groups_to_be_updated_. +type GroupsIsTheGroupsToBeUpdated struct { + Definition CastaiRbacV1beta1UpdateGroupRequestGroupDefinition `json:"definition"` + + // Description is the description of the group. + Description *string `json:"description,omitempty"` + + // Name is the name of the group. + Name string `json:"name"` +} + +// RoleBindingIsTheRoleBindingToBeUpdated defines model for RoleBinding_is_the_role_binding_to_be_updated_. +type RoleBindingIsTheRoleBindingToBeUpdated struct { + // Definition represents the role binding definition. + Definition CastaiRbacV1beta1RoleBindingDefinition `json:"definition"` + + // Description is the description of the role binding. + Description *string `json:"description,omitempty"` + + // Name is the name of the role binding. + Name string `json:"name"` +} + // UsersAPIUpdateOrganizationUserRequest defines model for UsersAPI_UpdateOrganizationUser_request. type UsersAPIUpdateOrganizationUserRequest struct { Role *string `json:"role,omitempty"` @@ -1305,6 +1342,251 @@ type CastaiOperationsV1beta1OperationError struct { Reason *string `json:"reason,omitempty"` } +// CastaiRbacV1beta1Author defines model for castai.rbac.v1beta1.Author. +type CastaiRbacV1beta1Author struct { + // Email is the email of the author. + Email *string `json:"email,omitempty"` + + // ID is the unique identifier of the author. + Id *string `json:"id,omitempty"` +} + +// ClusterScope represents the resource scope of the cluster. +// Resource can be any resources inside the organization. +type CastaiRbacV1beta1ClusterScope struct { + // ID is the unique identifier of the resource. + Id string `json:"id"` +} + +// CastaiRbacV1beta1CreateGroupRequestGroup defines model for castai.rbac.v1beta1.CreateGroupRequest.Group. +type CastaiRbacV1beta1CreateGroupRequestGroup struct { + Definition CastaiRbacV1beta1CreateGroupRequestGroupDefinition `json:"definition"` + + // Description is the description of the group. + Description *string `json:"description,omitempty"` + + // Name is the name of the group. + Name string `json:"name"` +} + +// CastaiRbacV1beta1CreateGroupRequestGroupDefinition defines model for castai.rbac.v1beta1.CreateGroupRequest.GroupDefinition. +type CastaiRbacV1beta1CreateGroupRequestGroupDefinition struct { + // Members is a list of members. + Members *[]CastaiRbacV1beta1Member `json:"members,omitempty"` +} + +// CastaiRbacV1beta1CreateRoleBindingsRequestRoleBinding defines model for castai.rbac.v1beta1.CreateRoleBindingsRequest.RoleBinding. +type CastaiRbacV1beta1CreateRoleBindingsRequestRoleBinding struct { + // Definition represents the role binding definition. + Definition CastaiRbacV1beta1RoleBindingDefinition `json:"definition"` + + // Description is the description of the role binding. + Description *string `json:"description,omitempty"` + + // Name is the name of the role binding. + Name string `json:"name"` +} + +// CastaiRbacV1beta1DeleteGroupResponse defines model for castai.rbac.v1beta1.DeleteGroupResponse. +type CastaiRbacV1beta1DeleteGroupResponse = map[string]interface{} + +// CastaiRbacV1beta1DeleteRoleBindingResponse defines model for castai.rbac.v1beta1.DeleteRoleBindingResponse. +type CastaiRbacV1beta1DeleteRoleBindingResponse = map[string]interface{} + +// CastaiRbacV1beta1Group defines model for castai.rbac.v1beta1.Group. +type CastaiRbacV1beta1Group struct { + // CreatedAt is the timestamp when the group was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + Definition CastaiRbacV1beta1GroupDefinition `json:"definition"` + + // Description is the description of the group. + Description *string `json:"description,omitempty"` + + // ID is the unique identifier of the group. + Id *string `json:"id,omitempty"` + + // Name is the name of the group. + Name *string `json:"name,omitempty"` + + // OrganizationID is the unique identifier of the organization. + OrganizationId *string `json:"organizationId,omitempty"` + + // UpdatedAt is the timestamp when the group was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` +} + +// CastaiRbacV1beta1GroupDefinition defines model for castai.rbac.v1beta1.GroupDefinition. +type CastaiRbacV1beta1GroupDefinition struct { + Author CastaiRbacV1beta1Author `json:"author"` + + // Members is a list of members. + Members *[]CastaiRbacV1beta1Member `json:"members,omitempty"` +} + +// GroupSubject represents the group subject. +type CastaiRbacV1beta1GroupSubject struct { + // ID is the unique identifier of the group. + Id string `json:"id"` + + // Name is the name of the group. + Name *string `json:"name,omitempty"` +} + +// CastaiRbacV1beta1Member defines model for castai.rbac.v1beta1.Member. +type CastaiRbacV1beta1Member struct { + // AddedAt is the timestamp when the user has been added to the group. + AddedAt *time.Time `json:"addedAt,omitempty"` + + // Email is the email of the member. + Email string `json:"email"` + + // ID is the internal unique identifier of the member. + Id string `json:"id"` + + // Kind represents the type of the member. + Kind CastaiRbacV1beta1MemberKind `json:"kind"` + + // LastLoginAt is the timestamp of the time when the user last time logged in. + LastLoginAt *time.Time `json:"lastLoginAt,omitempty"` +} + +// Kind represents the type of the member. +type CastaiRbacV1beta1MemberKind string + +// OrganizationScope represents the organization scope. +type CastaiRbacV1beta1OrganizationScope struct { + // ID is the unique identifier of the organization. + Id string `json:"id"` +} + +// PoliciesState represents the state of the policies generation. +// +// - ACCEPTED: ACCEPTED is the state when the policies async generation is ongoing. +// - CREATED: CREATED is the state when the policies have been generated. +// - FAILED: FAILED is the state when the policies generation failed. +type CastaiRbacV1beta1PoliciesState string + +// CastaiRbacV1beta1PolicyID defines model for castai.rbac.v1beta1.PolicyID. +type CastaiRbacV1beta1PolicyID struct { + Id string `json:"id"` +} + +// ResourceScope represents the resource scope. +// Resource can be any resources inside the organization. +type CastaiRbacV1beta1ResourceScope struct { + // ID is the unique identifier of the resource. + Id string `json:"id"` +} + +// CastaiRbacV1beta1RoleBinding defines model for castai.rbac.v1beta1.RoleBinding. +type CastaiRbacV1beta1RoleBinding struct { + // CreatedAt is the timestamp when the role binding was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // Definition represents the role binding definition. + Definition CastaiRbacV1beta1RoleBindingDefinition `json:"definition"` + + // Description is the description of the role binding. + Description *string `json:"description,omitempty"` + + // ID is the unique identifier of the role binding. + Id *string `json:"id,omitempty"` + + // Name is the name of the role binding. + Name *string `json:"name,omitempty"` + OrganizationId *string `json:"organizationId,omitempty"` + + // Status is the status of the role binding, reflecting the state of the related policies generation. + Status *[]CastaiRbacV1beta1RoleBindingStatus `json:"status,omitempty"` + + // UpdatedAt is the timestamp when the role binding was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` +} + +// Definition represents the role binding definition. +type CastaiRbacV1beta1RoleBindingDefinition struct { + // RoleID is the unique identifier of the role. + RoleId string `json:"roleId"` + + // Scope represents the scope of the role binding. + Scope CastaiRbacV1beta1Scope `json:"scope"` + + // Subjects is a list of subjects. + Subjects *[]CastaiRbacV1beta1Subject `json:"subjects,omitempty"` +} + +// RoleBindingStatus is the status of the role binding, reflecting the state of the related policies generation. +type CastaiRbacV1beta1RoleBindingStatus struct { + // Message is providing more information about the state. + Message *string `json:"message,omitempty"` + + // Policies are the unique identifiers of the related policies. + Policies *[]CastaiRbacV1beta1PolicyID `json:"policies,omitempty"` + + // PoliciesState represents the state of the policies generation. + // + // - ACCEPTED: ACCEPTED is the state when the policies async generation is ongoing. + // - CREATED: CREATED is the state when the policies have been generated. + // - FAILED: FAILED is the state when the policies generation failed. + State CastaiRbacV1beta1PoliciesState `json:"state"` + + // UpdatedAt is the timestamp when the status was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` +} + +// Scope represents the scope of the role binding. +type CastaiRbacV1beta1Scope struct { + // ClusterScope represents the resource scope of the cluster. + // Resource can be any resources inside the organization. + Cluster *CastaiRbacV1beta1ClusterScope `json:"cluster,omitempty"` + + // OrganizationScope represents the organization scope. + Organization *CastaiRbacV1beta1OrganizationScope `json:"organization,omitempty"` + + // ResourceScope represents the resource scope. + // Resource can be any resources inside the organization. + Resource *CastaiRbacV1beta1ResourceScope `json:"resource,omitempty"` +} + +// ServiceAccountSubject represents the service account subject. +type CastaiRbacV1beta1ServiceAccountSubject struct { + // ID is the unique identifier of the service account. + Id string `json:"id"` + + // Name is the name of the service account. + Name *string `json:"name,omitempty"` +} + +// Subject represents the subject of the role binding. +type CastaiRbacV1beta1Subject struct { + // GroupSubject represents the group subject. + Group *CastaiRbacV1beta1GroupSubject `json:"group,omitempty"` + + // ServiceAccountSubject represents the service account subject. + ServiceAccount *CastaiRbacV1beta1ServiceAccountSubject `json:"serviceAccount,omitempty"` + + // UserSubject represents the user subject. + User *CastaiRbacV1beta1UserSubject `json:"user,omitempty"` +} + +// CastaiRbacV1beta1UpdateGroupRequestGroupDefinition defines model for castai.rbac.v1beta1.UpdateGroupRequest.GroupDefinition. +type CastaiRbacV1beta1UpdateGroupRequestGroupDefinition struct { + // Members is a list of members. + Members []CastaiRbacV1beta1Member `json:"members"` +} + +// UserSubject represents the user subject. +type CastaiRbacV1beta1UserSubject struct { + // Email is the email of the user. + Email *string `json:"email,omitempty"` + + // ID is the unique identifier of the user. + Id string `json:"id"` + + // Name is the name of the user. + Name *string `json:"name,omitempty"` +} + // AzureAAD represents a Azure AAD connector. type CastaiSsoV1beta1AzureAAD struct { // ADDomain is the domain of the Azure AD. @@ -3968,18 +4250,6 @@ type WorkloadoptimizationV1TimeSeriesMetric struct { Value float64 `json:"value"` } -// WorkloadoptimizationV1UpdateWorkload defines model for workloadoptimization.v1.UpdateWorkload. -type WorkloadoptimizationV1UpdateWorkload struct { - // Defines the scaling policy ID assigned to the workload. - ScalingPolicyId string `json:"scalingPolicyId"` - WorkloadConfig *WorkloadoptimizationV1WorkloadConfigUpdate `json:"workloadConfig,omitempty"` -} - -// WorkloadoptimizationV1UpdateWorkloadResponse defines model for workloadoptimization.v1.UpdateWorkloadResponse. -type WorkloadoptimizationV1UpdateWorkloadResponse struct { - Workload *WorkloadoptimizationV1Workload `json:"workload,omitempty"` -} - // WorkloadoptimizationV1UpdateWorkloadResponseV2 defines model for workloadoptimization.v1.UpdateWorkloadResponseV2. type WorkloadoptimizationV1UpdateWorkloadResponseV2 struct { Workload *WorkloadoptimizationV1Workload `json:"workload,omitempty"` @@ -4074,38 +4344,9 @@ type WorkloadoptimizationV1Workload struct { ScalingPolicyId string `json:"scalingPolicyId"` UpdatedAt time.Time `json:"updatedAt"` Version string `json:"version"` - WorkloadConfig WorkloadoptimizationV1WorkloadConfig `json:"workloadConfig"` WorkloadConfigV2 WorkloadoptimizationV1WorkloadConfigV2 `json:"workloadConfigV2"` } -// WorkloadoptimizationV1WorkloadConfig defines model for workloadoptimization.v1.WorkloadConfig. -type WorkloadoptimizationV1WorkloadConfig struct { - AntiAffinity WorkloadoptimizationV1AntiAffinitySettings `json:"antiAffinity"` - ContainerConstraints []WorkloadoptimizationV1ContainerConstraints `json:"containerConstraints"` - Cpu WorkloadoptimizationV1ResourceConfig `json:"cpu"` - - // Defines possible options for workload management. - // READ_ONLY - workload watched (metrics collected), but no actions may be performed by CAST AI. - // MANAGED - workload watched (metrics collected), CAST AI may perform actions on the workload. - ManagementOption WorkloadoptimizationV1ManagementOption `json:"managementOption"` - Memory WorkloadoptimizationV1ResourceConfig `json:"memory"` - MemoryEvent *WorkloadoptimizationV1MemoryEventSettings `json:"memoryEvent,omitempty"` -} - -// WorkloadoptimizationV1WorkloadConfigUpdate defines model for workloadoptimization.v1.WorkloadConfigUpdate. -type WorkloadoptimizationV1WorkloadConfigUpdate struct { - AntiAffinity *WorkloadoptimizationV1AntiAffinitySettings `json:"antiAffinity,omitempty"` - ContainerConfig *[]WorkloadoptimizationV1ContainerConfigUpdate `json:"containerConfig,omitempty"` - Cpu *WorkloadoptimizationV1WorkloadResourceConfigUpdate `json:"cpu,omitempty"` - - // Defines possible options for workload management. - // READ_ONLY - workload watched (metrics collected), but no actions may be performed by CAST AI. - // MANAGED - workload watched (metrics collected), CAST AI may perform actions on the workload. - ManagementOption *WorkloadoptimizationV1ManagementOption `json:"managementOption,omitempty"` - Memory *WorkloadoptimizationV1WorkloadResourceConfigUpdate `json:"memory,omitempty"` - MemoryEvent *WorkloadoptimizationV1MemoryEventSettings `json:"memoryEvent,omitempty"` -} - // WorkloadoptimizationV1WorkloadConfigUpdateV2 defines model for workloadoptimization.v1.WorkloadConfigUpdateV2. type WorkloadoptimizationV1WorkloadConfigUpdateV2 struct { HpaConfig *WorkloadoptimizationV1HPAConfigUpdate `json:"hpaConfig,omitempty"` @@ -4403,12 +4644,24 @@ type UsersAPICreateOrganizationJSONBody = CastaiUsersV1beta1Organization // UsersAPIEditOrganizationJSONBody defines parameters for UsersAPIEditOrganization. type UsersAPIEditOrganizationJSONBody = CastaiUsersV1beta1Organization +// RbacServiceAPICreateGroupJSONBody defines parameters for RbacServiceAPICreateGroup. +type RbacServiceAPICreateGroupJSONBody = CastaiRbacV1beta1CreateGroupRequestGroup + +// RbacServiceAPIUpdateGroupJSONBody defines parameters for RbacServiceAPIUpdateGroup. +type RbacServiceAPIUpdateGroupJSONBody = GroupsIsTheGroupsToBeUpdated + // InventoryAPIAddReservationJSONBody defines parameters for InventoryAPIAddReservation. type InventoryAPIAddReservationJSONBody = CastaiInventoryV1beta1GenericReservation // InventoryAPIOverwriteReservationsJSONBody defines parameters for InventoryAPIOverwriteReservations. type InventoryAPIOverwriteReservationsJSONBody = CastaiInventoryV1beta1GenericReservationsList +// RbacServiceAPICreateRoleBindingsJSONBody defines parameters for RbacServiceAPICreateRoleBindings. +type RbacServiceAPICreateRoleBindingsJSONBody = []CastaiRbacV1beta1CreateRoleBindingsRequestRoleBinding + +// RbacServiceAPIUpdateRoleBindingJSONBody defines parameters for RbacServiceAPIUpdateRoleBinding. +type RbacServiceAPIUpdateRoleBindingJSONBody = RoleBindingIsTheRoleBindingToBeUpdated + // UsersAPIRemoveOrganizationUsersParams defines parameters for UsersAPIRemoveOrganizationUsers. type UsersAPIRemoveOrganizationUsersParams struct { // Users is the list of user ids to remove. @@ -4555,9 +4808,6 @@ type WorkloadOptimizationAPIGetWorkloadParams struct { ToTime *time.Time `form:"toTime,omitempty" json:"toTime,omitempty"` } -// WorkloadOptimizationAPIUpdateWorkloadJSONBody defines parameters for WorkloadOptimizationAPIUpdateWorkload. -type WorkloadOptimizationAPIUpdateWorkloadJSONBody = WorkloadoptimizationV1UpdateWorkload - // WorkloadOptimizationAPIGetInstallCmdParams defines parameters for WorkloadOptimizationAPIGetInstallCmd. type WorkloadOptimizationAPIGetInstallCmdParams struct { ClusterId string `form:"clusterId" json:"clusterId"` @@ -4656,12 +4906,24 @@ type UsersAPICreateOrganizationJSONRequestBody = UsersAPICreateOrganizationJSONB // UsersAPIEditOrganizationJSONRequestBody defines body for UsersAPIEditOrganization for application/json ContentType. type UsersAPIEditOrganizationJSONRequestBody = UsersAPIEditOrganizationJSONBody +// RbacServiceAPICreateGroupJSONRequestBody defines body for RbacServiceAPICreateGroup for application/json ContentType. +type RbacServiceAPICreateGroupJSONRequestBody = RbacServiceAPICreateGroupJSONBody + +// RbacServiceAPIUpdateGroupJSONRequestBody defines body for RbacServiceAPIUpdateGroup for application/json ContentType. +type RbacServiceAPIUpdateGroupJSONRequestBody = RbacServiceAPIUpdateGroupJSONBody + // InventoryAPIAddReservationJSONRequestBody defines body for InventoryAPIAddReservation for application/json ContentType. type InventoryAPIAddReservationJSONRequestBody = InventoryAPIAddReservationJSONBody // InventoryAPIOverwriteReservationsJSONRequestBody defines body for InventoryAPIOverwriteReservations for application/json ContentType. type InventoryAPIOverwriteReservationsJSONRequestBody = InventoryAPIOverwriteReservationsJSONBody +// RbacServiceAPICreateRoleBindingsJSONRequestBody defines body for RbacServiceAPICreateRoleBindings for application/json ContentType. +type RbacServiceAPICreateRoleBindingsJSONRequestBody = RbacServiceAPICreateRoleBindingsJSONBody + +// RbacServiceAPIUpdateRoleBindingJSONRequestBody defines body for RbacServiceAPIUpdateRoleBinding for application/json ContentType. +type RbacServiceAPIUpdateRoleBindingJSONRequestBody = RbacServiceAPIUpdateRoleBindingJSONBody + // UsersAPIAddUserToOrganizationJSONRequestBody defines body for UsersAPIAddUserToOrganization for application/json ContentType. type UsersAPIAddUserToOrganizationJSONRequestBody = UsersAPIAddUserToOrganizationJSONBody @@ -4701,9 +4963,6 @@ type WorkloadOptimizationAPIUpdateWorkloadScalingPolicyJSONRequestBody = Workloa // WorkloadOptimizationAPIAssignScalingPolicyWorkloadsJSONRequestBody defines body for WorkloadOptimizationAPIAssignScalingPolicyWorkloads for application/json ContentType. type WorkloadOptimizationAPIAssignScalingPolicyWorkloadsJSONRequestBody = WorkloadOptimizationAPIAssignScalingPolicyWorkloadsJSONBody -// WorkloadOptimizationAPIUpdateWorkloadJSONRequestBody defines body for WorkloadOptimizationAPIUpdateWorkload for application/json ContentType. -type WorkloadOptimizationAPIUpdateWorkloadJSONRequestBody = WorkloadOptimizationAPIUpdateWorkloadJSONBody - // WorkloadOptimizationAPIUpdateWorkloadV2JSONRequestBody defines body for WorkloadOptimizationAPIUpdateWorkloadV2 for application/json ContentType. type WorkloadOptimizationAPIUpdateWorkloadV2JSONRequestBody = WorkloadOptimizationAPIUpdateWorkloadV2JSONBody diff --git a/castai/sdk/client.gen.go b/castai/sdk/client.gen.go index 2585659b..d0b70865 100644 --- a/castai/sdk/client.gen.go +++ b/castai/sdk/client.gen.go @@ -371,6 +371,22 @@ type ClientInterface interface { // InventoryAPISyncClusterResources request InventoryAPISyncClusterResources(ctx context.Context, organizationId string, clusterId string, reqEditors ...RequestEditorFn) (*http.Response, error) + // RbacServiceAPICreateGroup request with any body + RbacServiceAPICreateGroupWithBody(ctx context.Context, organizationId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + RbacServiceAPICreateGroup(ctx context.Context, organizationId string, body RbacServiceAPICreateGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // RbacServiceAPIUpdateGroup request with any body + RbacServiceAPIUpdateGroupWithBody(ctx context.Context, organizationId string, groupId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + RbacServiceAPIUpdateGroup(ctx context.Context, organizationId string, groupId string, body RbacServiceAPIUpdateGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // RbacServiceAPIDeleteGroup request + RbacServiceAPIDeleteGroup(ctx context.Context, organizationId string, id string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // RbacServiceAPIGetGroup request + RbacServiceAPIGetGroup(ctx context.Context, organizationId string, id string, reqEditors ...RequestEditorFn) (*http.Response, error) + // InventoryAPIGetReservations request InventoryAPIGetReservations(ctx context.Context, organizationId string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -390,6 +406,22 @@ type ClientInterface interface { // InventoryAPIDeleteReservation request InventoryAPIDeleteReservation(ctx context.Context, organizationId string, reservationId string, reqEditors ...RequestEditorFn) (*http.Response, error) + // RbacServiceAPICreateRoleBindings request with any body + RbacServiceAPICreateRoleBindingsWithBody(ctx context.Context, organizationId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + RbacServiceAPICreateRoleBindings(ctx context.Context, organizationId string, body RbacServiceAPICreateRoleBindingsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // RbacServiceAPIDeleteRoleBinding request + RbacServiceAPIDeleteRoleBinding(ctx context.Context, organizationId string, id string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // RbacServiceAPIGetRoleBinding request + RbacServiceAPIGetRoleBinding(ctx context.Context, organizationId string, id string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // RbacServiceAPIUpdateRoleBinding request with any body + RbacServiceAPIUpdateRoleBindingWithBody(ctx context.Context, organizationId string, roleBindingId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + RbacServiceAPIUpdateRoleBinding(ctx context.Context, organizationId string, roleBindingId string, body RbacServiceAPIUpdateRoleBindingJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // UsersAPIRemoveOrganizationUsers request UsersAPIRemoveOrganizationUsers(ctx context.Context, organizationId string, params *UsersAPIRemoveOrganizationUsersParams, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -548,11 +580,6 @@ type ClientInterface interface { // WorkloadOptimizationAPIGetWorkload request WorkloadOptimizationAPIGetWorkload(ctx context.Context, clusterId string, workloadId string, params *WorkloadOptimizationAPIGetWorkloadParams, reqEditors ...RequestEditorFn) (*http.Response, error) - // WorkloadOptimizationAPIUpdateWorkload request with any body - WorkloadOptimizationAPIUpdateWorkloadWithBody(ctx context.Context, clusterId string, workloadId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - WorkloadOptimizationAPIUpdateWorkload(ctx context.Context, clusterId string, workloadId string, body WorkloadOptimizationAPIUpdateWorkloadJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // WorkloadOptimizationAPIGetInstallCmd request WorkloadOptimizationAPIGetInstallCmd(ctx context.Context, params *WorkloadOptimizationAPIGetInstallCmdParams, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1804,6 +1831,78 @@ func (c *Client) InventoryAPISyncClusterResources(ctx context.Context, organizat return c.Client.Do(req) } +func (c *Client) RbacServiceAPICreateGroupWithBody(ctx context.Context, organizationId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewRbacServiceAPICreateGroupRequestWithBody(c.Server, organizationId, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) RbacServiceAPICreateGroup(ctx context.Context, organizationId string, body RbacServiceAPICreateGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewRbacServiceAPICreateGroupRequest(c.Server, organizationId, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) RbacServiceAPIUpdateGroupWithBody(ctx context.Context, organizationId string, groupId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewRbacServiceAPIUpdateGroupRequestWithBody(c.Server, organizationId, groupId, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) RbacServiceAPIUpdateGroup(ctx context.Context, organizationId string, groupId string, body RbacServiceAPIUpdateGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewRbacServiceAPIUpdateGroupRequest(c.Server, organizationId, groupId, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) RbacServiceAPIDeleteGroup(ctx context.Context, organizationId string, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewRbacServiceAPIDeleteGroupRequest(c.Server, organizationId, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) RbacServiceAPIGetGroup(ctx context.Context, organizationId string, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewRbacServiceAPIGetGroupRequest(c.Server, organizationId, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) InventoryAPIGetReservations(ctx context.Context, organizationId string, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewInventoryAPIGetReservationsRequest(c.Server, organizationId) if err != nil { @@ -1888,6 +1987,78 @@ func (c *Client) InventoryAPIDeleteReservation(ctx context.Context, organization return c.Client.Do(req) } +func (c *Client) RbacServiceAPICreateRoleBindingsWithBody(ctx context.Context, organizationId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewRbacServiceAPICreateRoleBindingsRequestWithBody(c.Server, organizationId, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) RbacServiceAPICreateRoleBindings(ctx context.Context, organizationId string, body RbacServiceAPICreateRoleBindingsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewRbacServiceAPICreateRoleBindingsRequest(c.Server, organizationId, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) RbacServiceAPIDeleteRoleBinding(ctx context.Context, organizationId string, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewRbacServiceAPIDeleteRoleBindingRequest(c.Server, organizationId, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) RbacServiceAPIGetRoleBinding(ctx context.Context, organizationId string, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewRbacServiceAPIGetRoleBindingRequest(c.Server, organizationId, id) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) RbacServiceAPIUpdateRoleBindingWithBody(ctx context.Context, organizationId string, roleBindingId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewRbacServiceAPIUpdateRoleBindingRequestWithBody(c.Server, organizationId, roleBindingId, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) RbacServiceAPIUpdateRoleBinding(ctx context.Context, organizationId string, roleBindingId string, body RbacServiceAPIUpdateRoleBindingJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewRbacServiceAPIUpdateRoleBindingRequest(c.Server, organizationId, roleBindingId, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) UsersAPIRemoveOrganizationUsers(ctx context.Context, organizationId string, params *UsersAPIRemoveOrganizationUsersParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewUsersAPIRemoveOrganizationUsersRequest(c.Server, organizationId, params) if err != nil { @@ -2572,30 +2743,6 @@ func (c *Client) WorkloadOptimizationAPIGetWorkload(ctx context.Context, cluster return c.Client.Do(req) } -func (c *Client) WorkloadOptimizationAPIUpdateWorkloadWithBody(ctx context.Context, clusterId string, workloadId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewWorkloadOptimizationAPIUpdateWorkloadRequestWithBody(c.Server, clusterId, workloadId, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) WorkloadOptimizationAPIUpdateWorkload(ctx context.Context, clusterId string, workloadId string, body WorkloadOptimizationAPIUpdateWorkloadJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewWorkloadOptimizationAPIUpdateWorkloadRequest(c.Server, clusterId, workloadId, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - func (c *Client) WorkloadOptimizationAPIGetInstallCmd(ctx context.Context, params *WorkloadOptimizationAPIGetInstallCmdParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewWorkloadOptimizationAPIGetInstallCmdRequest(c.Server, params) if err != nil { @@ -6183,8 +6330,19 @@ func NewInventoryAPISyncClusterResourcesRequest(server string, organizationId st return req, nil } -// NewInventoryAPIGetReservationsRequest generates requests for InventoryAPIGetReservations -func NewInventoryAPIGetReservationsRequest(server string, organizationId string) (*http.Request, error) { +// NewRbacServiceAPICreateGroupRequest calls the generic RbacServiceAPICreateGroup builder with application/json body +func NewRbacServiceAPICreateGroupRequest(server string, organizationId string, body RbacServiceAPICreateGroupJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewRbacServiceAPICreateGroupRequestWithBody(server, organizationId, "application/json", bodyReader) +} + +// NewRbacServiceAPICreateGroupRequestWithBody generates requests for RbacServiceAPICreateGroup with any type of body +func NewRbacServiceAPICreateGroupRequestWithBody(server string, organizationId string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -6199,7 +6357,7 @@ func NewInventoryAPIGetReservationsRequest(server string, organizationId string) return nil, err } - operationPath := fmt.Sprintf("/v1/organizations/%s/reservations", pathParam0) + operationPath := fmt.Sprintf("/v1/organizations/%s/groups", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -6209,27 +6367,29 @@ func NewInventoryAPIGetReservationsRequest(server string, organizationId string) return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err } + req.Header.Add("Content-Type", contentType) + return req, nil } -// NewInventoryAPIAddReservationRequest calls the generic InventoryAPIAddReservation builder with application/json body -func NewInventoryAPIAddReservationRequest(server string, organizationId string, body InventoryAPIAddReservationJSONRequestBody) (*http.Request, error) { +// NewRbacServiceAPIUpdateGroupRequest calls the generic RbacServiceAPIUpdateGroup builder with application/json body +func NewRbacServiceAPIUpdateGroupRequest(server string, organizationId string, groupId string, body RbacServiceAPIUpdateGroupJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewInventoryAPIAddReservationRequestWithBody(server, organizationId, "application/json", bodyReader) + return NewRbacServiceAPIUpdateGroupRequestWithBody(server, organizationId, groupId, "application/json", bodyReader) } -// NewInventoryAPIAddReservationRequestWithBody generates requests for InventoryAPIAddReservation with any type of body -func NewInventoryAPIAddReservationRequestWithBody(server string, organizationId string, contentType string, body io.Reader) (*http.Request, error) { +// NewRbacServiceAPIUpdateGroupRequestWithBody generates requests for RbacServiceAPIUpdateGroup with any type of body +func NewRbacServiceAPIUpdateGroupRequestWithBody(server string, organizationId string, groupId string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -6239,12 +6399,19 @@ func NewInventoryAPIAddReservationRequestWithBody(server string, organizationId return nil, err } + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "group.id", runtime.ParamLocationPath, groupId) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/v1/organizations/%s/reservations", pathParam0) + operationPath := fmt.Sprintf("/v1/organizations/%s/groups/%s", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -6254,7 +6421,7 @@ func NewInventoryAPIAddReservationRequestWithBody(server string, organizationId return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) + req, err := http.NewRequest("PATCH", queryURL.String(), body) if err != nil { return nil, err } @@ -6264,8 +6431,8 @@ func NewInventoryAPIAddReservationRequestWithBody(server string, organizationId return req, nil } -// NewInventoryAPIGetReservationsBalanceRequest generates requests for InventoryAPIGetReservationsBalance -func NewInventoryAPIGetReservationsBalanceRequest(server string, organizationId string) (*http.Request, error) { +// NewRbacServiceAPIDeleteGroupRequest generates requests for RbacServiceAPIDeleteGroup +func NewRbacServiceAPIDeleteGroupRequest(server string, organizationId string, id string) (*http.Request, error) { var err error var pathParam0 string @@ -6275,12 +6442,19 @@ func NewInventoryAPIGetReservationsBalanceRequest(server string, organizationId return nil, err } + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/v1/organizations/%s/reservations/balance", pathParam0) + operationPath := fmt.Sprintf("/v1/organizations/%s/groups/%s", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -6290,7 +6464,7 @@ func NewInventoryAPIGetReservationsBalanceRequest(server string, organizationId return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { return nil, err } @@ -6298,19 +6472,8 @@ func NewInventoryAPIGetReservationsBalanceRequest(server string, organizationId return req, nil } -// NewInventoryAPIOverwriteReservationsRequest calls the generic InventoryAPIOverwriteReservations builder with application/json body -func NewInventoryAPIOverwriteReservationsRequest(server string, organizationId string, body InventoryAPIOverwriteReservationsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewInventoryAPIOverwriteReservationsRequestWithBody(server, organizationId, "application/json", bodyReader) -} - -// NewInventoryAPIOverwriteReservationsRequestWithBody generates requests for InventoryAPIOverwriteReservations with any type of body -func NewInventoryAPIOverwriteReservationsRequestWithBody(server string, organizationId string, contentType string, body io.Reader) (*http.Request, error) { +// NewRbacServiceAPIGetGroupRequest generates requests for RbacServiceAPIGetGroup +func NewRbacServiceAPIGetGroupRequest(server string, organizationId string, id string) (*http.Request, error) { var err error var pathParam0 string @@ -6320,12 +6483,19 @@ func NewInventoryAPIOverwriteReservationsRequestWithBody(server string, organiza return nil, err } + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/v1/organizations/%s/reservations/overwrite", pathParam0) + operationPath := fmt.Sprintf("/v1/organizations/%s/groups/%s", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -6335,18 +6505,16 @@ func NewInventoryAPIOverwriteReservationsRequestWithBody(server string, organiza return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - req.Header.Add("Content-Type", contentType) - return req, nil } -// NewInventoryAPIDeleteReservationRequest generates requests for InventoryAPIDeleteReservation -func NewInventoryAPIDeleteReservationRequest(server string, organizationId string, reservationId string) (*http.Request, error) { +// NewInventoryAPIGetReservationsRequest generates requests for InventoryAPIGetReservations +func NewInventoryAPIGetReservationsRequest(server string, organizationId string) (*http.Request, error) { var err error var pathParam0 string @@ -6356,19 +6524,12 @@ func NewInventoryAPIDeleteReservationRequest(server string, organizationId strin return nil, err } - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "reservationId", runtime.ParamLocationPath, reservationId) - if err != nil { - return nil, err - } - serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/v1/organizations/%s/reservations/%s", pathParam0, pathParam1) + operationPath := fmt.Sprintf("/v1/organizations/%s/reservations", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -6378,7 +6539,7 @@ func NewInventoryAPIDeleteReservationRequest(server string, organizationId strin return nil, err } - req, err := http.NewRequest("DELETE", queryURL.String(), nil) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } @@ -6386,8 +6547,19 @@ func NewInventoryAPIDeleteReservationRequest(server string, organizationId strin return req, nil } -// NewUsersAPIRemoveOrganizationUsersRequest generates requests for UsersAPIRemoveOrganizationUsers -func NewUsersAPIRemoveOrganizationUsersRequest(server string, organizationId string, params *UsersAPIRemoveOrganizationUsersParams) (*http.Request, error) { +// NewInventoryAPIAddReservationRequest calls the generic InventoryAPIAddReservation builder with application/json body +func NewInventoryAPIAddReservationRequest(server string, organizationId string, body InventoryAPIAddReservationJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewInventoryAPIAddReservationRequestWithBody(server, organizationId, "application/json", bodyReader) +} + +// NewInventoryAPIAddReservationRequestWithBody generates requests for InventoryAPIAddReservation with any type of body +func NewInventoryAPIAddReservationRequestWithBody(server string, organizationId string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -6402,7 +6574,7 @@ func NewUsersAPIRemoveOrganizationUsersRequest(server string, organizationId str return nil, err } - operationPath := fmt.Sprintf("/v1/organizations/%s/users", pathParam0) + operationPath := fmt.Sprintf("/v1/organizations/%s/reservations", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -6412,9 +6584,350 @@ func NewUsersAPIRemoveOrganizationUsersRequest(server string, organizationId str return nil, err } - queryValues := queryURL.Query() - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "users", runtime.ParamLocationQuery, params.Users); err != nil { + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewInventoryAPIGetReservationsBalanceRequest generates requests for InventoryAPIGetReservationsBalance +func NewInventoryAPIGetReservationsBalanceRequest(server string, organizationId string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationId", runtime.ParamLocationPath, organizationId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/reservations/balance", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewInventoryAPIOverwriteReservationsRequest calls the generic InventoryAPIOverwriteReservations builder with application/json body +func NewInventoryAPIOverwriteReservationsRequest(server string, organizationId string, body InventoryAPIOverwriteReservationsJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewInventoryAPIOverwriteReservationsRequestWithBody(server, organizationId, "application/json", bodyReader) +} + +// NewInventoryAPIOverwriteReservationsRequestWithBody generates requests for InventoryAPIOverwriteReservations with any type of body +func NewInventoryAPIOverwriteReservationsRequestWithBody(server string, organizationId string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationId", runtime.ParamLocationPath, organizationId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/reservations/overwrite", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewInventoryAPIDeleteReservationRequest generates requests for InventoryAPIDeleteReservation +func NewInventoryAPIDeleteReservationRequest(server string, organizationId string, reservationId string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationId", runtime.ParamLocationPath, organizationId) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "reservationId", runtime.ParamLocationPath, reservationId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/reservations/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewRbacServiceAPICreateRoleBindingsRequest calls the generic RbacServiceAPICreateRoleBindings builder with application/json body +func NewRbacServiceAPICreateRoleBindingsRequest(server string, organizationId string, body RbacServiceAPICreateRoleBindingsJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewRbacServiceAPICreateRoleBindingsRequestWithBody(server, organizationId, "application/json", bodyReader) +} + +// NewRbacServiceAPICreateRoleBindingsRequestWithBody generates requests for RbacServiceAPICreateRoleBindings with any type of body +func NewRbacServiceAPICreateRoleBindingsRequestWithBody(server string, organizationId string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationId", runtime.ParamLocationPath, organizationId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/role-bindings", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewRbacServiceAPIDeleteRoleBindingRequest generates requests for RbacServiceAPIDeleteRoleBinding +func NewRbacServiceAPIDeleteRoleBindingRequest(server string, organizationId string, id string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationId", runtime.ParamLocationPath, organizationId) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/role-bindings/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewRbacServiceAPIGetRoleBindingRequest generates requests for RbacServiceAPIGetRoleBinding +func NewRbacServiceAPIGetRoleBindingRequest(server string, organizationId string, id string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationId", runtime.ParamLocationPath, organizationId) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/role-bindings/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewRbacServiceAPIUpdateRoleBindingRequest calls the generic RbacServiceAPIUpdateRoleBinding builder with application/json body +func NewRbacServiceAPIUpdateRoleBindingRequest(server string, organizationId string, roleBindingId string, body RbacServiceAPIUpdateRoleBindingJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewRbacServiceAPIUpdateRoleBindingRequestWithBody(server, organizationId, roleBindingId, "application/json", bodyReader) +} + +// NewRbacServiceAPIUpdateRoleBindingRequestWithBody generates requests for RbacServiceAPIUpdateRoleBinding with any type of body +func NewRbacServiceAPIUpdateRoleBindingRequestWithBody(server string, organizationId string, roleBindingId string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationId", runtime.ParamLocationPath, organizationId) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "roleBinding.id", runtime.ParamLocationPath, roleBindingId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/role-bindings/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("PATCH", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewUsersAPIRemoveOrganizationUsersRequest generates requests for UsersAPIRemoveOrganizationUsers +func NewUsersAPIRemoveOrganizationUsersRequest(server string, organizationId string, params *UsersAPIRemoveOrganizationUsersParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationId", runtime.ParamLocationPath, organizationId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/users", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + queryValues := queryURL.Query() + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "users", runtime.ParamLocationQuery, params.Users); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err @@ -8441,65 +8954,11 @@ func NewWorkloadOptimizationAPIGetWorkloadRequest(server string, clusterId strin queryURL.RawQuery = queryValues.Encode() - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewWorkloadOptimizationAPIUpdateWorkloadRequest calls the generic WorkloadOptimizationAPIUpdateWorkload builder with application/json body -func NewWorkloadOptimizationAPIUpdateWorkloadRequest(server string, clusterId string, workloadId string, body WorkloadOptimizationAPIUpdateWorkloadJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewWorkloadOptimizationAPIUpdateWorkloadRequestWithBody(server, clusterId, workloadId, "application/json", bodyReader) -} - -// NewWorkloadOptimizationAPIUpdateWorkloadRequestWithBody generates requests for WorkloadOptimizationAPIUpdateWorkload with any type of body -func NewWorkloadOptimizationAPIUpdateWorkloadRequestWithBody(server string, clusterId string, workloadId string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "clusterId", runtime.ParamLocationPath, clusterId) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "workloadId", runtime.ParamLocationPath, workloadId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/workload-autoscaling/clusters/%s/workloads/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - req.Header.Add("Content-Type", contentType) - return req, nil } @@ -9014,6 +9473,22 @@ type ClientWithResponsesInterface interface { // InventoryAPISyncClusterResources request InventoryAPISyncClusterResourcesWithResponse(ctx context.Context, organizationId string, clusterId string) (*InventoryAPISyncClusterResourcesResponse, error) + // RbacServiceAPICreateGroup request with any body + RbacServiceAPICreateGroupWithBodyWithResponse(ctx context.Context, organizationId string, contentType string, body io.Reader) (*RbacServiceAPICreateGroupResponse, error) + + RbacServiceAPICreateGroupWithResponse(ctx context.Context, organizationId string, body RbacServiceAPICreateGroupJSONRequestBody) (*RbacServiceAPICreateGroupResponse, error) + + // RbacServiceAPIUpdateGroup request with any body + RbacServiceAPIUpdateGroupWithBodyWithResponse(ctx context.Context, organizationId string, groupId string, contentType string, body io.Reader) (*RbacServiceAPIUpdateGroupResponse, error) + + RbacServiceAPIUpdateGroupWithResponse(ctx context.Context, organizationId string, groupId string, body RbacServiceAPIUpdateGroupJSONRequestBody) (*RbacServiceAPIUpdateGroupResponse, error) + + // RbacServiceAPIDeleteGroup request + RbacServiceAPIDeleteGroupWithResponse(ctx context.Context, organizationId string, id string) (*RbacServiceAPIDeleteGroupResponse, error) + + // RbacServiceAPIGetGroup request + RbacServiceAPIGetGroupWithResponse(ctx context.Context, organizationId string, id string) (*RbacServiceAPIGetGroupResponse, error) + // InventoryAPIGetReservations request InventoryAPIGetReservationsWithResponse(ctx context.Context, organizationId string) (*InventoryAPIGetReservationsResponse, error) @@ -9033,6 +9508,22 @@ type ClientWithResponsesInterface interface { // InventoryAPIDeleteReservation request InventoryAPIDeleteReservationWithResponse(ctx context.Context, organizationId string, reservationId string) (*InventoryAPIDeleteReservationResponse, error) + // RbacServiceAPICreateRoleBindings request with any body + RbacServiceAPICreateRoleBindingsWithBodyWithResponse(ctx context.Context, organizationId string, contentType string, body io.Reader) (*RbacServiceAPICreateRoleBindingsResponse, error) + + RbacServiceAPICreateRoleBindingsWithResponse(ctx context.Context, organizationId string, body RbacServiceAPICreateRoleBindingsJSONRequestBody) (*RbacServiceAPICreateRoleBindingsResponse, error) + + // RbacServiceAPIDeleteRoleBinding request + RbacServiceAPIDeleteRoleBindingWithResponse(ctx context.Context, organizationId string, id string) (*RbacServiceAPIDeleteRoleBindingResponse, error) + + // RbacServiceAPIGetRoleBinding request + RbacServiceAPIGetRoleBindingWithResponse(ctx context.Context, organizationId string, id string) (*RbacServiceAPIGetRoleBindingResponse, error) + + // RbacServiceAPIUpdateRoleBinding request with any body + RbacServiceAPIUpdateRoleBindingWithBodyWithResponse(ctx context.Context, organizationId string, roleBindingId string, contentType string, body io.Reader) (*RbacServiceAPIUpdateRoleBindingResponse, error) + + RbacServiceAPIUpdateRoleBindingWithResponse(ctx context.Context, organizationId string, roleBindingId string, body RbacServiceAPIUpdateRoleBindingJSONRequestBody) (*RbacServiceAPIUpdateRoleBindingResponse, error) + // UsersAPIRemoveOrganizationUsers request UsersAPIRemoveOrganizationUsersWithResponse(ctx context.Context, organizationId string, params *UsersAPIRemoveOrganizationUsersParams) (*UsersAPIRemoveOrganizationUsersResponse, error) @@ -9191,11 +9682,6 @@ type ClientWithResponsesInterface interface { // WorkloadOptimizationAPIGetWorkload request WorkloadOptimizationAPIGetWorkloadWithResponse(ctx context.Context, clusterId string, workloadId string, params *WorkloadOptimizationAPIGetWorkloadParams) (*WorkloadOptimizationAPIGetWorkloadResponse, error) - // WorkloadOptimizationAPIUpdateWorkload request with any body - WorkloadOptimizationAPIUpdateWorkloadWithBodyWithResponse(ctx context.Context, clusterId string, workloadId string, contentType string, body io.Reader) (*WorkloadOptimizationAPIUpdateWorkloadResponse, error) - - WorkloadOptimizationAPIUpdateWorkloadWithResponse(ctx context.Context, clusterId string, workloadId string, body WorkloadOptimizationAPIUpdateWorkloadJSONRequestBody) (*WorkloadOptimizationAPIUpdateWorkloadResponse, error) - // WorkloadOptimizationAPIGetInstallCmd request WorkloadOptimizationAPIGetInstallCmdWithResponse(ctx context.Context, params *WorkloadOptimizationAPIGetInstallCmdParams) (*WorkloadOptimizationAPIGetInstallCmdResponse, error) @@ -10936,7 +11422,247 @@ type ExternalClusterAPIDeleteNodeResponse struct { } // Status returns HTTPResponse.Status -func (r ExternalClusterAPIDeleteNodeResponse) Status() string { +func (r ExternalClusterAPIDeleteNodeResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ExternalClusterAPIDeleteNodeResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 +// Body returns body of byte array +func (r ExternalClusterAPIDeleteNodeResponse) GetBody() []byte { + return r.Body +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 + +type ExternalClusterAPIGetNodeResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *ExternalclusterV1Node +} + +// Status returns HTTPResponse.Status +func (r ExternalClusterAPIGetNodeResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ExternalClusterAPIGetNodeResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 +// Body returns body of byte array +func (r ExternalClusterAPIGetNodeResponse) GetBody() []byte { + return r.Body +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 + +type ExternalClusterAPIDrainNodeResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *ExternalclusterV1DrainNodeResponse +} + +// Status returns HTTPResponse.Status +func (r ExternalClusterAPIDrainNodeResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ExternalClusterAPIDrainNodeResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 +// Body returns body of byte array +func (r ExternalClusterAPIDrainNodeResponse) GetBody() []byte { + return r.Body +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 + +type ExternalClusterAPIReconcileClusterResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *ExternalclusterV1ReconcileClusterResponse +} + +// Status returns HTTPResponse.Status +func (r ExternalClusterAPIReconcileClusterResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ExternalClusterAPIReconcileClusterResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 +// Body returns body of byte array +func (r ExternalClusterAPIReconcileClusterResponse) GetBody() []byte { + return r.Body +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 + +type ExternalClusterAPITriggerResumeClusterResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *ExternalclusterV1TriggerResumeClusterResponse +} + +// Status returns HTTPResponse.Status +func (r ExternalClusterAPITriggerResumeClusterResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ExternalClusterAPITriggerResumeClusterResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 +// Body returns body of byte array +func (r ExternalClusterAPITriggerResumeClusterResponse) GetBody() []byte { + return r.Body +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 + +type ExternalClusterAPIUpdateClusterTagsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *ExternalclusterV1UpdateClusterTagsResponse +} + +// Status returns HTTPResponse.Status +func (r ExternalClusterAPIUpdateClusterTagsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ExternalClusterAPIUpdateClusterTagsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 +// Body returns body of byte array +func (r ExternalClusterAPIUpdateClusterTagsResponse) GetBody() []byte { + return r.Body +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 + +type ExternalClusterAPICreateClusterTokenResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *ExternalclusterV1CreateClusterTokenResponse +} + +// Status returns HTTPResponse.Status +func (r ExternalClusterAPICreateClusterTokenResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ExternalClusterAPICreateClusterTokenResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 +// Body returns body of byte array +func (r ExternalClusterAPICreateClusterTokenResponse) GetBody() []byte { + return r.Body +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 + +type NodeConfigurationAPIListMaxPodsPresetsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *NodeconfigV1ListMaxPodsPresetsResponse +} + +// Status returns HTTPResponse.Status +func (r NodeConfigurationAPIListMaxPodsPresetsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r NodeConfigurationAPIListMaxPodsPresetsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 +// Body returns body of byte array +func (r NodeConfigurationAPIListMaxPodsPresetsResponse) GetBody() []byte { + return r.Body +} + +// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 + +type UsersAPICurrentUserProfileResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *CastaiUsersV1beta1CurrentUserProfileResponse +} + +// Status returns HTTPResponse.Status +func (r UsersAPICurrentUserProfileResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -10944,7 +11670,7 @@ func (r ExternalClusterAPIDeleteNodeResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ExternalClusterAPIDeleteNodeResponse) StatusCode() int { +func (r UsersAPICurrentUserProfileResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -10953,20 +11679,20 @@ func (r ExternalClusterAPIDeleteNodeResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r ExternalClusterAPIDeleteNodeResponse) GetBody() []byte { +func (r UsersAPICurrentUserProfileResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type ExternalClusterAPIGetNodeResponse struct { +type UsersAPIUpdateCurrentUserProfileResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *ExternalclusterV1Node + JSON200 *CastaiUsersV1beta1User } // Status returns HTTPResponse.Status -func (r ExternalClusterAPIGetNodeResponse) Status() string { +func (r UsersAPIUpdateCurrentUserProfileResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -10974,7 +11700,7 @@ func (r ExternalClusterAPIGetNodeResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ExternalClusterAPIGetNodeResponse) StatusCode() int { +func (r UsersAPIUpdateCurrentUserProfileResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -10983,20 +11709,20 @@ func (r ExternalClusterAPIGetNodeResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r ExternalClusterAPIGetNodeResponse) GetBody() []byte { +func (r UsersAPIUpdateCurrentUserProfileResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type ExternalClusterAPIDrainNodeResponse struct { +type UsersAPIListOrganizationsResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *ExternalclusterV1DrainNodeResponse + JSON200 *CastaiUsersV1beta1ListOrganizationsResponse } // Status returns HTTPResponse.Status -func (r ExternalClusterAPIDrainNodeResponse) Status() string { +func (r UsersAPIListOrganizationsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11004,7 +11730,7 @@ func (r ExternalClusterAPIDrainNodeResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ExternalClusterAPIDrainNodeResponse) StatusCode() int { +func (r UsersAPIListOrganizationsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11013,20 +11739,20 @@ func (r ExternalClusterAPIDrainNodeResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r ExternalClusterAPIDrainNodeResponse) GetBody() []byte { +func (r UsersAPIListOrganizationsResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type ExternalClusterAPIReconcileClusterResponse struct { +type UsersAPICreateOrganizationResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *ExternalclusterV1ReconcileClusterResponse + JSON200 *CastaiUsersV1beta1Organization } // Status returns HTTPResponse.Status -func (r ExternalClusterAPIReconcileClusterResponse) Status() string { +func (r UsersAPICreateOrganizationResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11034,7 +11760,7 @@ func (r ExternalClusterAPIReconcileClusterResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ExternalClusterAPIReconcileClusterResponse) StatusCode() int { +func (r UsersAPICreateOrganizationResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11043,20 +11769,20 @@ func (r ExternalClusterAPIReconcileClusterResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r ExternalClusterAPIReconcileClusterResponse) GetBody() []byte { +func (r UsersAPICreateOrganizationResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type ExternalClusterAPITriggerResumeClusterResponse struct { +type InventoryAPIGetOrganizationReservationsBalanceResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *ExternalclusterV1TriggerResumeClusterResponse + JSON200 *CastaiInventoryV1beta1GetOrganizationReservationsBalanceResponse } // Status returns HTTPResponse.Status -func (r ExternalClusterAPITriggerResumeClusterResponse) Status() string { +func (r InventoryAPIGetOrganizationReservationsBalanceResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11064,7 +11790,7 @@ func (r ExternalClusterAPITriggerResumeClusterResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ExternalClusterAPITriggerResumeClusterResponse) StatusCode() int { +func (r InventoryAPIGetOrganizationReservationsBalanceResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11073,20 +11799,20 @@ func (r ExternalClusterAPITriggerResumeClusterResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r ExternalClusterAPITriggerResumeClusterResponse) GetBody() []byte { +func (r InventoryAPIGetOrganizationReservationsBalanceResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type ExternalClusterAPIUpdateClusterTagsResponse struct { +type InventoryAPIGetOrganizationResourceUsageResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *ExternalclusterV1UpdateClusterTagsResponse + JSON200 *CastaiInventoryV1beta1GetOrganizationResourceUsageResponse } // Status returns HTTPResponse.Status -func (r ExternalClusterAPIUpdateClusterTagsResponse) Status() string { +func (r InventoryAPIGetOrganizationResourceUsageResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11094,7 +11820,7 @@ func (r ExternalClusterAPIUpdateClusterTagsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ExternalClusterAPIUpdateClusterTagsResponse) StatusCode() int { +func (r InventoryAPIGetOrganizationResourceUsageResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11103,20 +11829,20 @@ func (r ExternalClusterAPIUpdateClusterTagsResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r ExternalClusterAPIUpdateClusterTagsResponse) GetBody() []byte { +func (r InventoryAPIGetOrganizationResourceUsageResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type ExternalClusterAPICreateClusterTokenResponse struct { +type UsersAPIDeleteOrganizationResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *ExternalclusterV1CreateClusterTokenResponse + JSON200 *CastaiUsersV1beta1DeleteOrganizationResponse } // Status returns HTTPResponse.Status -func (r ExternalClusterAPICreateClusterTokenResponse) Status() string { +func (r UsersAPIDeleteOrganizationResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11124,7 +11850,7 @@ func (r ExternalClusterAPICreateClusterTokenResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ExternalClusterAPICreateClusterTokenResponse) StatusCode() int { +func (r UsersAPIDeleteOrganizationResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11133,20 +11859,20 @@ func (r ExternalClusterAPICreateClusterTokenResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r ExternalClusterAPICreateClusterTokenResponse) GetBody() []byte { +func (r UsersAPIDeleteOrganizationResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type NodeConfigurationAPIListMaxPodsPresetsResponse struct { +type UsersAPIGetOrganizationResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *NodeconfigV1ListMaxPodsPresetsResponse + JSON200 *CastaiUsersV1beta1Organization } // Status returns HTTPResponse.Status -func (r NodeConfigurationAPIListMaxPodsPresetsResponse) Status() string { +func (r UsersAPIGetOrganizationResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11154,7 +11880,7 @@ func (r NodeConfigurationAPIListMaxPodsPresetsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r NodeConfigurationAPIListMaxPodsPresetsResponse) StatusCode() int { +func (r UsersAPIGetOrganizationResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11163,20 +11889,20 @@ func (r NodeConfigurationAPIListMaxPodsPresetsResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r NodeConfigurationAPIListMaxPodsPresetsResponse) GetBody() []byte { +func (r UsersAPIGetOrganizationResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type UsersAPICurrentUserProfileResponse struct { +type UsersAPIEditOrganizationResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *CastaiUsersV1beta1CurrentUserProfileResponse + JSON200 *CastaiUsersV1beta1Organization } // Status returns HTTPResponse.Status -func (r UsersAPICurrentUserProfileResponse) Status() string { +func (r UsersAPIEditOrganizationResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11184,7 +11910,7 @@ func (r UsersAPICurrentUserProfileResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r UsersAPICurrentUserProfileResponse) StatusCode() int { +func (r UsersAPIEditOrganizationResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11193,20 +11919,20 @@ func (r UsersAPICurrentUserProfileResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r UsersAPICurrentUserProfileResponse) GetBody() []byte { +func (r UsersAPIEditOrganizationResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type UsersAPIUpdateCurrentUserProfileResponse struct { +type InventoryAPISyncClusterResourcesResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *CastaiUsersV1beta1User + JSON200 *map[string]interface{} } // Status returns HTTPResponse.Status -func (r UsersAPIUpdateCurrentUserProfileResponse) Status() string { +func (r InventoryAPISyncClusterResourcesResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11214,7 +11940,7 @@ func (r UsersAPIUpdateCurrentUserProfileResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r UsersAPIUpdateCurrentUserProfileResponse) StatusCode() int { +func (r InventoryAPISyncClusterResourcesResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11223,20 +11949,20 @@ func (r UsersAPIUpdateCurrentUserProfileResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r UsersAPIUpdateCurrentUserProfileResponse) GetBody() []byte { +func (r InventoryAPISyncClusterResourcesResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type UsersAPIListOrganizationsResponse struct { +type RbacServiceAPICreateGroupResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *CastaiUsersV1beta1ListOrganizationsResponse + JSON200 *CastaiRbacV1beta1Group } // Status returns HTTPResponse.Status -func (r UsersAPIListOrganizationsResponse) Status() string { +func (r RbacServiceAPICreateGroupResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11244,7 +11970,7 @@ func (r UsersAPIListOrganizationsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r UsersAPIListOrganizationsResponse) StatusCode() int { +func (r RbacServiceAPICreateGroupResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11253,20 +11979,20 @@ func (r UsersAPIListOrganizationsResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r UsersAPIListOrganizationsResponse) GetBody() []byte { +func (r RbacServiceAPICreateGroupResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type UsersAPICreateOrganizationResponse struct { +type RbacServiceAPIUpdateGroupResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *CastaiUsersV1beta1Organization + JSON200 *CastaiRbacV1beta1Group } // Status returns HTTPResponse.Status -func (r UsersAPICreateOrganizationResponse) Status() string { +func (r RbacServiceAPIUpdateGroupResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11274,7 +12000,7 @@ func (r UsersAPICreateOrganizationResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r UsersAPICreateOrganizationResponse) StatusCode() int { +func (r RbacServiceAPIUpdateGroupResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11283,20 +12009,20 @@ func (r UsersAPICreateOrganizationResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r UsersAPICreateOrganizationResponse) GetBody() []byte { +func (r RbacServiceAPIUpdateGroupResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type InventoryAPIGetOrganizationReservationsBalanceResponse struct { +type RbacServiceAPIDeleteGroupResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *CastaiInventoryV1beta1GetOrganizationReservationsBalanceResponse + JSON200 *CastaiRbacV1beta1DeleteGroupResponse } // Status returns HTTPResponse.Status -func (r InventoryAPIGetOrganizationReservationsBalanceResponse) Status() string { +func (r RbacServiceAPIDeleteGroupResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11304,7 +12030,7 @@ func (r InventoryAPIGetOrganizationReservationsBalanceResponse) Status() string } // StatusCode returns HTTPResponse.StatusCode -func (r InventoryAPIGetOrganizationReservationsBalanceResponse) StatusCode() int { +func (r RbacServiceAPIDeleteGroupResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11313,20 +12039,20 @@ func (r InventoryAPIGetOrganizationReservationsBalanceResponse) StatusCode() int // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r InventoryAPIGetOrganizationReservationsBalanceResponse) GetBody() []byte { +func (r RbacServiceAPIDeleteGroupResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type InventoryAPIGetOrganizationResourceUsageResponse struct { +type RbacServiceAPIGetGroupResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *CastaiInventoryV1beta1GetOrganizationResourceUsageResponse + JSON200 *CastaiRbacV1beta1Group } // Status returns HTTPResponse.Status -func (r InventoryAPIGetOrganizationResourceUsageResponse) Status() string { +func (r RbacServiceAPIGetGroupResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11334,7 +12060,7 @@ func (r InventoryAPIGetOrganizationResourceUsageResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r InventoryAPIGetOrganizationResourceUsageResponse) StatusCode() int { +func (r RbacServiceAPIGetGroupResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11343,20 +12069,20 @@ func (r InventoryAPIGetOrganizationResourceUsageResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r InventoryAPIGetOrganizationResourceUsageResponse) GetBody() []byte { +func (r RbacServiceAPIGetGroupResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type UsersAPIDeleteOrganizationResponse struct { +type InventoryAPIGetReservationsResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *CastaiUsersV1beta1DeleteOrganizationResponse + JSON200 *CastaiInventoryV1beta1GetReservationsResponse } // Status returns HTTPResponse.Status -func (r UsersAPIDeleteOrganizationResponse) Status() string { +func (r InventoryAPIGetReservationsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11364,7 +12090,7 @@ func (r UsersAPIDeleteOrganizationResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r UsersAPIDeleteOrganizationResponse) StatusCode() int { +func (r InventoryAPIGetReservationsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11373,20 +12099,20 @@ func (r UsersAPIDeleteOrganizationResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r UsersAPIDeleteOrganizationResponse) GetBody() []byte { +func (r InventoryAPIGetReservationsResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type UsersAPIGetOrganizationResponse struct { +type InventoryAPIAddReservationResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *CastaiUsersV1beta1Organization + JSON200 *CastaiInventoryV1beta1AddReservationResponse } // Status returns HTTPResponse.Status -func (r UsersAPIGetOrganizationResponse) Status() string { +func (r InventoryAPIAddReservationResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11394,7 +12120,7 @@ func (r UsersAPIGetOrganizationResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r UsersAPIGetOrganizationResponse) StatusCode() int { +func (r InventoryAPIAddReservationResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11403,20 +12129,20 @@ func (r UsersAPIGetOrganizationResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r UsersAPIGetOrganizationResponse) GetBody() []byte { +func (r InventoryAPIAddReservationResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type UsersAPIEditOrganizationResponse struct { +type InventoryAPIGetReservationsBalanceResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *CastaiUsersV1beta1Organization + JSON200 *CastaiInventoryV1beta1GetReservationsBalanceResponse } // Status returns HTTPResponse.Status -func (r UsersAPIEditOrganizationResponse) Status() string { +func (r InventoryAPIGetReservationsBalanceResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11424,7 +12150,7 @@ func (r UsersAPIEditOrganizationResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r UsersAPIEditOrganizationResponse) StatusCode() int { +func (r InventoryAPIGetReservationsBalanceResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11433,20 +12159,20 @@ func (r UsersAPIEditOrganizationResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r UsersAPIEditOrganizationResponse) GetBody() []byte { +func (r InventoryAPIGetReservationsBalanceResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type InventoryAPISyncClusterResourcesResponse struct { +type InventoryAPIOverwriteReservationsResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *map[string]interface{} + JSON200 *CastaiInventoryV1beta1OverwriteReservationsResponse } // Status returns HTTPResponse.Status -func (r InventoryAPISyncClusterResourcesResponse) Status() string { +func (r InventoryAPIOverwriteReservationsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11454,7 +12180,7 @@ func (r InventoryAPISyncClusterResourcesResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r InventoryAPISyncClusterResourcesResponse) StatusCode() int { +func (r InventoryAPIOverwriteReservationsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11463,20 +12189,20 @@ func (r InventoryAPISyncClusterResourcesResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r InventoryAPISyncClusterResourcesResponse) GetBody() []byte { +func (r InventoryAPIOverwriteReservationsResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type InventoryAPIGetReservationsResponse struct { +type InventoryAPIDeleteReservationResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *CastaiInventoryV1beta1GetReservationsResponse + JSON200 *map[string]interface{} } // Status returns HTTPResponse.Status -func (r InventoryAPIGetReservationsResponse) Status() string { +func (r InventoryAPIDeleteReservationResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11484,7 +12210,7 @@ func (r InventoryAPIGetReservationsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r InventoryAPIGetReservationsResponse) StatusCode() int { +func (r InventoryAPIDeleteReservationResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11493,20 +12219,20 @@ func (r InventoryAPIGetReservationsResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r InventoryAPIGetReservationsResponse) GetBody() []byte { +func (r InventoryAPIDeleteReservationResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type InventoryAPIAddReservationResponse struct { +type RbacServiceAPICreateRoleBindingsResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *CastaiInventoryV1beta1AddReservationResponse + JSON200 *[]CastaiRbacV1beta1RoleBinding } // Status returns HTTPResponse.Status -func (r InventoryAPIAddReservationResponse) Status() string { +func (r RbacServiceAPICreateRoleBindingsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11514,7 +12240,7 @@ func (r InventoryAPIAddReservationResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r InventoryAPIAddReservationResponse) StatusCode() int { +func (r RbacServiceAPICreateRoleBindingsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11523,20 +12249,20 @@ func (r InventoryAPIAddReservationResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r InventoryAPIAddReservationResponse) GetBody() []byte { +func (r RbacServiceAPICreateRoleBindingsResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type InventoryAPIGetReservationsBalanceResponse struct { +type RbacServiceAPIDeleteRoleBindingResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *CastaiInventoryV1beta1GetReservationsBalanceResponse + JSON200 *CastaiRbacV1beta1DeleteRoleBindingResponse } // Status returns HTTPResponse.Status -func (r InventoryAPIGetReservationsBalanceResponse) Status() string { +func (r RbacServiceAPIDeleteRoleBindingResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11544,7 +12270,7 @@ func (r InventoryAPIGetReservationsBalanceResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r InventoryAPIGetReservationsBalanceResponse) StatusCode() int { +func (r RbacServiceAPIDeleteRoleBindingResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11553,20 +12279,20 @@ func (r InventoryAPIGetReservationsBalanceResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r InventoryAPIGetReservationsBalanceResponse) GetBody() []byte { +func (r RbacServiceAPIDeleteRoleBindingResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type InventoryAPIOverwriteReservationsResponse struct { +type RbacServiceAPIGetRoleBindingResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *CastaiInventoryV1beta1OverwriteReservationsResponse + JSON200 *CastaiRbacV1beta1RoleBinding } // Status returns HTTPResponse.Status -func (r InventoryAPIOverwriteReservationsResponse) Status() string { +func (r RbacServiceAPIGetRoleBindingResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11574,7 +12300,7 @@ func (r InventoryAPIOverwriteReservationsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r InventoryAPIOverwriteReservationsResponse) StatusCode() int { +func (r RbacServiceAPIGetRoleBindingResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11583,20 +12309,20 @@ func (r InventoryAPIOverwriteReservationsResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r InventoryAPIOverwriteReservationsResponse) GetBody() []byte { +func (r RbacServiceAPIGetRoleBindingResponse) GetBody() []byte { return r.Body } // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type InventoryAPIDeleteReservationResponse struct { +type RbacServiceAPIUpdateRoleBindingResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *map[string]interface{} + JSON200 *CastaiRbacV1beta1RoleBinding } // Status returns HTTPResponse.Status -func (r InventoryAPIDeleteReservationResponse) Status() string { +func (r RbacServiceAPIUpdateRoleBindingResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -11604,7 +12330,7 @@ func (r InventoryAPIDeleteReservationResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r InventoryAPIDeleteReservationResponse) StatusCode() int { +func (r RbacServiceAPIUpdateRoleBindingResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -11613,7 +12339,7 @@ func (r InventoryAPIDeleteReservationResponse) StatusCode() int { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 // Body returns body of byte array -func (r InventoryAPIDeleteReservationResponse) GetBody() []byte { +func (r RbacServiceAPIUpdateRoleBindingResponse) GetBody() []byte { return r.Body } @@ -12936,36 +13662,6 @@ func (r WorkloadOptimizationAPIGetWorkloadResponse) GetBody() []byte { // TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -type WorkloadOptimizationAPIUpdateWorkloadResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *WorkloadoptimizationV1UpdateWorkloadResponse -} - -// Status returns HTTPResponse.Status -func (r WorkloadOptimizationAPIUpdateWorkloadResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r WorkloadOptimizationAPIUpdateWorkloadResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 -// Body returns body of byte array -func (r WorkloadOptimizationAPIUpdateWorkloadResponse) GetBody() []byte { - return r.Body -} - -// TODO: to have common interface. https://github.com/deepmap/oapi-codegen/issues/240 - type WorkloadOptimizationAPIGetInstallCmdResponse struct { Body []byte HTTPResponse *http.Response @@ -13946,42 +14642,94 @@ func (c *ClientWithResponses) UsersAPIDeleteOrganizationWithResponse(ctx context if err != nil { return nil, err } - return ParseUsersAPIDeleteOrganizationResponse(rsp) + return ParseUsersAPIDeleteOrganizationResponse(rsp) +} + +// UsersAPIGetOrganizationWithResponse request returning *UsersAPIGetOrganizationResponse +func (c *ClientWithResponses) UsersAPIGetOrganizationWithResponse(ctx context.Context, id string) (*UsersAPIGetOrganizationResponse, error) { + rsp, err := c.UsersAPIGetOrganization(ctx, id) + if err != nil { + return nil, err + } + return ParseUsersAPIGetOrganizationResponse(rsp) +} + +// UsersAPIEditOrganizationWithBodyWithResponse request with arbitrary body returning *UsersAPIEditOrganizationResponse +func (c *ClientWithResponses) UsersAPIEditOrganizationWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader) (*UsersAPIEditOrganizationResponse, error) { + rsp, err := c.UsersAPIEditOrganizationWithBody(ctx, id, contentType, body) + if err != nil { + return nil, err + } + return ParseUsersAPIEditOrganizationResponse(rsp) +} + +func (c *ClientWithResponses) UsersAPIEditOrganizationWithResponse(ctx context.Context, id string, body UsersAPIEditOrganizationJSONRequestBody) (*UsersAPIEditOrganizationResponse, error) { + rsp, err := c.UsersAPIEditOrganization(ctx, id, body) + if err != nil { + return nil, err + } + return ParseUsersAPIEditOrganizationResponse(rsp) +} + +// InventoryAPISyncClusterResourcesWithResponse request returning *InventoryAPISyncClusterResourcesResponse +func (c *ClientWithResponses) InventoryAPISyncClusterResourcesWithResponse(ctx context.Context, organizationId string, clusterId string) (*InventoryAPISyncClusterResourcesResponse, error) { + rsp, err := c.InventoryAPISyncClusterResources(ctx, organizationId, clusterId) + if err != nil { + return nil, err + } + return ParseInventoryAPISyncClusterResourcesResponse(rsp) +} + +// RbacServiceAPICreateGroupWithBodyWithResponse request with arbitrary body returning *RbacServiceAPICreateGroupResponse +func (c *ClientWithResponses) RbacServiceAPICreateGroupWithBodyWithResponse(ctx context.Context, organizationId string, contentType string, body io.Reader) (*RbacServiceAPICreateGroupResponse, error) { + rsp, err := c.RbacServiceAPICreateGroupWithBody(ctx, organizationId, contentType, body) + if err != nil { + return nil, err + } + return ParseRbacServiceAPICreateGroupResponse(rsp) +} + +func (c *ClientWithResponses) RbacServiceAPICreateGroupWithResponse(ctx context.Context, organizationId string, body RbacServiceAPICreateGroupJSONRequestBody) (*RbacServiceAPICreateGroupResponse, error) { + rsp, err := c.RbacServiceAPICreateGroup(ctx, organizationId, body) + if err != nil { + return nil, err + } + return ParseRbacServiceAPICreateGroupResponse(rsp) } -// UsersAPIGetOrganizationWithResponse request returning *UsersAPIGetOrganizationResponse -func (c *ClientWithResponses) UsersAPIGetOrganizationWithResponse(ctx context.Context, id string) (*UsersAPIGetOrganizationResponse, error) { - rsp, err := c.UsersAPIGetOrganization(ctx, id) +// RbacServiceAPIUpdateGroupWithBodyWithResponse request with arbitrary body returning *RbacServiceAPIUpdateGroupResponse +func (c *ClientWithResponses) RbacServiceAPIUpdateGroupWithBodyWithResponse(ctx context.Context, organizationId string, groupId string, contentType string, body io.Reader) (*RbacServiceAPIUpdateGroupResponse, error) { + rsp, err := c.RbacServiceAPIUpdateGroupWithBody(ctx, organizationId, groupId, contentType, body) if err != nil { return nil, err } - return ParseUsersAPIGetOrganizationResponse(rsp) + return ParseRbacServiceAPIUpdateGroupResponse(rsp) } -// UsersAPIEditOrganizationWithBodyWithResponse request with arbitrary body returning *UsersAPIEditOrganizationResponse -func (c *ClientWithResponses) UsersAPIEditOrganizationWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader) (*UsersAPIEditOrganizationResponse, error) { - rsp, err := c.UsersAPIEditOrganizationWithBody(ctx, id, contentType, body) +func (c *ClientWithResponses) RbacServiceAPIUpdateGroupWithResponse(ctx context.Context, organizationId string, groupId string, body RbacServiceAPIUpdateGroupJSONRequestBody) (*RbacServiceAPIUpdateGroupResponse, error) { + rsp, err := c.RbacServiceAPIUpdateGroup(ctx, organizationId, groupId, body) if err != nil { return nil, err } - return ParseUsersAPIEditOrganizationResponse(rsp) + return ParseRbacServiceAPIUpdateGroupResponse(rsp) } -func (c *ClientWithResponses) UsersAPIEditOrganizationWithResponse(ctx context.Context, id string, body UsersAPIEditOrganizationJSONRequestBody) (*UsersAPIEditOrganizationResponse, error) { - rsp, err := c.UsersAPIEditOrganization(ctx, id, body) +// RbacServiceAPIDeleteGroupWithResponse request returning *RbacServiceAPIDeleteGroupResponse +func (c *ClientWithResponses) RbacServiceAPIDeleteGroupWithResponse(ctx context.Context, organizationId string, id string) (*RbacServiceAPIDeleteGroupResponse, error) { + rsp, err := c.RbacServiceAPIDeleteGroup(ctx, organizationId, id) if err != nil { return nil, err } - return ParseUsersAPIEditOrganizationResponse(rsp) + return ParseRbacServiceAPIDeleteGroupResponse(rsp) } -// InventoryAPISyncClusterResourcesWithResponse request returning *InventoryAPISyncClusterResourcesResponse -func (c *ClientWithResponses) InventoryAPISyncClusterResourcesWithResponse(ctx context.Context, organizationId string, clusterId string) (*InventoryAPISyncClusterResourcesResponse, error) { - rsp, err := c.InventoryAPISyncClusterResources(ctx, organizationId, clusterId) +// RbacServiceAPIGetGroupWithResponse request returning *RbacServiceAPIGetGroupResponse +func (c *ClientWithResponses) RbacServiceAPIGetGroupWithResponse(ctx context.Context, organizationId string, id string) (*RbacServiceAPIGetGroupResponse, error) { + rsp, err := c.RbacServiceAPIGetGroup(ctx, organizationId, id) if err != nil { return nil, err } - return ParseInventoryAPISyncClusterResourcesResponse(rsp) + return ParseRbacServiceAPIGetGroupResponse(rsp) } // InventoryAPIGetReservationsWithResponse request returning *InventoryAPIGetReservationsResponse @@ -14045,6 +14793,58 @@ func (c *ClientWithResponses) InventoryAPIDeleteReservationWithResponse(ctx cont return ParseInventoryAPIDeleteReservationResponse(rsp) } +// RbacServiceAPICreateRoleBindingsWithBodyWithResponse request with arbitrary body returning *RbacServiceAPICreateRoleBindingsResponse +func (c *ClientWithResponses) RbacServiceAPICreateRoleBindingsWithBodyWithResponse(ctx context.Context, organizationId string, contentType string, body io.Reader) (*RbacServiceAPICreateRoleBindingsResponse, error) { + rsp, err := c.RbacServiceAPICreateRoleBindingsWithBody(ctx, organizationId, contentType, body) + if err != nil { + return nil, err + } + return ParseRbacServiceAPICreateRoleBindingsResponse(rsp) +} + +func (c *ClientWithResponses) RbacServiceAPICreateRoleBindingsWithResponse(ctx context.Context, organizationId string, body RbacServiceAPICreateRoleBindingsJSONRequestBody) (*RbacServiceAPICreateRoleBindingsResponse, error) { + rsp, err := c.RbacServiceAPICreateRoleBindings(ctx, organizationId, body) + if err != nil { + return nil, err + } + return ParseRbacServiceAPICreateRoleBindingsResponse(rsp) +} + +// RbacServiceAPIDeleteRoleBindingWithResponse request returning *RbacServiceAPIDeleteRoleBindingResponse +func (c *ClientWithResponses) RbacServiceAPIDeleteRoleBindingWithResponse(ctx context.Context, organizationId string, id string) (*RbacServiceAPIDeleteRoleBindingResponse, error) { + rsp, err := c.RbacServiceAPIDeleteRoleBinding(ctx, organizationId, id) + if err != nil { + return nil, err + } + return ParseRbacServiceAPIDeleteRoleBindingResponse(rsp) +} + +// RbacServiceAPIGetRoleBindingWithResponse request returning *RbacServiceAPIGetRoleBindingResponse +func (c *ClientWithResponses) RbacServiceAPIGetRoleBindingWithResponse(ctx context.Context, organizationId string, id string) (*RbacServiceAPIGetRoleBindingResponse, error) { + rsp, err := c.RbacServiceAPIGetRoleBinding(ctx, organizationId, id) + if err != nil { + return nil, err + } + return ParseRbacServiceAPIGetRoleBindingResponse(rsp) +} + +// RbacServiceAPIUpdateRoleBindingWithBodyWithResponse request with arbitrary body returning *RbacServiceAPIUpdateRoleBindingResponse +func (c *ClientWithResponses) RbacServiceAPIUpdateRoleBindingWithBodyWithResponse(ctx context.Context, organizationId string, roleBindingId string, contentType string, body io.Reader) (*RbacServiceAPIUpdateRoleBindingResponse, error) { + rsp, err := c.RbacServiceAPIUpdateRoleBindingWithBody(ctx, organizationId, roleBindingId, contentType, body) + if err != nil { + return nil, err + } + return ParseRbacServiceAPIUpdateRoleBindingResponse(rsp) +} + +func (c *ClientWithResponses) RbacServiceAPIUpdateRoleBindingWithResponse(ctx context.Context, organizationId string, roleBindingId string, body RbacServiceAPIUpdateRoleBindingJSONRequestBody) (*RbacServiceAPIUpdateRoleBindingResponse, error) { + rsp, err := c.RbacServiceAPIUpdateRoleBinding(ctx, organizationId, roleBindingId, body) + if err != nil { + return nil, err + } + return ParseRbacServiceAPIUpdateRoleBindingResponse(rsp) +} + // UsersAPIRemoveOrganizationUsersWithResponse request returning *UsersAPIRemoveOrganizationUsersResponse func (c *ClientWithResponses) UsersAPIRemoveOrganizationUsersWithResponse(ctx context.Context, organizationId string, params *UsersAPIRemoveOrganizationUsersParams) (*UsersAPIRemoveOrganizationUsersResponse, error) { rsp, err := c.UsersAPIRemoveOrganizationUsers(ctx, organizationId, params) @@ -14545,23 +15345,6 @@ func (c *ClientWithResponses) WorkloadOptimizationAPIGetWorkloadWithResponse(ctx return ParseWorkloadOptimizationAPIGetWorkloadResponse(rsp) } -// WorkloadOptimizationAPIUpdateWorkloadWithBodyWithResponse request with arbitrary body returning *WorkloadOptimizationAPIUpdateWorkloadResponse -func (c *ClientWithResponses) WorkloadOptimizationAPIUpdateWorkloadWithBodyWithResponse(ctx context.Context, clusterId string, workloadId string, contentType string, body io.Reader) (*WorkloadOptimizationAPIUpdateWorkloadResponse, error) { - rsp, err := c.WorkloadOptimizationAPIUpdateWorkloadWithBody(ctx, clusterId, workloadId, contentType, body) - if err != nil { - return nil, err - } - return ParseWorkloadOptimizationAPIUpdateWorkloadResponse(rsp) -} - -func (c *ClientWithResponses) WorkloadOptimizationAPIUpdateWorkloadWithResponse(ctx context.Context, clusterId string, workloadId string, body WorkloadOptimizationAPIUpdateWorkloadJSONRequestBody) (*WorkloadOptimizationAPIUpdateWorkloadResponse, error) { - rsp, err := c.WorkloadOptimizationAPIUpdateWorkload(ctx, clusterId, workloadId, body) - if err != nil { - return nil, err - } - return ParseWorkloadOptimizationAPIUpdateWorkloadResponse(rsp) -} - // WorkloadOptimizationAPIGetInstallCmdWithResponse request returning *WorkloadOptimizationAPIGetInstallCmdResponse func (c *ClientWithResponses) WorkloadOptimizationAPIGetInstallCmdWithResponse(ctx context.Context, params *WorkloadOptimizationAPIGetInstallCmdParams) (*WorkloadOptimizationAPIGetInstallCmdResponse, error) { rsp, err := c.WorkloadOptimizationAPIGetInstallCmd(ctx, params) @@ -16546,6 +17329,110 @@ func ParseInventoryAPISyncClusterResourcesResponse(rsp *http.Response) (*Invento return response, nil } +// ParseRbacServiceAPICreateGroupResponse parses an HTTP response from a RbacServiceAPICreateGroupWithResponse call +func ParseRbacServiceAPICreateGroupResponse(rsp *http.Response) (*RbacServiceAPICreateGroupResponse, error) { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + defer rsp.Body.Close() + if err != nil { + return nil, err + } + + response := &RbacServiceAPICreateGroupResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest CastaiRbacV1beta1Group + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseRbacServiceAPIUpdateGroupResponse parses an HTTP response from a RbacServiceAPIUpdateGroupWithResponse call +func ParseRbacServiceAPIUpdateGroupResponse(rsp *http.Response) (*RbacServiceAPIUpdateGroupResponse, error) { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + defer rsp.Body.Close() + if err != nil { + return nil, err + } + + response := &RbacServiceAPIUpdateGroupResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest CastaiRbacV1beta1Group + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseRbacServiceAPIDeleteGroupResponse parses an HTTP response from a RbacServiceAPIDeleteGroupWithResponse call +func ParseRbacServiceAPIDeleteGroupResponse(rsp *http.Response) (*RbacServiceAPIDeleteGroupResponse, error) { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + defer rsp.Body.Close() + if err != nil { + return nil, err + } + + response := &RbacServiceAPIDeleteGroupResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest CastaiRbacV1beta1DeleteGroupResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseRbacServiceAPIGetGroupResponse parses an HTTP response from a RbacServiceAPIGetGroupWithResponse call +func ParseRbacServiceAPIGetGroupResponse(rsp *http.Response) (*RbacServiceAPIGetGroupResponse, error) { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + defer rsp.Body.Close() + if err != nil { + return nil, err + } + + response := &RbacServiceAPIGetGroupResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest CastaiRbacV1beta1Group + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + // ParseInventoryAPIGetReservationsResponse parses an HTTP response from a InventoryAPIGetReservationsWithResponse call func ParseInventoryAPIGetReservationsResponse(rsp *http.Response) (*InventoryAPIGetReservationsResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) @@ -16676,6 +17563,110 @@ func ParseInventoryAPIDeleteReservationResponse(rsp *http.Response) (*InventoryA return response, nil } +// ParseRbacServiceAPICreateRoleBindingsResponse parses an HTTP response from a RbacServiceAPICreateRoleBindingsWithResponse call +func ParseRbacServiceAPICreateRoleBindingsResponse(rsp *http.Response) (*RbacServiceAPICreateRoleBindingsResponse, error) { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + defer rsp.Body.Close() + if err != nil { + return nil, err + } + + response := &RbacServiceAPICreateRoleBindingsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest []CastaiRbacV1beta1RoleBinding + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseRbacServiceAPIDeleteRoleBindingResponse parses an HTTP response from a RbacServiceAPIDeleteRoleBindingWithResponse call +func ParseRbacServiceAPIDeleteRoleBindingResponse(rsp *http.Response) (*RbacServiceAPIDeleteRoleBindingResponse, error) { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + defer rsp.Body.Close() + if err != nil { + return nil, err + } + + response := &RbacServiceAPIDeleteRoleBindingResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest CastaiRbacV1beta1DeleteRoleBindingResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseRbacServiceAPIGetRoleBindingResponse parses an HTTP response from a RbacServiceAPIGetRoleBindingWithResponse call +func ParseRbacServiceAPIGetRoleBindingResponse(rsp *http.Response) (*RbacServiceAPIGetRoleBindingResponse, error) { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + defer rsp.Body.Close() + if err != nil { + return nil, err + } + + response := &RbacServiceAPIGetRoleBindingResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest CastaiRbacV1beta1RoleBinding + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseRbacServiceAPIUpdateRoleBindingResponse parses an HTTP response from a RbacServiceAPIUpdateRoleBindingWithResponse call +func ParseRbacServiceAPIUpdateRoleBindingResponse(rsp *http.Response) (*RbacServiceAPIUpdateRoleBindingResponse, error) { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + defer rsp.Body.Close() + if err != nil { + return nil, err + } + + response := &RbacServiceAPIUpdateRoleBindingResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest CastaiRbacV1beta1RoleBinding + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + // ParseUsersAPIRemoveOrganizationUsersResponse parses an HTTP response from a UsersAPIRemoveOrganizationUsersWithResponse call func ParseUsersAPIRemoveOrganizationUsersResponse(rsp *http.Response) (*UsersAPIRemoveOrganizationUsersResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) @@ -17790,32 +18781,6 @@ func ParseWorkloadOptimizationAPIGetWorkloadResponse(rsp *http.Response) (*Workl return response, nil } -// ParseWorkloadOptimizationAPIUpdateWorkloadResponse parses an HTTP response from a WorkloadOptimizationAPIUpdateWorkloadWithResponse call -func ParseWorkloadOptimizationAPIUpdateWorkloadResponse(rsp *http.Response) (*WorkloadOptimizationAPIUpdateWorkloadResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() - if err != nil { - return nil, err - } - - response := &WorkloadOptimizationAPIUpdateWorkloadResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest WorkloadoptimizationV1UpdateWorkloadResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - // ParseWorkloadOptimizationAPIGetInstallCmdResponse parses an HTTP response from a WorkloadOptimizationAPIGetInstallCmdWithResponse call func ParseWorkloadOptimizationAPIGetInstallCmdResponse(rsp *http.Response) (*WorkloadOptimizationAPIGetInstallCmdResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) diff --git a/castai/sdk/mock/client.go b/castai/sdk/mock/client.go index 4127246a..20f0e0d4 100644 --- a/castai/sdk/mock/client.go +++ b/castai/sdk/mock/client.go @@ -2195,6 +2195,246 @@ func (mr *MockClientInterfaceMockRecorder) PoliciesAPIUpsertClusterPoliciesWithB return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PoliciesAPIUpsertClusterPoliciesWithBody", reflect.TypeOf((*MockClientInterface)(nil).PoliciesAPIUpsertClusterPoliciesWithBody), varargs...) } +// RbacServiceAPICreateGroup mocks base method. +func (m *MockClientInterface) RbacServiceAPICreateGroup(ctx context.Context, organizationId string, body sdk.RbacServiceAPICreateGroupJSONRequestBody, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, organizationId, body} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RbacServiceAPICreateGroup", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPICreateGroup indicates an expected call of RbacServiceAPICreateGroup. +func (mr *MockClientInterfaceMockRecorder) RbacServiceAPICreateGroup(ctx, organizationId, body interface{}, reqEditors ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, organizationId, body}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPICreateGroup", reflect.TypeOf((*MockClientInterface)(nil).RbacServiceAPICreateGroup), varargs...) +} + +// RbacServiceAPICreateGroupWithBody mocks base method. +func (m *MockClientInterface) RbacServiceAPICreateGroupWithBody(ctx context.Context, organizationId, contentType string, body io.Reader, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, organizationId, contentType, body} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RbacServiceAPICreateGroupWithBody", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPICreateGroupWithBody indicates an expected call of RbacServiceAPICreateGroupWithBody. +func (mr *MockClientInterfaceMockRecorder) RbacServiceAPICreateGroupWithBody(ctx, organizationId, contentType, body interface{}, reqEditors ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, organizationId, contentType, body}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPICreateGroupWithBody", reflect.TypeOf((*MockClientInterface)(nil).RbacServiceAPICreateGroupWithBody), varargs...) +} + +// RbacServiceAPICreateRoleBindings mocks base method. +func (m *MockClientInterface) RbacServiceAPICreateRoleBindings(ctx context.Context, organizationId string, body sdk.RbacServiceAPICreateRoleBindingsJSONRequestBody, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, organizationId, body} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RbacServiceAPICreateRoleBindings", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPICreateRoleBindings indicates an expected call of RbacServiceAPICreateRoleBindings. +func (mr *MockClientInterfaceMockRecorder) RbacServiceAPICreateRoleBindings(ctx, organizationId, body interface{}, reqEditors ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, organizationId, body}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPICreateRoleBindings", reflect.TypeOf((*MockClientInterface)(nil).RbacServiceAPICreateRoleBindings), varargs...) +} + +// RbacServiceAPICreateRoleBindingsWithBody mocks base method. +func (m *MockClientInterface) RbacServiceAPICreateRoleBindingsWithBody(ctx context.Context, organizationId, contentType string, body io.Reader, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, organizationId, contentType, body} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RbacServiceAPICreateRoleBindingsWithBody", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPICreateRoleBindingsWithBody indicates an expected call of RbacServiceAPICreateRoleBindingsWithBody. +func (mr *MockClientInterfaceMockRecorder) RbacServiceAPICreateRoleBindingsWithBody(ctx, organizationId, contentType, body interface{}, reqEditors ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, organizationId, contentType, body}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPICreateRoleBindingsWithBody", reflect.TypeOf((*MockClientInterface)(nil).RbacServiceAPICreateRoleBindingsWithBody), varargs...) +} + +// RbacServiceAPIDeleteGroup mocks base method. +func (m *MockClientInterface) RbacServiceAPIDeleteGroup(ctx context.Context, organizationId, id string, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, organizationId, id} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RbacServiceAPIDeleteGroup", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPIDeleteGroup indicates an expected call of RbacServiceAPIDeleteGroup. +func (mr *MockClientInterfaceMockRecorder) RbacServiceAPIDeleteGroup(ctx, organizationId, id interface{}, reqEditors ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, organizationId, id}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPIDeleteGroup", reflect.TypeOf((*MockClientInterface)(nil).RbacServiceAPIDeleteGroup), varargs...) +} + +// RbacServiceAPIDeleteRoleBinding mocks base method. +func (m *MockClientInterface) RbacServiceAPIDeleteRoleBinding(ctx context.Context, organizationId, id string, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, organizationId, id} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RbacServiceAPIDeleteRoleBinding", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPIDeleteRoleBinding indicates an expected call of RbacServiceAPIDeleteRoleBinding. +func (mr *MockClientInterfaceMockRecorder) RbacServiceAPIDeleteRoleBinding(ctx, organizationId, id interface{}, reqEditors ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, organizationId, id}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPIDeleteRoleBinding", reflect.TypeOf((*MockClientInterface)(nil).RbacServiceAPIDeleteRoleBinding), varargs...) +} + +// RbacServiceAPIGetGroup mocks base method. +func (m *MockClientInterface) RbacServiceAPIGetGroup(ctx context.Context, organizationId, id string, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, organizationId, id} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RbacServiceAPIGetGroup", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPIGetGroup indicates an expected call of RbacServiceAPIGetGroup. +func (mr *MockClientInterfaceMockRecorder) RbacServiceAPIGetGroup(ctx, organizationId, id interface{}, reqEditors ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, organizationId, id}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPIGetGroup", reflect.TypeOf((*MockClientInterface)(nil).RbacServiceAPIGetGroup), varargs...) +} + +// RbacServiceAPIGetRoleBinding mocks base method. +func (m *MockClientInterface) RbacServiceAPIGetRoleBinding(ctx context.Context, organizationId, id string, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, organizationId, id} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RbacServiceAPIGetRoleBinding", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPIGetRoleBinding indicates an expected call of RbacServiceAPIGetRoleBinding. +func (mr *MockClientInterfaceMockRecorder) RbacServiceAPIGetRoleBinding(ctx, organizationId, id interface{}, reqEditors ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, organizationId, id}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPIGetRoleBinding", reflect.TypeOf((*MockClientInterface)(nil).RbacServiceAPIGetRoleBinding), varargs...) +} + +// RbacServiceAPIUpdateGroup mocks base method. +func (m *MockClientInterface) RbacServiceAPIUpdateGroup(ctx context.Context, organizationId, groupId string, body sdk.RbacServiceAPIUpdateGroupJSONRequestBody, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, organizationId, groupId, body} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RbacServiceAPIUpdateGroup", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPIUpdateGroup indicates an expected call of RbacServiceAPIUpdateGroup. +func (mr *MockClientInterfaceMockRecorder) RbacServiceAPIUpdateGroup(ctx, organizationId, groupId, body interface{}, reqEditors ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, organizationId, groupId, body}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPIUpdateGroup", reflect.TypeOf((*MockClientInterface)(nil).RbacServiceAPIUpdateGroup), varargs...) +} + +// RbacServiceAPIUpdateGroupWithBody mocks base method. +func (m *MockClientInterface) RbacServiceAPIUpdateGroupWithBody(ctx context.Context, organizationId, groupId, contentType string, body io.Reader, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, organizationId, groupId, contentType, body} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RbacServiceAPIUpdateGroupWithBody", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPIUpdateGroupWithBody indicates an expected call of RbacServiceAPIUpdateGroupWithBody. +func (mr *MockClientInterfaceMockRecorder) RbacServiceAPIUpdateGroupWithBody(ctx, organizationId, groupId, contentType, body interface{}, reqEditors ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, organizationId, groupId, contentType, body}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPIUpdateGroupWithBody", reflect.TypeOf((*MockClientInterface)(nil).RbacServiceAPIUpdateGroupWithBody), varargs...) +} + +// RbacServiceAPIUpdateRoleBinding mocks base method. +func (m *MockClientInterface) RbacServiceAPIUpdateRoleBinding(ctx context.Context, organizationId, roleBindingId string, body sdk.RbacServiceAPIUpdateRoleBindingJSONRequestBody, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, organizationId, roleBindingId, body} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RbacServiceAPIUpdateRoleBinding", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPIUpdateRoleBinding indicates an expected call of RbacServiceAPIUpdateRoleBinding. +func (mr *MockClientInterfaceMockRecorder) RbacServiceAPIUpdateRoleBinding(ctx, organizationId, roleBindingId, body interface{}, reqEditors ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, organizationId, roleBindingId, body}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPIUpdateRoleBinding", reflect.TypeOf((*MockClientInterface)(nil).RbacServiceAPIUpdateRoleBinding), varargs...) +} + +// RbacServiceAPIUpdateRoleBindingWithBody mocks base method. +func (m *MockClientInterface) RbacServiceAPIUpdateRoleBindingWithBody(ctx context.Context, organizationId, roleBindingId, contentType string, body io.Reader, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, organizationId, roleBindingId, contentType, body} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RbacServiceAPIUpdateRoleBindingWithBody", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPIUpdateRoleBindingWithBody indicates an expected call of RbacServiceAPIUpdateRoleBindingWithBody. +func (mr *MockClientInterfaceMockRecorder) RbacServiceAPIUpdateRoleBindingWithBody(ctx, organizationId, roleBindingId, contentType, body interface{}, reqEditors ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, organizationId, roleBindingId, contentType, body}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPIUpdateRoleBindingWithBody", reflect.TypeOf((*MockClientInterface)(nil).RbacServiceAPIUpdateRoleBindingWithBody), varargs...) +} + // SSOAPICreateSSOConnection mocks base method. func (m *MockClientInterface) SSOAPICreateSSOConnection(ctx context.Context, body sdk.SSOAPICreateSSOConnectionJSONRequestBody, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { m.ctrl.T.Helper() @@ -3435,26 +3675,6 @@ func (mr *MockClientInterfaceMockRecorder) WorkloadOptimizationAPIListWorkloads( return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WorkloadOptimizationAPIListWorkloads", reflect.TypeOf((*MockClientInterface)(nil).WorkloadOptimizationAPIListWorkloads), varargs...) } -// WorkloadOptimizationAPIUpdateWorkload mocks base method. -func (m *MockClientInterface) WorkloadOptimizationAPIUpdateWorkload(ctx context.Context, clusterId, workloadId string, body sdk.WorkloadOptimizationAPIUpdateWorkloadJSONRequestBody, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { - m.ctrl.T.Helper() - varargs := []interface{}{ctx, clusterId, workloadId, body} - for _, a := range reqEditors { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "WorkloadOptimizationAPIUpdateWorkload", varargs...) - ret0, _ := ret[0].(*http.Response) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// WorkloadOptimizationAPIUpdateWorkload indicates an expected call of WorkloadOptimizationAPIUpdateWorkload. -func (mr *MockClientInterfaceMockRecorder) WorkloadOptimizationAPIUpdateWorkload(ctx, clusterId, workloadId, body interface{}, reqEditors ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, clusterId, workloadId, body}, reqEditors...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WorkloadOptimizationAPIUpdateWorkload", reflect.TypeOf((*MockClientInterface)(nil).WorkloadOptimizationAPIUpdateWorkload), varargs...) -} - // WorkloadOptimizationAPIUpdateWorkloadScalingPolicy mocks base method. func (m *MockClientInterface) WorkloadOptimizationAPIUpdateWorkloadScalingPolicy(ctx context.Context, clusterId, policyId string, body sdk.WorkloadOptimizationAPIUpdateWorkloadScalingPolicyJSONRequestBody, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { m.ctrl.T.Helper() @@ -3535,26 +3755,6 @@ func (mr *MockClientInterfaceMockRecorder) WorkloadOptimizationAPIUpdateWorkload return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WorkloadOptimizationAPIUpdateWorkloadV2WithBody", reflect.TypeOf((*MockClientInterface)(nil).WorkloadOptimizationAPIUpdateWorkloadV2WithBody), varargs...) } -// WorkloadOptimizationAPIUpdateWorkloadWithBody mocks base method. -func (m *MockClientInterface) WorkloadOptimizationAPIUpdateWorkloadWithBody(ctx context.Context, clusterId, workloadId, contentType string, body io.Reader, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { - m.ctrl.T.Helper() - varargs := []interface{}{ctx, clusterId, workloadId, contentType, body} - for _, a := range reqEditors { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "WorkloadOptimizationAPIUpdateWorkloadWithBody", varargs...) - ret0, _ := ret[0].(*http.Response) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// WorkloadOptimizationAPIUpdateWorkloadWithBody indicates an expected call of WorkloadOptimizationAPIUpdateWorkloadWithBody. -func (mr *MockClientInterfaceMockRecorder) WorkloadOptimizationAPIUpdateWorkloadWithBody(ctx, clusterId, workloadId, contentType, body interface{}, reqEditors ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, clusterId, workloadId, contentType, body}, reqEditors...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WorkloadOptimizationAPIUpdateWorkloadWithBody", reflect.TypeOf((*MockClientInterface)(nil).WorkloadOptimizationAPIUpdateWorkloadWithBody), varargs...) -} - // MockClientWithResponsesInterface is a mock of ClientWithResponsesInterface interface. type MockClientWithResponsesInterface struct { ctrl *gomock.Controller @@ -5168,6 +5368,186 @@ func (mr *MockClientWithResponsesInterfaceMockRecorder) PoliciesAPIUpsertCluster return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PoliciesAPIUpsertClusterPoliciesWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).PoliciesAPIUpsertClusterPoliciesWithResponse), ctx, clusterId, body) } +// RbacServiceAPICreateGroupWithBodyWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) RbacServiceAPICreateGroupWithBodyWithResponse(ctx context.Context, organizationId, contentType string, body io.Reader) (*sdk.RbacServiceAPICreateGroupResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RbacServiceAPICreateGroupWithBodyWithResponse", ctx, organizationId, contentType, body) + ret0, _ := ret[0].(*sdk.RbacServiceAPICreateGroupResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPICreateGroupWithBodyWithResponse indicates an expected call of RbacServiceAPICreateGroupWithBodyWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) RbacServiceAPICreateGroupWithBodyWithResponse(ctx, organizationId, contentType, body interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPICreateGroupWithBodyWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).RbacServiceAPICreateGroupWithBodyWithResponse), ctx, organizationId, contentType, body) +} + +// RbacServiceAPICreateGroupWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) RbacServiceAPICreateGroupWithResponse(ctx context.Context, organizationId string, body sdk.RbacServiceAPICreateGroupJSONRequestBody) (*sdk.RbacServiceAPICreateGroupResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RbacServiceAPICreateGroupWithResponse", ctx, organizationId, body) + ret0, _ := ret[0].(*sdk.RbacServiceAPICreateGroupResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPICreateGroupWithResponse indicates an expected call of RbacServiceAPICreateGroupWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) RbacServiceAPICreateGroupWithResponse(ctx, organizationId, body interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPICreateGroupWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).RbacServiceAPICreateGroupWithResponse), ctx, organizationId, body) +} + +// RbacServiceAPICreateRoleBindingsWithBodyWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) RbacServiceAPICreateRoleBindingsWithBodyWithResponse(ctx context.Context, organizationId, contentType string, body io.Reader) (*sdk.RbacServiceAPICreateRoleBindingsResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RbacServiceAPICreateRoleBindingsWithBodyWithResponse", ctx, organizationId, contentType, body) + ret0, _ := ret[0].(*sdk.RbacServiceAPICreateRoleBindingsResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPICreateRoleBindingsWithBodyWithResponse indicates an expected call of RbacServiceAPICreateRoleBindingsWithBodyWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) RbacServiceAPICreateRoleBindingsWithBodyWithResponse(ctx, organizationId, contentType, body interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPICreateRoleBindingsWithBodyWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).RbacServiceAPICreateRoleBindingsWithBodyWithResponse), ctx, organizationId, contentType, body) +} + +// RbacServiceAPICreateRoleBindingsWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) RbacServiceAPICreateRoleBindingsWithResponse(ctx context.Context, organizationId string, body sdk.RbacServiceAPICreateRoleBindingsJSONRequestBody) (*sdk.RbacServiceAPICreateRoleBindingsResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RbacServiceAPICreateRoleBindingsWithResponse", ctx, organizationId, body) + ret0, _ := ret[0].(*sdk.RbacServiceAPICreateRoleBindingsResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPICreateRoleBindingsWithResponse indicates an expected call of RbacServiceAPICreateRoleBindingsWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) RbacServiceAPICreateRoleBindingsWithResponse(ctx, organizationId, body interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPICreateRoleBindingsWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).RbacServiceAPICreateRoleBindingsWithResponse), ctx, organizationId, body) +} + +// RbacServiceAPIDeleteGroupWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) RbacServiceAPIDeleteGroupWithResponse(ctx context.Context, organizationId, id string) (*sdk.RbacServiceAPIDeleteGroupResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RbacServiceAPIDeleteGroupWithResponse", ctx, organizationId, id) + ret0, _ := ret[0].(*sdk.RbacServiceAPIDeleteGroupResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPIDeleteGroupWithResponse indicates an expected call of RbacServiceAPIDeleteGroupWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) RbacServiceAPIDeleteGroupWithResponse(ctx, organizationId, id interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPIDeleteGroupWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).RbacServiceAPIDeleteGroupWithResponse), ctx, organizationId, id) +} + +// RbacServiceAPIDeleteRoleBindingWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) RbacServiceAPIDeleteRoleBindingWithResponse(ctx context.Context, organizationId, id string) (*sdk.RbacServiceAPIDeleteRoleBindingResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RbacServiceAPIDeleteRoleBindingWithResponse", ctx, organizationId, id) + ret0, _ := ret[0].(*sdk.RbacServiceAPIDeleteRoleBindingResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPIDeleteRoleBindingWithResponse indicates an expected call of RbacServiceAPIDeleteRoleBindingWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) RbacServiceAPIDeleteRoleBindingWithResponse(ctx, organizationId, id interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPIDeleteRoleBindingWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).RbacServiceAPIDeleteRoleBindingWithResponse), ctx, organizationId, id) +} + +// RbacServiceAPIGetGroupWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) RbacServiceAPIGetGroupWithResponse(ctx context.Context, organizationId, id string) (*sdk.RbacServiceAPIGetGroupResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RbacServiceAPIGetGroupWithResponse", ctx, organizationId, id) + ret0, _ := ret[0].(*sdk.RbacServiceAPIGetGroupResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPIGetGroupWithResponse indicates an expected call of RbacServiceAPIGetGroupWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) RbacServiceAPIGetGroupWithResponse(ctx, organizationId, id interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPIGetGroupWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).RbacServiceAPIGetGroupWithResponse), ctx, organizationId, id) +} + +// RbacServiceAPIGetRoleBindingWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) RbacServiceAPIGetRoleBindingWithResponse(ctx context.Context, organizationId, id string) (*sdk.RbacServiceAPIGetRoleBindingResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RbacServiceAPIGetRoleBindingWithResponse", ctx, organizationId, id) + ret0, _ := ret[0].(*sdk.RbacServiceAPIGetRoleBindingResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPIGetRoleBindingWithResponse indicates an expected call of RbacServiceAPIGetRoleBindingWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) RbacServiceAPIGetRoleBindingWithResponse(ctx, organizationId, id interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPIGetRoleBindingWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).RbacServiceAPIGetRoleBindingWithResponse), ctx, organizationId, id) +} + +// RbacServiceAPIUpdateGroupWithBodyWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) RbacServiceAPIUpdateGroupWithBodyWithResponse(ctx context.Context, organizationId, groupId, contentType string, body io.Reader) (*sdk.RbacServiceAPIUpdateGroupResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RbacServiceAPIUpdateGroupWithBodyWithResponse", ctx, organizationId, groupId, contentType, body) + ret0, _ := ret[0].(*sdk.RbacServiceAPIUpdateGroupResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPIUpdateGroupWithBodyWithResponse indicates an expected call of RbacServiceAPIUpdateGroupWithBodyWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) RbacServiceAPIUpdateGroupWithBodyWithResponse(ctx, organizationId, groupId, contentType, body interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPIUpdateGroupWithBodyWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).RbacServiceAPIUpdateGroupWithBodyWithResponse), ctx, organizationId, groupId, contentType, body) +} + +// RbacServiceAPIUpdateGroupWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) RbacServiceAPIUpdateGroupWithResponse(ctx context.Context, organizationId, groupId string, body sdk.RbacServiceAPIUpdateGroupJSONRequestBody) (*sdk.RbacServiceAPIUpdateGroupResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RbacServiceAPIUpdateGroupWithResponse", ctx, organizationId, groupId, body) + ret0, _ := ret[0].(*sdk.RbacServiceAPIUpdateGroupResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPIUpdateGroupWithResponse indicates an expected call of RbacServiceAPIUpdateGroupWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) RbacServiceAPIUpdateGroupWithResponse(ctx, organizationId, groupId, body interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPIUpdateGroupWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).RbacServiceAPIUpdateGroupWithResponse), ctx, organizationId, groupId, body) +} + +// RbacServiceAPIUpdateRoleBindingWithBodyWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) RbacServiceAPIUpdateRoleBindingWithBodyWithResponse(ctx context.Context, organizationId, roleBindingId, contentType string, body io.Reader) (*sdk.RbacServiceAPIUpdateRoleBindingResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RbacServiceAPIUpdateRoleBindingWithBodyWithResponse", ctx, organizationId, roleBindingId, contentType, body) + ret0, _ := ret[0].(*sdk.RbacServiceAPIUpdateRoleBindingResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPIUpdateRoleBindingWithBodyWithResponse indicates an expected call of RbacServiceAPIUpdateRoleBindingWithBodyWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) RbacServiceAPIUpdateRoleBindingWithBodyWithResponse(ctx, organizationId, roleBindingId, contentType, body interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPIUpdateRoleBindingWithBodyWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).RbacServiceAPIUpdateRoleBindingWithBodyWithResponse), ctx, organizationId, roleBindingId, contentType, body) +} + +// RbacServiceAPIUpdateRoleBindingWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) RbacServiceAPIUpdateRoleBindingWithResponse(ctx context.Context, organizationId, roleBindingId string, body sdk.RbacServiceAPIUpdateRoleBindingJSONRequestBody) (*sdk.RbacServiceAPIUpdateRoleBindingResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RbacServiceAPIUpdateRoleBindingWithResponse", ctx, organizationId, roleBindingId, body) + ret0, _ := ret[0].(*sdk.RbacServiceAPIUpdateRoleBindingResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RbacServiceAPIUpdateRoleBindingWithResponse indicates an expected call of RbacServiceAPIUpdateRoleBindingWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) RbacServiceAPIUpdateRoleBindingWithResponse(ctx, organizationId, roleBindingId, body interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RbacServiceAPIUpdateRoleBindingWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).RbacServiceAPIUpdateRoleBindingWithResponse), ctx, organizationId, roleBindingId, body) +} + // SSOAPICreateSSOConnectionWithBodyWithResponse mocks base method. func (m *MockClientWithResponsesInterface) SSOAPICreateSSOConnectionWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*sdk.SSOAPICreateSSOConnectionResponse, error) { m.ctrl.T.Helper() @@ -6158,36 +6538,6 @@ func (mr *MockClientWithResponsesInterfaceMockRecorder) WorkloadOptimizationAPIU return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WorkloadOptimizationAPIUpdateWorkloadV2WithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).WorkloadOptimizationAPIUpdateWorkloadV2WithResponse), ctx, clusterId, workloadId, body) } -// WorkloadOptimizationAPIUpdateWorkloadWithBodyWithResponse mocks base method. -func (m *MockClientWithResponsesInterface) WorkloadOptimizationAPIUpdateWorkloadWithBodyWithResponse(ctx context.Context, clusterId, workloadId, contentType string, body io.Reader) (*sdk.WorkloadOptimizationAPIUpdateWorkloadResponse, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "WorkloadOptimizationAPIUpdateWorkloadWithBodyWithResponse", ctx, clusterId, workloadId, contentType, body) - ret0, _ := ret[0].(*sdk.WorkloadOptimizationAPIUpdateWorkloadResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// WorkloadOptimizationAPIUpdateWorkloadWithBodyWithResponse indicates an expected call of WorkloadOptimizationAPIUpdateWorkloadWithBodyWithResponse. -func (mr *MockClientWithResponsesInterfaceMockRecorder) WorkloadOptimizationAPIUpdateWorkloadWithBodyWithResponse(ctx, clusterId, workloadId, contentType, body interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WorkloadOptimizationAPIUpdateWorkloadWithBodyWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).WorkloadOptimizationAPIUpdateWorkloadWithBodyWithResponse), ctx, clusterId, workloadId, contentType, body) -} - -// WorkloadOptimizationAPIUpdateWorkloadWithResponse mocks base method. -func (m *MockClientWithResponsesInterface) WorkloadOptimizationAPIUpdateWorkloadWithResponse(ctx context.Context, clusterId, workloadId string, body sdk.WorkloadOptimizationAPIUpdateWorkloadJSONRequestBody) (*sdk.WorkloadOptimizationAPIUpdateWorkloadResponse, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "WorkloadOptimizationAPIUpdateWorkloadWithResponse", ctx, clusterId, workloadId, body) - ret0, _ := ret[0].(*sdk.WorkloadOptimizationAPIUpdateWorkloadResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// WorkloadOptimizationAPIUpdateWorkloadWithResponse indicates an expected call of WorkloadOptimizationAPIUpdateWorkloadWithResponse. -func (mr *MockClientWithResponsesInterfaceMockRecorder) WorkloadOptimizationAPIUpdateWorkloadWithResponse(ctx, clusterId, workloadId, body interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WorkloadOptimizationAPIUpdateWorkloadWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).WorkloadOptimizationAPIUpdateWorkloadWithResponse), ctx, clusterId, workloadId, body) -} - // MockResponse is a mock of Response interface. type MockResponse struct { ctrl *gomock.Controller diff --git a/docs/resources/organization_group.md b/docs/resources/organization_group.md new file mode 100644 index 00000000..68300dc9 --- /dev/null +++ b/docs/resources/organization_group.md @@ -0,0 +1,63 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "castai_organization_group Resource - terraform-provider-castai" +subcategory: "" +description: |- + CAST AI organization group resource to manage organization groups +--- + +# castai_organization_group (Resource) + +CAST AI organization group resource to manage organization groups + + + + +## Schema + +### Required + +- `name` (String) Name of the group. +- `organization_id` (String) CAST AI organization ID. + +### Optional + +- `description` (String) Description of the group. +- `members` (Block List) (see [below for nested schema](#nestedblock--members)) +- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) + +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `members` + +Optional: + +- `member` (Block List) (see [below for nested schema](#nestedblock--members--member)) + + +### Nested Schema for `members.member` + +Required: + +- `email` (String) +- `kind` (String) Kind of the member. Supported values include: user, service_account. + +Read-Only: + +- `id` (String) The ID of this resource. + + + + +### Nested Schema for `timeouts` + +Optional: + +- `create` (String) +- `delete` (String) +- `update` (String) + + diff --git a/examples/organization_groups/main.tf b/examples/organization_groups/main.tf new file mode 100644 index 00000000..4093c43e --- /dev/null +++ b/examples/organization_groups/main.tf @@ -0,0 +1,50 @@ +terraform { + required_providers { + castai = { + source = "castai/castai" + } + } + required_version = ">= 0.13" +} + +data "castai_organization" "test" { + name = "My test organization name" +} + +resource "castai_organization_group" "first_group" { + organization_id = data.castai_organization.test.id + name = "first-group" + description = "A description of the first group." + + members { + member { + kind = "user" + id = "21c133e2-a899-4f51-b297-830bc62e51d6" + email = "first-user@cast.ai" + } + member { + kind = "user" + id = "21c133e2-a899-4f51-b297-830bc62e51d7" + email = "second-user@cast.ai" + } + member { + kind = "service_account" + id = "21c133e2-a899-4f51-b297-830bc62e51d9" + email = "service_account-2@cast.ai" + } + } +} + +resource "castai_organization_group" "second_group" { + organization_id = data.castai_organization.test.id + name = "second-group" + description = "A description of the second group." + + members { + member { + kind = "user" + id = "21c133e2-a899-4f51-b297-830bc62e51d6" + email = "first-user@cast.ai" + } + } +} \ No newline at end of file