Skip to content

Commit

Permalink
feat: add s3key
Browse files Browse the repository at this point in the history
  • Loading branch information
cristiGuranIonos committed Oct 11, 2023
1 parent ddccb56 commit 5d7b031
Show file tree
Hide file tree
Showing 9 changed files with 695 additions and 0 deletions.
96 changes: 96 additions & 0 deletions apis/compute/v1alpha1/s3_ley_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package v1alpha1

import (
"reflect"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
)

// S3KeyParameters are the observable fields of an S3Key.
// Required values when creating an S3Key:
// UserID
type S3KeyParameters struct {
// The UUID of the user owning the S3 Key.
//
// +kubebuilder:validation:Required
UserID string `json:"userID"`
// The S3 Secret key.
//
// +immutable
// +kubebuilder:validation:Optional
SecretKey string `json:"secretKey"`
// Whether the S3 is active / enabled or not. Can only be updated to false, by default the key will be created as active. Default value is true.
//
// +kubebuilder:validation:Optional
// +kubebuilder:validation:default=true
Active bool `json:"active,omitempty"`
}

// +kubebuilder:object:root=true

// A S3Key is an example API type.
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
// +kubebuilder:printcolumn:name="S3Key ID",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name"
// +kubebuilder:printcolumn:name="UserID",priority=1,type="string",JSONPath=".spec.forProvider.userID"
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,ionoscloud}
type S3Key struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec S3KeySpec `json:"spec"`
Status S3KeyStatus `json:"status,omitempty"`
ManagementPolicies xpv1.ManagementPolicies `json:"managementPolicies"`
}

// SetManagementPolicies implement managed interface
func (mg *S3Key) SetManagementPolicies(p xpv1.ManagementPolicies) {
mg.ManagementPolicies = p
}

// GetManagementPolicies implement managed interface
func (mg *S3Key) GetManagementPolicies() xpv1.ManagementPolicies {
return mg.ManagementPolicies
}

// A S3KeySpec defines the desired state of a S3Key.
type S3KeySpec struct {
xpv1.ResourceSpec `json:",inline"`
ForProvider S3KeyParameters `json:"forProvider"`
}

// A S3KeyStatus represents the observed state of a S3Key.
type S3KeyStatus struct {
xpv1.ResourceStatus `json:",inline"`
AtProvider S3KeyObservation `json:"atProvider,omitempty"`
}

// S3KeyObservation are the observable fields of a S3Key.
type S3KeyObservation struct {
SecretKey string `json:"secretKey,omitempty"`
S3KeyID string `json:"s3KeyID,omitempty"`
}

// +kubebuilder:object:root=true

// S3KeyList contains a list of S3Key
type S3KeyList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []S3Key `json:"items"`
}

// S3Key type metadata.
var (
S3KeyKind = reflect.TypeOf(S3Key{}).Name()
S3KeyGroupKind = schema.GroupKind{Group: Group, Kind: S3KeyKind}.String()
S3KeyKindAPIVersion = S3KeyKind + "." + SchemeGroupVersion.String()
S3KeyGroupVersionKind = SchemeGroupVersion.WithKind(S3KeyKind)
)

func init() {
SchemeBuilder.Register(&S3Key{}, &S3KeyList{})
}
128 changes: 128 additions & 0 deletions apis/compute/v1alpha1/zz_generated.deepcopy.go

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

66 changes: 66 additions & 0 deletions apis/compute/v1alpha1/zz_generated.managed.go

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

9 changes: 9 additions & 0 deletions apis/compute/v1alpha1/zz_generated.managedlist.go

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

Loading

0 comments on commit 5d7b031

Please sign in to comment.