Skip to content

Commit 23e474b

Browse files
committed
RegisteredLimit Type Declaration
On-behalf-of: SAP nils.gondermann@sap.com
1 parent f05b655 commit 23e474b

9 files changed

Lines changed: 296 additions & 109 deletions

File tree

api/v1alpha1/registeredlimit_types.go

Lines changed: 49 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ package v1alpha1
1818

1919
// RegisteredLimitResourceSpec contains the desired state of the resource.
2020
type RegisteredLimitResourceSpec struct {
21-
// name will be the name of the created resource. If not specified, the
22-
// name of the ORC object will be used.
23-
// +optional
24-
Name *OpenStackName `json:"name,omitempty"`
25-
2621
// description is a human-readable description for the resource.
2722
// +kubebuilder:validation:MinLength:=1
2823
// +kubebuilder:validation:MaxLength:=255
@@ -34,51 +29,76 @@ type RegisteredLimitResourceSpec struct {
3429
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="serviceRef is immutable"
3530
ServiceRef KubernetesNameRef `json:"serviceRef,omitempty"`
3631

37-
// TODO(scaffolding): Add more types.
38-
// To see what is supported, you can take inspiration from the CreateOpts structure from
39-
// github.com/gophercloud/gophercloud/v2/openstack/identity/v3/registeredlimits
40-
//
41-
// Until you have implemented mutability for the field, you must add a CEL validation
42-
// preventing the field being modified:
43-
// `// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="<fieldname> is immutable"`
32+
// resourceName is name of the resource to be limited.
33+
// +kubebuilder:validation:MinLength:=1
34+
// +kubebuilder:validation:MaxLength:=255
35+
// +required
36+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="resourceName is immutable"
37+
ResourceName string `json:"resourceName,omitempty"`
38+
39+
// defaultLimit is limit of the specified resource in the given context.
40+
// +required
41+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="defaultLimit is immutable"
42+
DefaultLimit int `json:"defaultLimit,omitempty"`
43+
44+
// regionID is the ID of the region that contains the service endpoint.
45+
// +kubebuilder:validation:MinLength:=1
46+
// +kubebuilder:validation:MaxLength:=255
47+
// +optional
48+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="regionID is immutable"
49+
RegionID *string `json:"regionID,omitempty"`
4450
}
4551

4652
// RegisteredLimitFilter defines an existing resource by its properties
4753
// +kubebuilder:validation:MinProperties:=1
4854
type RegisteredLimitFilter struct {
49-
// name of the existing resource
50-
// +optional
51-
Name *OpenStackName `json:"name,omitempty"`
52-
5355
// description of the existing resource
5456
// +kubebuilder:validation:MinLength:=1
5557
// +kubebuilder:validation:MaxLength:=255
5658
// +optional
5759
Description *string `json:"description,omitempty"`
5860

59-
// TODO(scaffolding): Add more types.
60-
// To see what is supported, you can take inspiration from the ListOpts structure from
61-
// github.com/gophercloud/gophercloud/v2/openstack/identity/v3/registeredlimits
61+
// regionID is the ID of the region that contains the service endpoint.
62+
// +kubebuilder:validation:MinLength:=1
63+
// +kubebuilder:validation:MaxLength:=255
64+
// +optional
65+
RegionID *string `json:"regionID,omitempty"`
66+
67+
// serviceRef is a reference to the ORC Service which this resource is associated with.
68+
// +optional
69+
ServiceRef *KubernetesNameRef `json:"serviceRef,omitempty"`
70+
71+
// resourceName is name of the resource to be limited.
72+
// +kubebuilder:validation:MinLength:=1
73+
// +kubebuilder:validation:MaxLength:=255
74+
// +optional
75+
ResourceName *string `json:"resourceName,omitempty"`
6276
}
6377

6478
// RegisteredLimitResourceStatus represents the observed state of the resource.
6579
type RegisteredLimitResourceStatus struct {
66-
// name is a Human-readable name for the resource. Might not be unique.
67-
// +kubebuilder:validation:MaxLength=1024
68-
// +optional
69-
Name string `json:"name,omitempty"`
70-
7180
// description is a human-readable description for the resource.
7281
// +kubebuilder:validation:MaxLength=1024
7382
// +optional
7483
Description string `json:"description,omitempty"`
7584

76-
// serviceID is the ID of the Service to which the resource is associated.
77-
// +kubebuilder:validation:MaxLength=1024
85+
// resourceName is name of the resource to be limited.
86+
// +kubebuilder:validation:MinLength:=1
87+
// +kubebuilder:validation:MaxLength:=255
88+
// +optional
89+
ResourceName string `json:"resourceName,omitempty"`
90+
91+
// regionID is the ID of the region that contains the service endpoint.
92+
// +kubebuilder:validation:MaxLength:=1024
93+
// +optional
94+
RegionID string `json:"regionID,omitempty"`
95+
96+
// serviceID is a reference to the ORC Service which this resource is associated with.
97+
// +kubebuilder:validation:MaxLength:=1024
7898
// +optional
7999
ServiceID string `json:"serviceID,omitempty"`
80100

81-
// TODO(scaffolding): Add more types.
82-
// To see what is supported, you can take inspiration from the RegisteredLimit structure from
83-
// github.com/gophercloud/gophercloud/v2/openstack/identity/v3/registeredlimits
101+
// defaultLimit is limit of the specified resource in the given context.
102+
// +optional
103+
DefaultLimit int `json:"defaultLimit,omitempty"`
84104
}

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 20 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/models-schema/zz_generated.openapi.go

Lines changed: 58 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)