Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Alibaba cloud SLS project #58

Merged
merged 13 commits into from
Apr 6, 2021
2 changes: 2 additions & 0 deletions apis/alibaba.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"

databasev1alpha1 "github.com/crossplane/provider-alibaba/apis/database/v1alpha1"
slsv1alpha1 "github.com/crossplane/provider-alibaba/apis/sls/v1alpha1"
"github.com/crossplane/provider-alibaba/apis/v1alpha1"
)

Expand All @@ -29,6 +30,7 @@ func init() {
AddToSchemes = append(AddToSchemes,
v1alpha1.SchemeBuilder.AddToScheme,
databasev1alpha1.SchemeBuilder.AddToScheme,
slsv1alpha1.AddToScheme,
)
}

Expand Down
2 changes: 1 addition & 1 deletion apis/database/v1alpha1/zz_generated.managed.go

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

2 changes: 1 addition & 1 deletion apis/database/v1alpha1/zz_generated.managedlist.go

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

19 changes: 19 additions & 0 deletions apis/sls/sls.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*

Copyright 2021 The Crossplane Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/

package sls
55 changes: 55 additions & 0 deletions apis/sls/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*

Copyright 2021 The Crossplane Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/

// Package v1alpha1 contains API Schema definitions for the sls v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=sls.alibaba.crossplane.io
package v1alpha1

import (
"reflect"

"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "sls.alibaba.crossplane.io", Version: "v1alpha1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)

var (
// ProjectKind is the kind of Project
ProjectKind = reflect.TypeOf(Project{}).Name()

// ProjectGroupKind is the group and kind of Project
ProjectGroupKind = schema.GroupKind{Group: GroupVersion.Group, Kind: ProjectKind}.String()

// ProjectGroupVersionKind is the group, version and kind of Project
ProjectGroupVersionKind = GroupVersion.WithKind(ProjectKind)
)

func init() {
SchemeBuilder.Register(&Project{}, &ProjectList{})
}
85 changes: 85 additions & 0 deletions apis/sls/v1alpha1/project_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*

Copyright 2021 The Crossplane Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/

package v1alpha1

import (
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
negz marked this conversation as resolved.
Show resolved Hide resolved

// ProjectSpec defines the desired state of SLS Project
type ProjectSpec struct {
xpv1.ResourceSpec `json:",inline"`

// ForProvider field is where use set parameters for SLS project
ForProvider ProjectParameters `json:"forProvider"`
}

// ProjectObservation is the representation of the current state that is observed.
type ProjectObservation struct {
// CreateTime is the time when the project was created
CreateTime string `json:"createTime"`

// LastModifyTime is the time when the project was last modified
LastModifyTime string `json:"lastModifyTime"`

// Owner is the ID of the Alibaba Cloud account that was used to create the project
Owner string `json:"owner"`

// Status is the the status of the project
Status string `json:"status"`

// Region is the region to which the project belongs
Region string `json:"region"`
}

// ProjectStatus defines the observed state of SLS Project
type ProjectStatus struct {
xpv1.ResourceStatus `json:",inline"`
AtProvider ProjectObservation `json:"atProvider,omitempty"`
}

// ProjectParameters define the desired state of an SLS project.
type ProjectParameters struct {
Description string `json:"description"`
}

// +kubebuilder:object:root=true

// Project is the Schema for the SLS Projects API
// +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="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,alibaba}
type Project struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ProjectSpec `json:"spec"`
Status ProjectStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// ProjectList contains a list of Project
type ProjectList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Project `json:"items"`
}
148 changes: 148 additions & 0 deletions apis/sls/v1alpha1/zz_generated.deepcopy.go

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

Loading