diff --git a/apis/publiccloudnetwork/v1alpha1/zz_generated.deepcopy.go b/apis/publiccloudnetwork/v1alpha1/zz_generated.deepcopy.go index f5ea1b5..cce0d75 100644 --- a/apis/publiccloudnetwork/v1alpha1/zz_generated.deepcopy.go +++ b/apis/publiccloudnetwork/v1alpha1/zz_generated.deepcopy.go @@ -12,6 +12,76 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPPoolsInitParameters) DeepCopyInto(out *IPPoolsInitParameters) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPPoolsInitParameters. +func (in *IPPoolsInitParameters) DeepCopy() *IPPoolsInitParameters { + if in == nil { + return nil + } + out := new(IPPoolsInitParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPPoolsObservation) DeepCopyInto(out *IPPoolsObservation) { + *out = *in + if in.DHCP != nil { + in, out := &in.DHCP, &out.DHCP + *out = new(bool) + **out = **in + } + if in.End != nil { + in, out := &in.End, &out.End + *out = new(string) + **out = **in + } + if in.Network != nil { + in, out := &in.Network, &out.Network + *out = new(string) + **out = **in + } + if in.Region != nil { + in, out := &in.Region, &out.Region + *out = new(string) + **out = **in + } + if in.Start != nil { + in, out := &in.Start, &out.Start + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPPoolsObservation. +func (in *IPPoolsObservation) DeepCopy() *IPPoolsObservation { + if in == nil { + return nil + } + out := new(IPPoolsObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPPoolsParameters) DeepCopyInto(out *IPPoolsParameters) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPPoolsParameters. +func (in *IPPoolsParameters) DeepCopy() *IPPoolsParameters { + if in == nil { + return nil + } + out := new(IPPoolsParameters) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ProjectNetworkPrivate) DeepCopyInto(out *ProjectNetworkPrivate) { *out = *in @@ -243,6 +313,287 @@ func (in *ProjectNetworkPrivateStatus) DeepCopy() *ProjectNetworkPrivateStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectNetworkPrivateSubnet) DeepCopyInto(out *ProjectNetworkPrivateSubnet) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectNetworkPrivateSubnet. +func (in *ProjectNetworkPrivateSubnet) DeepCopy() *ProjectNetworkPrivateSubnet { + if in == nil { + return nil + } + out := new(ProjectNetworkPrivateSubnet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProjectNetworkPrivateSubnet) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectNetworkPrivateSubnetInitParameters) DeepCopyInto(out *ProjectNetworkPrivateSubnetInitParameters) { + *out = *in + if in.DHCP != nil { + in, out := &in.DHCP, &out.DHCP + *out = new(bool) + **out = **in + } + if in.End != nil { + in, out := &in.End, &out.End + *out = new(string) + **out = **in + } + if in.Network != nil { + in, out := &in.Network, &out.Network + *out = new(string) + **out = **in + } + if in.NetworkID != nil { + in, out := &in.NetworkID, &out.NetworkID + *out = new(string) + **out = **in + } + if in.NoGateway != nil { + in, out := &in.NoGateway, &out.NoGateway + *out = new(bool) + **out = **in + } + if in.Region != nil { + in, out := &in.Region, &out.Region + *out = new(string) + **out = **in + } + if in.ServiceName != nil { + in, out := &in.ServiceName, &out.ServiceName + *out = new(string) + **out = **in + } + if in.Start != nil { + in, out := &in.Start, &out.Start + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectNetworkPrivateSubnetInitParameters. +func (in *ProjectNetworkPrivateSubnetInitParameters) DeepCopy() *ProjectNetworkPrivateSubnetInitParameters { + if in == nil { + return nil + } + out := new(ProjectNetworkPrivateSubnetInitParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectNetworkPrivateSubnetList) DeepCopyInto(out *ProjectNetworkPrivateSubnetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ProjectNetworkPrivateSubnet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectNetworkPrivateSubnetList. +func (in *ProjectNetworkPrivateSubnetList) DeepCopy() *ProjectNetworkPrivateSubnetList { + if in == nil { + return nil + } + out := new(ProjectNetworkPrivateSubnetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProjectNetworkPrivateSubnetList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectNetworkPrivateSubnetObservation) DeepCopyInto(out *ProjectNetworkPrivateSubnetObservation) { + *out = *in + if in.Cidr != nil { + in, out := &in.Cidr, &out.Cidr + *out = new(string) + **out = **in + } + if in.DHCP != nil { + in, out := &in.DHCP, &out.DHCP + *out = new(bool) + **out = **in + } + if in.End != nil { + in, out := &in.End, &out.End + *out = new(string) + **out = **in + } + if in.GatewayIP != nil { + in, out := &in.GatewayIP, &out.GatewayIP + *out = new(string) + **out = **in + } + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.IPPools != nil { + in, out := &in.IPPools, &out.IPPools + *out = make([]IPPoolsObservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Network != nil { + in, out := &in.Network, &out.Network + *out = new(string) + **out = **in + } + if in.NetworkID != nil { + in, out := &in.NetworkID, &out.NetworkID + *out = new(string) + **out = **in + } + if in.NoGateway != nil { + in, out := &in.NoGateway, &out.NoGateway + *out = new(bool) + **out = **in + } + if in.Region != nil { + in, out := &in.Region, &out.Region + *out = new(string) + **out = **in + } + if in.ServiceName != nil { + in, out := &in.ServiceName, &out.ServiceName + *out = new(string) + **out = **in + } + if in.Start != nil { + in, out := &in.Start, &out.Start + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectNetworkPrivateSubnetObservation. +func (in *ProjectNetworkPrivateSubnetObservation) DeepCopy() *ProjectNetworkPrivateSubnetObservation { + if in == nil { + return nil + } + out := new(ProjectNetworkPrivateSubnetObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectNetworkPrivateSubnetParameters) DeepCopyInto(out *ProjectNetworkPrivateSubnetParameters) { + *out = *in + if in.DHCP != nil { + in, out := &in.DHCP, &out.DHCP + *out = new(bool) + **out = **in + } + if in.End != nil { + in, out := &in.End, &out.End + *out = new(string) + **out = **in + } + if in.Network != nil { + in, out := &in.Network, &out.Network + *out = new(string) + **out = **in + } + if in.NetworkID != nil { + in, out := &in.NetworkID, &out.NetworkID + *out = new(string) + **out = **in + } + if in.NoGateway != nil { + in, out := &in.NoGateway, &out.NoGateway + *out = new(bool) + **out = **in + } + if in.Region != nil { + in, out := &in.Region, &out.Region + *out = new(string) + **out = **in + } + if in.ServiceName != nil { + in, out := &in.ServiceName, &out.ServiceName + *out = new(string) + **out = **in + } + if in.Start != nil { + in, out := &in.Start, &out.Start + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectNetworkPrivateSubnetParameters. +func (in *ProjectNetworkPrivateSubnetParameters) DeepCopy() *ProjectNetworkPrivateSubnetParameters { + if in == nil { + return nil + } + out := new(ProjectNetworkPrivateSubnetParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectNetworkPrivateSubnetSpec) DeepCopyInto(out *ProjectNetworkPrivateSubnetSpec) { + *out = *in + in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ForProvider.DeepCopyInto(&out.ForProvider) + in.InitProvider.DeepCopyInto(&out.InitProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectNetworkPrivateSubnetSpec. +func (in *ProjectNetworkPrivateSubnetSpec) DeepCopy() *ProjectNetworkPrivateSubnetSpec { + if in == nil { + return nil + } + out := new(ProjectNetworkPrivateSubnetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectNetworkPrivateSubnetStatus) DeepCopyInto(out *ProjectNetworkPrivateSubnetStatus) { + *out = *in + in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) + in.AtProvider.DeepCopyInto(&out.AtProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectNetworkPrivateSubnetStatus. +func (in *ProjectNetworkPrivateSubnetStatus) DeepCopy() *ProjectNetworkPrivateSubnetStatus { + if in == nil { + return nil + } + out := new(ProjectNetworkPrivateSubnetStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RegionsAttributesInitParameters) DeepCopyInto(out *RegionsAttributesInitParameters) { *out = *in diff --git a/apis/publiccloudnetwork/v1alpha1/zz_generated.managed.go b/apis/publiccloudnetwork/v1alpha1/zz_generated.managed.go index 69f6c8a..15b1d98 100644 --- a/apis/publiccloudnetwork/v1alpha1/zz_generated.managed.go +++ b/apis/publiccloudnetwork/v1alpha1/zz_generated.managed.go @@ -66,3 +66,63 @@ func (mg *ProjectNetworkPrivate) SetPublishConnectionDetailsTo(r *xpv1.PublishCo func (mg *ProjectNetworkPrivate) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { mg.Spec.WriteConnectionSecretToReference = r } + +// GetCondition of this ProjectNetworkPrivateSubnet. +func (mg *ProjectNetworkPrivateSubnet) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this ProjectNetworkPrivateSubnet. +func (mg *ProjectNetworkPrivateSubnet) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetManagementPolicies of this ProjectNetworkPrivateSubnet. +func (mg *ProjectNetworkPrivateSubnet) GetManagementPolicies() xpv1.ManagementPolicies { + return mg.Spec.ManagementPolicies +} + +// GetProviderConfigReference of this ProjectNetworkPrivateSubnet. +func (mg *ProjectNetworkPrivateSubnet) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +// GetPublishConnectionDetailsTo of this ProjectNetworkPrivateSubnet. +func (mg *ProjectNetworkPrivateSubnet) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { + return mg.Spec.PublishConnectionDetailsTo +} + +// GetWriteConnectionSecretToReference of this ProjectNetworkPrivateSubnet. +func (mg *ProjectNetworkPrivateSubnet) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this ProjectNetworkPrivateSubnet. +func (mg *ProjectNetworkPrivateSubnet) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this ProjectNetworkPrivateSubnet. +func (mg *ProjectNetworkPrivateSubnet) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetManagementPolicies of this ProjectNetworkPrivateSubnet. +func (mg *ProjectNetworkPrivateSubnet) SetManagementPolicies(r xpv1.ManagementPolicies) { + mg.Spec.ManagementPolicies = r +} + +// SetProviderConfigReference of this ProjectNetworkPrivateSubnet. +func (mg *ProjectNetworkPrivateSubnet) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +// SetPublishConnectionDetailsTo of this ProjectNetworkPrivateSubnet. +func (mg *ProjectNetworkPrivateSubnet) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { + mg.Spec.PublishConnectionDetailsTo = r +} + +// SetWriteConnectionSecretToReference of this ProjectNetworkPrivateSubnet. +func (mg *ProjectNetworkPrivateSubnet) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} diff --git a/apis/publiccloudnetwork/v1alpha1/zz_generated.managedlist.go b/apis/publiccloudnetwork/v1alpha1/zz_generated.managedlist.go index 4a1ba81..8fbff4a 100644 --- a/apis/publiccloudnetwork/v1alpha1/zz_generated.managedlist.go +++ b/apis/publiccloudnetwork/v1alpha1/zz_generated.managedlist.go @@ -15,3 +15,12 @@ func (l *ProjectNetworkPrivateList) GetItems() []resource.Managed { } return items } + +// GetItems of this ProjectNetworkPrivateSubnetList. +func (l *ProjectNetworkPrivateSubnetList) GetItems() []resource.Managed { + items := make([]resource.Managed, len(l.Items)) + for i := range l.Items { + items[i] = &l.Items[i] + } + return items +} diff --git a/apis/publiccloudnetwork/v1alpha1/zz_generated_terraformed.go b/apis/publiccloudnetwork/v1alpha1/zz_generated_terraformed.go index 489fcf3..9550194 100755 --- a/apis/publiccloudnetwork/v1alpha1/zz_generated_terraformed.go +++ b/apis/publiccloudnetwork/v1alpha1/zz_generated_terraformed.go @@ -100,3 +100,87 @@ func (tr *ProjectNetworkPrivate) LateInitialize(attrs []byte) (bool, error) { func (tr *ProjectNetworkPrivate) GetTerraformSchemaVersion() int { return 0 } + +// GetTerraformResourceType returns Terraform resource type for this ProjectNetworkPrivateSubnet +func (mg *ProjectNetworkPrivateSubnet) GetTerraformResourceType() string { + return "ovh_cloud_project_network_private_subnet" +} + +// GetConnectionDetailsMapping for this ProjectNetworkPrivateSubnet +func (tr *ProjectNetworkPrivateSubnet) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ProjectNetworkPrivateSubnet +func (tr *ProjectNetworkPrivateSubnet) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ProjectNetworkPrivateSubnet +func (tr *ProjectNetworkPrivateSubnet) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ProjectNetworkPrivateSubnet +func (tr *ProjectNetworkPrivateSubnet) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ProjectNetworkPrivateSubnet +func (tr *ProjectNetworkPrivateSubnet) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ProjectNetworkPrivateSubnet +func (tr *ProjectNetworkPrivateSubnet) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ProjectNetworkPrivateSubnet +func (tr *ProjectNetworkPrivateSubnet) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// LateInitialize this ProjectNetworkPrivateSubnet using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ProjectNetworkPrivateSubnet) LateInitialize(attrs []byte) (bool, error) { + params := &ProjectNetworkPrivateSubnetParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ProjectNetworkPrivateSubnet) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/publiccloudnetwork/v1alpha1/zz_projectnetworkprivatesubnet_types.go b/apis/publiccloudnetwork/v1alpha1/zz_projectnetworkprivatesubnet_types.go new file mode 100755 index 0000000..a661df7 --- /dev/null +++ b/apis/publiccloudnetwork/v1alpha1/zz_projectnetworkprivatesubnet_types.go @@ -0,0 +1,176 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + + v1 "github.com/crossplane/crossplane-runtime/apis/common/v1" +) + +type IPPoolsInitParameters struct { +} + +type IPPoolsObservation struct { + DHCP *bool `json:"dhcp,omitempty" tf:"dhcp,omitempty"` + + End *string `json:"end,omitempty" tf:"end,omitempty"` + + Network *string `json:"network,omitempty" tf:"network,omitempty"` + + Region *string `json:"region,omitempty" tf:"region,omitempty"` + + Start *string `json:"start,omitempty" tf:"start,omitempty"` +} + +type IPPoolsParameters struct { +} + +type ProjectNetworkPrivateSubnetInitParameters struct { + DHCP *bool `json:"dhcp,omitempty" tf:"dhcp,omitempty"` + + End *string `json:"end,omitempty" tf:"end,omitempty"` + + Network *string `json:"network,omitempty" tf:"network,omitempty"` + + NetworkID *string `json:"networkId,omitempty" tf:"network_id,omitempty"` + + NoGateway *bool `json:"noGateway,omitempty" tf:"no_gateway,omitempty"` + + Region *string `json:"region,omitempty" tf:"region,omitempty"` + + // Service name of the resource representing the id of the cloud project. + ServiceName *string `json:"serviceName,omitempty" tf:"service_name,omitempty"` + + Start *string `json:"start,omitempty" tf:"start,omitempty"` +} + +type ProjectNetworkPrivateSubnetObservation struct { + Cidr *string `json:"cidr,omitempty" tf:"cidr,omitempty"` + + DHCP *bool `json:"dhcp,omitempty" tf:"dhcp,omitempty"` + + End *string `json:"end,omitempty" tf:"end,omitempty"` + + GatewayIP *string `json:"gatewayIp,omitempty" tf:"gateway_ip,omitempty"` + + ID *string `json:"id,omitempty" tf:"id,omitempty"` + + IPPools []IPPoolsObservation `json:"ipPools,omitempty" tf:"ip_pools,omitempty"` + + Network *string `json:"network,omitempty" tf:"network,omitempty"` + + NetworkID *string `json:"networkId,omitempty" tf:"network_id,omitempty"` + + NoGateway *bool `json:"noGateway,omitempty" tf:"no_gateway,omitempty"` + + Region *string `json:"region,omitempty" tf:"region,omitempty"` + + // Service name of the resource representing the id of the cloud project. + ServiceName *string `json:"serviceName,omitempty" tf:"service_name,omitempty"` + + Start *string `json:"start,omitempty" tf:"start,omitempty"` +} + +type ProjectNetworkPrivateSubnetParameters struct { + + // +kubebuilder:validation:Optional + DHCP *bool `json:"dhcp,omitempty" tf:"dhcp,omitempty"` + + // +kubebuilder:validation:Optional + End *string `json:"end,omitempty" tf:"end,omitempty"` + + // +kubebuilder:validation:Optional + Network *string `json:"network,omitempty" tf:"network,omitempty"` + + // +kubebuilder:validation:Optional + NetworkID *string `json:"networkId,omitempty" tf:"network_id,omitempty"` + + // +kubebuilder:validation:Optional + NoGateway *bool `json:"noGateway,omitempty" tf:"no_gateway,omitempty"` + + // +kubebuilder:validation:Optional + Region *string `json:"region,omitempty" tf:"region,omitempty"` + + // Service name of the resource representing the id of the cloud project. + // +kubebuilder:validation:Optional + ServiceName *string `json:"serviceName,omitempty" tf:"service_name,omitempty"` + + // +kubebuilder:validation:Optional + Start *string `json:"start,omitempty" tf:"start,omitempty"` +} + +// ProjectNetworkPrivateSubnetSpec defines the desired state of ProjectNetworkPrivateSubnet +type ProjectNetworkPrivateSubnetSpec struct { + v1.ResourceSpec `json:",inline"` + ForProvider ProjectNetworkPrivateSubnetParameters `json:"forProvider"` + // THIS IS A BETA FIELD. It will be honored + // unless the Management Policies feature flag is disabled. + // InitProvider holds the same fields as ForProvider, with the exception + // of Identifier and other resource reference fields. The fields that are + // in InitProvider are merged into ForProvider when the resource is created. + // The same fields are also added to the terraform ignore_changes hook, to + // avoid updating them after creation. This is useful for fields that are + // required on creation, but we do not desire to update them after creation, + // for example because of an external controller is managing them, like an + // autoscaler. + InitProvider ProjectNetworkPrivateSubnetInitParameters `json:"initProvider,omitempty"` +} + +// ProjectNetworkPrivateSubnetStatus defines the observed state of ProjectNetworkPrivateSubnet. +type ProjectNetworkPrivateSubnetStatus struct { + v1.ResourceStatus `json:",inline"` + AtProvider ProjectNetworkPrivateSubnetObservation `json:"atProvider,omitempty"` +} + +// +kubebuilder:object:root=true + +// ProjectNetworkPrivateSubnet is the Schema for the ProjectNetworkPrivateSubnets 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="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:subresource:status +// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,ovh} +type ProjectNetworkPrivateSubnet struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.end) || (has(self.initProvider) && has(self.initProvider.end))",message="spec.forProvider.end is a required parameter" + // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.network) || (has(self.initProvider) && has(self.initProvider.network))",message="spec.forProvider.network is a required parameter" + // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.networkId) || (has(self.initProvider) && has(self.initProvider.networkId))",message="spec.forProvider.networkId is a required parameter" + // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.region) || (has(self.initProvider) && has(self.initProvider.region))",message="spec.forProvider.region is a required parameter" + // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.serviceName) || (has(self.initProvider) && has(self.initProvider.serviceName))",message="spec.forProvider.serviceName is a required parameter" + // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.start) || (has(self.initProvider) && has(self.initProvider.start))",message="spec.forProvider.start is a required parameter" + Spec ProjectNetworkPrivateSubnetSpec `json:"spec"` + Status ProjectNetworkPrivateSubnetStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// ProjectNetworkPrivateSubnetList contains a list of ProjectNetworkPrivateSubnets +type ProjectNetworkPrivateSubnetList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ProjectNetworkPrivateSubnet `json:"items"` +} + +// Repository type metadata. +var ( + ProjectNetworkPrivateSubnet_Kind = "ProjectNetworkPrivateSubnet" + ProjectNetworkPrivateSubnet_GroupKind = schema.GroupKind{Group: CRDGroup, Kind: ProjectNetworkPrivateSubnet_Kind}.String() + ProjectNetworkPrivateSubnet_KindAPIVersion = ProjectNetworkPrivateSubnet_Kind + "." + CRDGroupVersion.String() + ProjectNetworkPrivateSubnet_GroupVersionKind = CRDGroupVersion.WithKind(ProjectNetworkPrivateSubnet_Kind) +) + +func init() { + SchemeBuilder.Register(&ProjectNetworkPrivateSubnet{}, &ProjectNetworkPrivateSubnetList{}) +} diff --git a/config/external_name.go b/config/external_name.go index e45fa6a..5bd0e33 100644 --- a/config/external_name.go +++ b/config/external_name.go @@ -10,7 +10,8 @@ import "github.com/crossplane/upjet/pkg/config" // provider. var ExternalNameConfigs = map[string]config.ExternalName{ // Import requires using a randomly generated ID from provider: nl-2e21sda - "ovh_cloud_project_network_private": config.NameAsIdentifier, + "ovh_cloud_project_network_private": config.NameAsIdentifier, + "ovh_cloud_project_network_private_subnet": config.NameAsIdentifier, } // ExternalNameConfigurations applies all external name configs listed in the diff --git a/config/provider.go b/config/provider.go index b199f08..0f615fa 100644 --- a/config/provider.go +++ b/config/provider.go @@ -7,6 +7,7 @@ package config import ( // Note(turkenh): we are importing this to embed provider schema document _ "embed" + "github.com/edixos/provider-ovh/config/public_cloud_network" ujconfig "github.com/crossplane/upjet/pkg/config" diff --git a/config/public_cloud_network/config.go b/config/public_cloud_network/config.go index 18ea16d..3374e5d 100644 --- a/config/public_cloud_network/config.go +++ b/config/public_cloud_network/config.go @@ -5,8 +5,9 @@ import "github.com/crossplane/upjet/pkg/config" // Configure configures individual resources by adding custom ResourceConfigurators. func Configure(p *config.Provider) { p.AddResourceConfigurator("ovh_cloud_project_network_private", func(r *config.Resource) { - // We need to override the default group that upjet generated for - // this resource, which would be "github" + r.ShortGroup = "publiccloudnetwork" + }) + p.AddResourceConfigurator("ovh_cloud_project_network_private_subnet", func(r *config.Resource) { r.ShortGroup = "publiccloudnetwork" }) } diff --git a/internal/controller/publiccloudnetwork/projectnetworkprivatesubnet/zz_controller.go b/internal/controller/publiccloudnetwork/projectnetworkprivatesubnet/zz_controller.go new file mode 100755 index 0000000..6e8ceb7 --- /dev/null +++ b/internal/controller/publiccloudnetwork/projectnetworkprivatesubnet/zz_controller.go @@ -0,0 +1,67 @@ +// SPDX-FileCopyrightText: 2023 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package projectnetworkprivatesubnet + +import ( + "time" + + "github.com/crossplane/crossplane-runtime/pkg/connection" + "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + tjcontroller "github.com/crossplane/upjet/pkg/controller" + "github.com/crossplane/upjet/pkg/controller/handler" + "github.com/crossplane/upjet/pkg/terraform" + ctrl "sigs.k8s.io/controller-runtime" + + v1alpha1 "github.com/edixos/provider-ovh/apis/publiccloudnetwork/v1alpha1" + features "github.com/edixos/provider-ovh/internal/features" +) + +// Setup adds a controller that reconciles ProjectNetworkPrivateSubnet managed resources. +func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { + name := managed.ControllerName(v1alpha1.ProjectNetworkPrivateSubnet_GroupVersionKind.String()) + var initializers managed.InitializerChain + initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) + cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} + if o.SecretStoreConfigGVK != nil { + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) + } + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1alpha1.ProjectNetworkPrivateSubnet_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1alpha1.ProjectNetworkPrivateSubnet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + opts := []managed.ReconcilerOption{ + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["ovh_cloud_project_network_private_subnet"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), + tjcontroller.WithCallbackProvider(ac), + )), + managed.WithLogger(o.Logger.WithValues("controller", name)), + managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), + managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithTimeout(3 * time.Minute), + managed.WithInitializers(initializers), + managed.WithConnectionPublishers(cps...), + managed.WithPollInterval(o.PollInterval), + } + if o.PollJitter != 0 { + opts = append(opts, managed.WithPollJitterHook(o.PollJitter)) + } + if o.Features.Enabled(features.EnableBetaManagementPolicies) { + opts = append(opts, managed.WithManagementPolicies()) + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1alpha1.ProjectNetworkPrivateSubnet_GroupVersionKind), opts...) + + return ctrl.NewControllerManagedBy(mgr). + Named(name). + WithOptions(o.ForControllerRuntime()). + WithEventFilter(xpresource.DesiredStateChanged()). + Watches(&v1alpha1.ProjectNetworkPrivateSubnet{}, eventHandler). + Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) +} diff --git a/internal/controller/zz_setup.go b/internal/controller/zz_setup.go index 1dacc12..4e06202 100755 --- a/internal/controller/zz_setup.go +++ b/internal/controller/zz_setup.go @@ -11,6 +11,7 @@ import ( providerconfig "github.com/edixos/provider-ovh/internal/controller/providerconfig" projectnetworkprivate "github.com/edixos/provider-ovh/internal/controller/publiccloudnetwork/projectnetworkprivate" + projectnetworkprivatesubnet "github.com/edixos/provider-ovh/internal/controller/publiccloudnetwork/projectnetworkprivatesubnet" ) // Setup creates all controllers with the supplied logger and adds them to @@ -19,6 +20,7 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { for _, setup := range []func(ctrl.Manager, controller.Options) error{ providerconfig.Setup, projectnetworkprivate.Setup, + projectnetworkprivatesubnet.Setup, } { if err := setup(mgr, o); err != nil { return err diff --git a/package/crds/publiccloudnetwork.edixos.io_projectnetworkprivatesubnets.yaml b/package/crds/publiccloudnetwork.edixos.io_projectnetworkprivatesubnets.yaml new file mode 100644 index 0000000..9eb1fcc --- /dev/null +++ b/package/crds/publiccloudnetwork.edixos.io_projectnetworkprivatesubnets.yaml @@ -0,0 +1,395 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + name: projectnetworkprivatesubnets.publiccloudnetwork.edixos.io +spec: + group: publiccloudnetwork.edixos.io + names: + categories: + - crossplane + - managed + - ovh + kind: ProjectNetworkPrivateSubnet + listKind: ProjectNetworkPrivateSubnetList + plural: projectnetworkprivatesubnets + singular: projectnetworkprivatesubnet + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: READY + type: string + - jsonPath: .status.conditions[?(@.type=='Synced')].status + name: SYNCED + type: string + - jsonPath: .metadata.annotations.crossplane\.io/external-name + name: EXTERNAL-NAME + type: string + - jsonPath: .metadata.creationTimestamp + name: AGE + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + description: ProjectNetworkPrivateSubnet is the Schema for the ProjectNetworkPrivateSubnets + API. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: ProjectNetworkPrivateSubnetSpec defines the desired state + of ProjectNetworkPrivateSubnet + properties: + deletionPolicy: + default: Delete + description: 'DeletionPolicy specifies what will happen to the underlying + external when this managed resource is deleted - either "Delete" + or "Orphan" the external resource. This field is planned to be deprecated + in favor of the ManagementPolicies field in a future release. Currently, + both could be set independently and non-default values would be + honored if the feature flag is enabled. See the design doc for more + information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223' + enum: + - Orphan + - Delete + type: string + forProvider: + properties: + dhcp: + type: boolean + end: + type: string + network: + type: string + networkId: + type: string + noGateway: + type: boolean + region: + type: string + serviceName: + description: Service name of the resource representing the id + of the cloud project. + type: string + start: + type: string + type: object + initProvider: + description: THIS IS A BETA FIELD. It will be honored unless the Management + Policies feature flag is disabled. InitProvider holds the same fields + as ForProvider, with the exception of Identifier and other resource + reference fields. The fields that are in InitProvider are merged + into ForProvider when the resource is created. The same fields are + also added to the terraform ignore_changes hook, to avoid updating + them after creation. This is useful for fields that are required + on creation, but we do not desire to update them after creation, + for example because of an external controller is managing them, + like an autoscaler. + properties: + dhcp: + type: boolean + end: + type: string + network: + type: string + networkId: + type: string + noGateway: + type: boolean + region: + type: string + serviceName: + description: Service name of the resource representing the id + of the cloud project. + type: string + start: + type: string + type: object + managementPolicies: + default: + - '*' + description: 'THIS IS A BETA FIELD. It is on by default but can be + opted out through a Crossplane feature flag. ManagementPolicies + specify the array of actions Crossplane is allowed to take on the + managed and external resources. This field is planned to replace + the DeletionPolicy field in a future release. Currently, both could + be set independently and non-default values would be honored if + the feature flag is enabled. If both are custom, the DeletionPolicy + field will be ignored. See the design doc for more information: + https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 + and this one: https://github.com/crossplane/crossplane/blob/444267e84783136daa93568b364a5f01228cacbe/design/one-pager-ignore-changes.md' + items: + description: A ManagementAction represents an action that the Crossplane + controllers can take on an external resource. + enum: + - Observe + - Create + - Update + - Delete + - LateInitialize + - '*' + type: string + type: array + providerConfigRef: + default: + name: default + description: ProviderConfigReference specifies how the provider that + will be used to create, observe, update, and delete this managed + resource should be configured. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of this + reference is required. The default is 'Required', which + means the reconcile will fail if the reference cannot be + resolved. 'Optional' means this reference will be a no-op + if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will attempt + to resolve the reference only when the corresponding field + is not present. Use 'Always' to resolve the reference on + every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + publishConnectionDetailsTo: + description: PublishConnectionDetailsTo specifies the connection secret + config which contains a name, metadata and a reference to secret + store config to which any connection details for this managed resource + should be written. Connection details frequently include the endpoint, + username, and password required to connect to the managed resource. + properties: + configRef: + default: + name: default + description: SecretStoreConfigRef specifies which secret store + config should be used for this ConnectionSecret. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of + this reference is required. The default is 'Required', + which means the reconcile will fail if the reference + cannot be resolved. 'Optional' means this reference + will be a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will + attempt to resolve the reference only when the corresponding + field is not present. Use 'Always' to resolve the reference + on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + metadata: + description: Metadata is the metadata for connection secret. + properties: + annotations: + additionalProperties: + type: string + description: Annotations are the annotations to be added to + connection secret. - For Kubernetes secrets, this will be + used as "metadata.annotations". - It is up to Secret Store + implementation for others store types. + type: object + labels: + additionalProperties: + type: string + description: Labels are the labels/tags to be added to connection + secret. - For Kubernetes secrets, this will be used as "metadata.labels". + - It is up to Secret Store implementation for others store + types. + type: object + type: + description: Type is the SecretType for the connection secret. + - Only valid for Kubernetes Secret Stores. + type: string + type: object + name: + description: Name is the name of the connection secret. + type: string + required: + - name + type: object + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the namespace + and name of a Secret to which any connection details for this managed + resource should be written. Connection details frequently include + the endpoint, username, and password required to connect to the + managed resource. This field is planned to be replaced in a future + release in favor of PublishConnectionDetailsTo. Currently, both + could be set independently and connection details would be published + to both without affecting each other. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + - namespace + type: object + required: + - forProvider + type: object + x-kubernetes-validations: + - message: spec.forProvider.end is a required parameter + rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies + || ''Update'' in self.managementPolicies) || has(self.forProvider.end) + || (has(self.initProvider) && has(self.initProvider.end))' + - message: spec.forProvider.network is a required parameter + rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies + || ''Update'' in self.managementPolicies) || has(self.forProvider.network) + || (has(self.initProvider) && has(self.initProvider.network))' + - message: spec.forProvider.networkId is a required parameter + rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies + || ''Update'' in self.managementPolicies) || has(self.forProvider.networkId) + || (has(self.initProvider) && has(self.initProvider.networkId))' + - message: spec.forProvider.region is a required parameter + rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies + || ''Update'' in self.managementPolicies) || has(self.forProvider.region) + || (has(self.initProvider) && has(self.initProvider.region))' + - message: spec.forProvider.serviceName is a required parameter + rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies + || ''Update'' in self.managementPolicies) || has(self.forProvider.serviceName) + || (has(self.initProvider) && has(self.initProvider.serviceName))' + - message: spec.forProvider.start is a required parameter + rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies + || ''Update'' in self.managementPolicies) || has(self.forProvider.start) + || (has(self.initProvider) && has(self.initProvider.start))' + status: + description: ProjectNetworkPrivateSubnetStatus defines the observed state + of ProjectNetworkPrivateSubnet. + properties: + atProvider: + properties: + cidr: + type: string + dhcp: + type: boolean + end: + type: string + gatewayIp: + type: string + id: + type: string + ipPools: + items: + properties: + dhcp: + type: boolean + end: + type: string + network: + type: string + region: + type: string + start: + type: string + type: object + type: array + network: + type: string + networkId: + type: string + noGateway: + type: boolean + region: + type: string + serviceName: + description: Service name of the resource representing the id + of the cloud project. + type: string + start: + type: string + type: object + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: LastTransitionTime is the last time this condition + transitioned from one status to another. + format: date-time + type: string + message: + description: A Message containing details about this condition's + last transition from one status to another, if any. + type: string + reason: + description: A Reason for this condition's last transition from + one status to another. + type: string + status: + description: Status of this condition; is it currently True, + False, or Unknown? + type: string + type: + description: Type of this condition. At most one of each condition + type may apply to a resource at any point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {}