Skip to content

Commit

Permalink
VPC: Create basic types for VPC
Browse files Browse the repository at this point in the history
Create a basic COS instance and VPC resource type that
VPC definitions will use.
  • Loading branch information
cjschaef committed Mar 19, 2024
1 parent 71a3af8 commit 7b12dfe
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
47 changes: 47 additions & 0 deletions api/v1beta2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,42 @@ var (
ResourceTypeVPC = ResourceType("vpc")
// ResourceTypeSubnet is VPC subnet resource.
ResourceTypeSubnet = ResourceType("subnet")
// ResourceTypePublicGateway is a VPC Public Gateway resource.
ResourceTypePublicGateway = ResourceType("publicGateway")
// ResourceTypeSecurityGroup is a VPC Security Group resource.
ResourceTypeSecurityGroup = ResourceType("securityGroup")
// ResourceTypeCOSInstance is IBM COS instance resource.
ResourceTypeCOSInstance = ResourceType("cosInstance")
// ResourceTypeResourceGroup is IBM Resource Group.
ResourceTypeResourceGroup = ResourceType("resourceGroup")
)

// COSInstanceReference represents an IBM Cloud COS instance.
type COSInstanceReference struct {
// name defines the name of the COS Instance.
// +kubebuilder:validation:MinLength:=3
// +kubebuilder:validation:MaxLength:=63
// +kubebuilder:validation:Pattern=`^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$`
// +required
Name string `json:"name"`

// id is the ID of the COS instance.
// +optional
ID *string `json:"id,omitempty"`

// bucketName is IBM Cloud COS bucket name.
// +optional
BucketName *string `json:"bucketName,omitempty"`

// bucketID is the IBM Cloud COS bucket ID.
// +optional
BucketID *string `json:"bucketID,omitempty"`

// bucketRegion is IBM Cloud COS bucket region.
// +optional
BucketRegion *string `json:"bucketRegion,omitempty"`
}

// NetworkInterface holds the network interface information like subnet id.
type NetworkInterface struct {
// Subnet ID of the network interface.
Expand All @@ -163,3 +193,20 @@ type VPCEndpoint struct {
// +optional
LBID *string `json:"loadBalancerIPID,omitempty"`
}

// VPCResource represents a specific VPC resource.
// +kubebuilder:validation:XValidation:rule="!has(self.id) && !has(self.name)",message="an id or name must be provided"
type VPCResource struct {
// id of the resource.
// +kubebuilder:validation:MinLength=1
// +optional
ID *string `json:"id,omitempty"`

// name of the resource.
// +kubebuilder:validation:MinLength=1
// +optional
Name *string `json:"name,omitempty"`

// type is the type of VPC resource.
Type *ResourceType `json:"type,omitempty"`
}
55 changes: 55 additions & 0 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7b12dfe

Please sign in to comment.