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

Refactor provider for new Exoscale API v3 #122

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apis/exoscale/v1/bucket_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type BucketParameters struct {
// Be aware that S3 providers may require a unique name across the platform or zone.
BucketName string `json:"bucketName,omitempty"`

// +kubebuilder:validation:Required
// +kubebuilder:validation:Optional

// Deprecated: Only here for compatibility with legacy Bucket objects
EndpointURL string `json:"endpointURL,omitempty"`
Expand Down
13 changes: 7 additions & 6 deletions apis/exoscale/v1/dbaas_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
"strings"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
exoscaleoapi "github.com/exoscale/egoscale/v2/oapi"
exoscalesdk "github.com/exoscale/egoscale/v3"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand All @@ -27,19 +28,19 @@ type NodeState struct {
// Name of the service node
Name string `json:"name,omitempty"`
// Role of this node.
Role exoscaleoapi.DbaasNodeStateRole `json:"role,omitempty"`
Role exoscalesdk.DBAASNodeStateRole `json:"role,omitempty"`
// State of the service node.
State exoscaleoapi.DbaasNodeStateState `json:"state,omitempty"`
State exoscalesdk.DBAASNodeStateState `json:"state,omitempty"`
}

// Notification contains a service message.
type Notification struct {
// Level of the notification.
Level exoscaleoapi.DbaasServiceNotificationLevel `json:"level,omitempty"`
Level exoscalesdk.DBAASServiceNotificationLevel `json:"level,omitempty"`
// Message contains the notification.
Message string `json:"message,omitempty"`
// Type of the notification.
Type exoscaleoapi.DbaasServiceNotificationType `json:"type,omitempty"`
Type exoscalesdk.DBAASServiceNotificationType `json:"type,omitempty"`
// Metadata contains additional data.
Metadata runtime.RawExtension `json:"metadata,omitempty"`
}
Expand All @@ -61,7 +62,7 @@ type MaintenanceSpec struct {

// DayOfWeek specifies at which weekday the maintenance is held place.
// Allowed values are [monday, tuesday, wednesday, thursday, friday, saturday, sunday, never]
DayOfWeek exoscaleoapi.DbaasServiceMaintenanceDow `json:"dayOfWeek,omitempty"`
DayOfWeek exoscalesdk.DBAASServiceMaintenanceDow `json:"dayOfWeek,omitempty"`

// TimeOfDay for installing updates in UTC.
// Format: "hh:mm:ss".
Expand Down
18 changes: 9 additions & 9 deletions apis/exoscale/v1/dbaas_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package v1
import (
"testing"

"github.com/exoscale/egoscale/v2/oapi"
exoscalesdk "github.com/exoscale/egoscale/v3"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -70,44 +70,44 @@ func TestMaintenanceSpec_Equals(t *testing.T) {
},
"same equals": {
ms: MaintenanceSpec{
DayOfWeek: oapi.DbaasServiceMaintenanceDowFriday,
DayOfWeek: exoscalesdk.DBAASServiceMaintenanceDowFriday,
TimeOfDay: "12:00:00",
},
other: MaintenanceSpec{
DayOfWeek: oapi.DbaasServiceMaintenanceDowFriday,
DayOfWeek: exoscalesdk.DBAASServiceMaintenanceDowFriday,
TimeOfDay: "12:00:00",
},
want: true,
},
"day diff": {
ms: MaintenanceSpec{
DayOfWeek: oapi.DbaasServiceMaintenanceDowMonday,
DayOfWeek: exoscalesdk.DBAASServiceMaintenanceDowMonday,
TimeOfDay: "12:00:00",
},
other: MaintenanceSpec{
DayOfWeek: oapi.DbaasServiceMaintenanceDowFriday,
DayOfWeek: exoscalesdk.DBAASServiceMaintenanceDowFriday,
TimeOfDay: "12:00:00",
},
want: false,
},
"time diff": {
ms: MaintenanceSpec{
DayOfWeek: oapi.DbaasServiceMaintenanceDowFriday,
DayOfWeek: exoscalesdk.DBAASServiceMaintenanceDowFriday,
TimeOfDay: "12:00:01",
},
other: MaintenanceSpec{
DayOfWeek: oapi.DbaasServiceMaintenanceDowFriday,
DayOfWeek: exoscalesdk.DBAASServiceMaintenanceDowFriday,
TimeOfDay: "12:00:00",
},
want: false,
},
"date & time diff": {
ms: MaintenanceSpec{
DayOfWeek: oapi.DbaasServiceMaintenanceDowFriday,
DayOfWeek: exoscalesdk.DBAASServiceMaintenanceDowFriday,
TimeOfDay: "12:00:01",
},
other: MaintenanceSpec{
DayOfWeek: oapi.DbaasServiceMaintenanceDowMonday,
DayOfWeek: exoscalesdk.DBAASServiceMaintenanceDowFriday,
TimeOfDay: "12:00:00",
},
want: false,
Expand Down
5 changes: 3 additions & 2 deletions apis/exoscale/v1/iam_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
"github.com/crossplane/crossplane-runtime/pkg/meta"
exoscalesdk "github.com/exoscale/egoscale/v3"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
)
Expand Down Expand Up @@ -46,7 +47,7 @@ type IAMKeyParameters struct {
// Zone is the name of the zone where the IAM key is created.
// The zone must be available in the S3 endpoint.
// Cannot be changed after IAMKey is created.
Zone string `json:"zone"`
Zone Zone `json:"zone"`

// +kubebuilder:validation:Required

Expand All @@ -67,7 +68,7 @@ type IAMKeyObservation struct {
KeyID string `json:"keyID,omitempty"`

// RoleID is the observed unique ID as generated by exoscale.com.
RoleID string `json:"roleID,omitempty"`
RoleID exoscalesdk.UUID `json:"roleID,omitempty"`

// KeyName is the observed key name as generated by exoscale.com.
KeyName string `json:"keyName,omitempty"`
Expand Down
Loading
Loading