From e6f413063023c8531a4ddcfa2dcb4a287288ea73 Mon Sep 17 00:00:00 2001 From: Fumigatus Date: Tue, 29 Aug 2023 12:51:26 +0300 Subject: [PATCH] added deployment --- .../v1alpha1/zz_deployment_types.go | 328 +++++++ .../v1alpha1/zz_generated.deepcopy.go | 824 ++++++++++++++++++ .../v1alpha1/zz_generated.managed.go | 84 ++ .../v1alpha1/zz_generated.managedlist.go | 17 + .../v1alpha1/zz_generated_terraformed.go | 88 ++ .../v1alpha1/zz_groupversion_info.go | 32 + apis/zz_register.go | 2 + config/deployment/config.go | 11 + config/external_name.go | 1 + config/provider.go | 4 +- .../deployment/deployment/zz_controller.go | 55 ++ internal/controller/zz_setup.go | 2 + .../deployment.crossplane.io_deployments.yaml | 573 ++++++++++++ 13 files changed, 2020 insertions(+), 1 deletion(-) create mode 100755 apis/deployment/v1alpha1/zz_deployment_types.go create mode 100644 apis/deployment/v1alpha1/zz_generated.deepcopy.go create mode 100644 apis/deployment/v1alpha1/zz_generated.managed.go create mode 100644 apis/deployment/v1alpha1/zz_generated.managedlist.go create mode 100755 apis/deployment/v1alpha1/zz_generated_terraformed.go create mode 100755 apis/deployment/v1alpha1/zz_groupversion_info.go create mode 100644 config/deployment/config.go create mode 100755 internal/controller/deployment/deployment/zz_controller.go create mode 100644 package/crds/deployment.crossplane.io_deployments.yaml diff --git a/apis/deployment/v1alpha1/zz_deployment_types.go b/apis/deployment/v1alpha1/zz_deployment_types.go new file mode 100755 index 0000000..9cfcf21 --- /dev/null +++ b/apis/deployment/v1alpha1/zz_deployment_types.go @@ -0,0 +1,328 @@ +/* +Copyright 2023 Upbound Inc. - ANKASOFT +*/ + +// 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 DeploymentObservation struct { + + // The content of the the cloud template to be used to request the deployment. + BlueprintContent *string `json:"blueprintContent,omitempty" tf:"blueprint_content,omitempty"` + + // The id of the cloud template to be used to request the deployment. + BlueprintID *string `json:"blueprintId,omitempty" tf:"blueprint_id,omitempty"` + + // The version of the cloud template to be used to request the deployment. + BlueprintVersion *string `json:"blueprintVersion,omitempty" tf:"blueprint_version,omitempty"` + + // The id of the catalog item to be used to request the deployment. + CatalogItemID *string `json:"catalogItemId,omitempty" tf:"catalog_item_id,omitempty"` + + // The version of the catalog item to be used to request the deployment. + CatalogItemVersion *string `json:"catalogItemVersion,omitempty" tf:"catalog_item_version,omitempty"` + + // Date when the entity was created. The date is in ISO 6801 and UTC. + CreatedAt *string `json:"createdAt,omitempty" tf:"created_at,omitempty"` + + // The user the entity was created by. + CreatedBy *string `json:"createdBy,omitempty" tf:"created_by,omitempty"` + + // A human-friendly description. + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + ExpandLastRequest *bool `json:"expandLastRequest,omitempty" tf:"expand_last_request,omitempty"` + + // Flag to indicate whether to expand project information. + ExpandProject *bool `json:"expandProject,omitempty" tf:"expand_project,omitempty"` + + ExpandResources *bool `json:"expandResources,omitempty" tf:"expand_resources,omitempty"` + + Expense []ExpenseObservation `json:"expense,omitempty" tf:"expense,omitempty"` + + ID *string `json:"id,omitempty" tf:"id,omitempty"` + + // Inputs provided by the user. For inputs including those with default values, refer to inputs_including_defaults. + Inputs map[string]*string `json:"inputs,omitempty" tf:"inputs,omitempty"` + + // All the inputs applied during last create/update operation, including those with default values. + InputsIncludingDefaults map[string]*string `json:"inputsIncludingDefaults,omitempty" tf:"inputs_including_defaults,omitempty"` + + LastRequest []LastRequestObservation `json:"lastRequest,omitempty" tf:"last_request,omitempty"` + + // Date when the entity was last updated. The date is in ISO 6801 and UTC. + LastUpdatedAt *string `json:"lastUpdatedAt,omitempty" tf:"last_updated_at,omitempty"` + + // The user that last updated the deployment. + LastUpdatedBy *string `json:"lastUpdatedBy,omitempty" tf:"last_updated_by,omitempty"` + + // Date when the deployment lease expire. The date is in ISO 6801 and UTC. + LeaseExpireAt *string `json:"leaseExpireAt,omitempty" tf:"lease_expire_at,omitempty"` + + // The name of the deployment. + Name *string `json:"name,omitempty" tf:"name,omitempty"` + + // The Id of the organization this deployment belongs to. + OrgID *string `json:"orgId,omitempty" tf:"org_id,omitempty"` + + // The user this deployment belongs to. + Owner *string `json:"owner,omitempty" tf:"owner,omitempty"` + + Project []ProjectObservation `json:"project,omitempty" tf:"project,omitempty"` + + // The id of the project this deployment belongs to. + ProjectID *string `json:"projectId,omitempty" tf:"project_id,omitempty"` + + // Reason for requesting/updating a blueprint. + Reason *string `json:"reason,omitempty" tf:"reason,omitempty"` + + Resources []ResourcesObservation `json:"resources,omitempty" tf:"resources,omitempty"` + + // The status of the deployment with respect to its life cycle operations. + Status *string `json:"status,omitempty" tf:"status,omitempty"` +} + +type DeploymentParameters struct { + + // The content of the the cloud template to be used to request the deployment. + // +kubebuilder:validation:Optional + BlueprintContent *string `json:"blueprintContent,omitempty" tf:"blueprint_content,omitempty"` + + // The id of the cloud template to be used to request the deployment. + // +kubebuilder:validation:Optional + BlueprintID *string `json:"blueprintId,omitempty" tf:"blueprint_id,omitempty"` + + // The version of the cloud template to be used to request the deployment. + // +kubebuilder:validation:Optional + BlueprintVersion *string `json:"blueprintVersion,omitempty" tf:"blueprint_version,omitempty"` + + // The id of the catalog item to be used to request the deployment. + // +kubebuilder:validation:Optional + CatalogItemID *string `json:"catalogItemId,omitempty" tf:"catalog_item_id,omitempty"` + + // The version of the catalog item to be used to request the deployment. + // +kubebuilder:validation:Optional + CatalogItemVersion *string `json:"catalogItemVersion,omitempty" tf:"catalog_item_version,omitempty"` + + // A human-friendly description. + // +kubebuilder:validation:Optional + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + // +kubebuilder:validation:Optional + ExpandLastRequest *bool `json:"expandLastRequest,omitempty" tf:"expand_last_request,omitempty"` + + // Flag to indicate whether to expand project information. + // +kubebuilder:validation:Optional + ExpandProject *bool `json:"expandProject,omitempty" tf:"expand_project,omitempty"` + + // +kubebuilder:validation:Optional + ExpandResources *bool `json:"expandResources,omitempty" tf:"expand_resources,omitempty"` + + // Inputs provided by the user. For inputs including those with default values, refer to inputs_including_defaults. + // +kubebuilder:validation:Optional + Inputs map[string]*string `json:"inputs,omitempty" tf:"inputs,omitempty"` + + // The name of the deployment. + // +kubebuilder:validation:Optional + Name *string `json:"name,omitempty" tf:"name,omitempty"` + + // The user this deployment belongs to. + // +kubebuilder:validation:Optional + Owner *string `json:"owner,omitempty" tf:"owner,omitempty"` + + // The id of the project this deployment belongs to. + // +kubebuilder:validation:Optional + ProjectID *string `json:"projectId,omitempty" tf:"project_id,omitempty"` + + // Reason for requesting/updating a blueprint. + // +kubebuilder:validation:Optional + Reason *string `json:"reason,omitempty" tf:"reason,omitempty"` +} + +type ExpenseObservation struct { + AdditionalExpense *float64 `json:"additionalExpense,omitempty" tf:"additional_expense,omitempty"` + + Code *string `json:"code,omitempty" tf:"code,omitempty"` + + ComputeExpense *float64 `json:"computeExpense,omitempty" tf:"compute_expense,omitempty"` + + LastUpdateTime *string `json:"lastUpdateTime,omitempty" tf:"last_update_time,omitempty"` + + Message *string `json:"message,omitempty" tf:"message,omitempty"` + + NetworkExpense *float64 `json:"networkExpense,omitempty" tf:"network_expense,omitempty"` + + StorageExpense *float64 `json:"storageExpense,omitempty" tf:"storage_expense,omitempty"` + + TotalExpense *float64 `json:"totalExpense,omitempty" tf:"total_expense,omitempty"` + + Unit *string `json:"unit,omitempty" tf:"unit,omitempty"` +} + +type ExpenseParameters struct { +} + +type LastRequestObservation struct { + ActionID *string `json:"actionId,omitempty" tf:"action_id,omitempty"` + + ApprovedAt *string `json:"approvedAt,omitempty" tf:"approved_at,omitempty"` + + BlueprintID *string `json:"blueprintId,omitempty" tf:"blueprint_id,omitempty"` + + Cancelable *bool `json:"cancelable,omitempty" tf:"cancelable,omitempty"` + + CatalogItemID *string `json:"catalogItemId,omitempty" tf:"catalog_item_id,omitempty"` + + CompletedAt *string `json:"completedAt,omitempty" tf:"completed_at,omitempty"` + + CompletedTasks *float64 `json:"completedTasks,omitempty" tf:"completed_tasks,omitempty"` + + CreatedAt *string `json:"createdAt,omitempty" tf:"created_at,omitempty"` + + Details *string `json:"details,omitempty" tf:"details,omitempty"` + + Dismissed *bool `json:"dismissed,omitempty" tf:"dismissed,omitempty"` + + ID *string `json:"id,omitempty" tf:"id,omitempty"` + + InitializedAt *string `json:"initializedAt,omitempty" tf:"initialized_at,omitempty"` + + Inputs map[string]*string `json:"inputs,omitempty" tf:"inputs,omitempty"` + + Name *string `json:"name,omitempty" tf:"name,omitempty"` + + Outputs map[string]*string `json:"outputs,omitempty" tf:"outputs,omitempty"` + + RequestedBy *string `json:"requestedBy,omitempty" tf:"requested_by,omitempty"` + + ResourceIds []*string `json:"resourceIds,omitempty" tf:"resource_ids,omitempty"` + + Status *string `json:"status,omitempty" tf:"status,omitempty"` + + TotalTasks *float64 `json:"totalTasks,omitempty" tf:"total_tasks,omitempty"` + + UpdatedAt *string `json:"updatedAt,omitempty" tf:"updated_at,omitempty"` +} + +type LastRequestParameters struct { +} + +type ProjectObservation struct { + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + ID *string `json:"id,omitempty" tf:"id,omitempty"` + + Name *string `json:"name,omitempty" tf:"name,omitempty"` + + Version *string `json:"version,omitempty" tf:"version,omitempty"` +} + +type ProjectParameters struct { +} + +type ResourcesExpenseObservation struct { + AdditionalExpense *float64 `json:"additionalExpense,omitempty" tf:"additional_expense,omitempty"` + + Code *string `json:"code,omitempty" tf:"code,omitempty"` + + ComputeExpense *float64 `json:"computeExpense,omitempty" tf:"compute_expense,omitempty"` + + LastUpdateTime *string `json:"lastUpdateTime,omitempty" tf:"last_update_time,omitempty"` + + Message *string `json:"message,omitempty" tf:"message,omitempty"` + + NetworkExpense *float64 `json:"networkExpense,omitempty" tf:"network_expense,omitempty"` + + StorageExpense *float64 `json:"storageExpense,omitempty" tf:"storage_expense,omitempty"` + + TotalExpense *float64 `json:"totalExpense,omitempty" tf:"total_expense,omitempty"` + + Unit *string `json:"unit,omitempty" tf:"unit,omitempty"` +} + +type ResourcesExpenseParameters struct { +} + +type ResourcesObservation struct { + CreatedAt *string `json:"createdAt,omitempty" tf:"created_at,omitempty"` + + DependsOn []*string `json:"dependsOn,omitempty" tf:"depends_on,omitempty"` + + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + Expense []ResourcesExpenseObservation `json:"expense,omitempty" tf:"expense,omitempty"` + + ID *string `json:"id,omitempty" tf:"id,omitempty"` + + Name *string `json:"name,omitempty" tf:"name,omitempty"` + + PropertiesJSON *string `json:"propertiesJson,omitempty" tf:"properties_json,omitempty"` + + State *string `json:"state,omitempty" tf:"state,omitempty"` + + SyncStatus *string `json:"syncStatus,omitempty" tf:"sync_status,omitempty"` + + Type *string `json:"type,omitempty" tf:"type,omitempty"` +} + +type ResourcesParameters struct { +} + +// DeploymentSpec defines the desired state of Deployment +type DeploymentSpec struct { + v1.ResourceSpec `json:",inline"` + ForProvider DeploymentParameters `json:"forProvider"` +} + +// DeploymentStatus defines the observed state of Deployment. +type DeploymentStatus struct { + v1.ResourceStatus `json:",inline"` + AtProvider DeploymentObservation `json:"atProvider,omitempty"` +} + +// +kubebuilder:object:root=true + +// Deployment is the Schema for the Deployments 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,vra} +type Deployment struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // +kubebuilder:validation:XValidation:rule="self.managementPolicy == 'ObserveOnly' || has(self.forProvider.name)",message="name is a required parameter" + // +kubebuilder:validation:XValidation:rule="self.managementPolicy == 'ObserveOnly' || has(self.forProvider.projectId)",message="projectId is a required parameter" + Spec DeploymentSpec `json:"spec"` + Status DeploymentStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// DeploymentList contains a list of Deployments +type DeploymentList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Deployment `json:"items"` +} + +// Repository type metadata. +var ( + Deployment_Kind = "Deployment" + Deployment_GroupKind = schema.GroupKind{Group: CRDGroup, Kind: Deployment_Kind}.String() + Deployment_KindAPIVersion = Deployment_Kind + "." + CRDGroupVersion.String() + Deployment_GroupVersionKind = CRDGroupVersion.WithKind(Deployment_Kind) +) + +func init() { + SchemeBuilder.Register(&Deployment{}, &DeploymentList{}) +} diff --git a/apis/deployment/v1alpha1/zz_generated.deepcopy.go b/apis/deployment/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000..849af5b --- /dev/null +++ b/apis/deployment/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,824 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2023 Upbound Inc. - ANKASOFT +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha1 + +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 *Deployment) DeepCopyInto(out *Deployment) { + *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 Deployment. +func (in *Deployment) DeepCopy() *Deployment { + if in == nil { + return nil + } + out := new(Deployment) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Deployment) 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 *DeploymentList) DeepCopyInto(out *DeploymentList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Deployment, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentList. +func (in *DeploymentList) DeepCopy() *DeploymentList { + if in == nil { + return nil + } + out := new(DeploymentList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DeploymentList) 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 *DeploymentObservation) DeepCopyInto(out *DeploymentObservation) { + *out = *in + if in.BlueprintContent != nil { + in, out := &in.BlueprintContent, &out.BlueprintContent + *out = new(string) + **out = **in + } + if in.BlueprintID != nil { + in, out := &in.BlueprintID, &out.BlueprintID + *out = new(string) + **out = **in + } + if in.BlueprintVersion != nil { + in, out := &in.BlueprintVersion, &out.BlueprintVersion + *out = new(string) + **out = **in + } + if in.CatalogItemID != nil { + in, out := &in.CatalogItemID, &out.CatalogItemID + *out = new(string) + **out = **in + } + if in.CatalogItemVersion != nil { + in, out := &in.CatalogItemVersion, &out.CatalogItemVersion + *out = new(string) + **out = **in + } + if in.CreatedAt != nil { + in, out := &in.CreatedAt, &out.CreatedAt + *out = new(string) + **out = **in + } + if in.CreatedBy != nil { + in, out := &in.CreatedBy, &out.CreatedBy + *out = new(string) + **out = **in + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.ExpandLastRequest != nil { + in, out := &in.ExpandLastRequest, &out.ExpandLastRequest + *out = new(bool) + **out = **in + } + if in.ExpandProject != nil { + in, out := &in.ExpandProject, &out.ExpandProject + *out = new(bool) + **out = **in + } + if in.ExpandResources != nil { + in, out := &in.ExpandResources, &out.ExpandResources + *out = new(bool) + **out = **in + } + if in.Expense != nil { + in, out := &in.Expense, &out.Expense + *out = make([]ExpenseObservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.Inputs != nil { + in, out := &in.Inputs, &out.Inputs + *out = make(map[string]*string, len(*in)) + for key, val := range *in { + var outVal *string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.InputsIncludingDefaults != nil { + in, out := &in.InputsIncludingDefaults, &out.InputsIncludingDefaults + *out = make(map[string]*string, len(*in)) + for key, val := range *in { + var outVal *string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.LastRequest != nil { + in, out := &in.LastRequest, &out.LastRequest + *out = make([]LastRequestObservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.LastUpdatedAt != nil { + in, out := &in.LastUpdatedAt, &out.LastUpdatedAt + *out = new(string) + **out = **in + } + if in.LastUpdatedBy != nil { + in, out := &in.LastUpdatedBy, &out.LastUpdatedBy + *out = new(string) + **out = **in + } + if in.LeaseExpireAt != nil { + in, out := &in.LeaseExpireAt, &out.LeaseExpireAt + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.OrgID != nil { + in, out := &in.OrgID, &out.OrgID + *out = new(string) + **out = **in + } + if in.Owner != nil { + in, out := &in.Owner, &out.Owner + *out = new(string) + **out = **in + } + if in.Project != nil { + in, out := &in.Project, &out.Project + *out = make([]ProjectObservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ProjectID != nil { + in, out := &in.ProjectID, &out.ProjectID + *out = new(string) + **out = **in + } + if in.Reason != nil { + in, out := &in.Reason, &out.Reason + *out = new(string) + **out = **in + } + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]ResourcesObservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentObservation. +func (in *DeploymentObservation) DeepCopy() *DeploymentObservation { + if in == nil { + return nil + } + out := new(DeploymentObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeploymentParameters) DeepCopyInto(out *DeploymentParameters) { + *out = *in + if in.BlueprintContent != nil { + in, out := &in.BlueprintContent, &out.BlueprintContent + *out = new(string) + **out = **in + } + if in.BlueprintID != nil { + in, out := &in.BlueprintID, &out.BlueprintID + *out = new(string) + **out = **in + } + if in.BlueprintVersion != nil { + in, out := &in.BlueprintVersion, &out.BlueprintVersion + *out = new(string) + **out = **in + } + if in.CatalogItemID != nil { + in, out := &in.CatalogItemID, &out.CatalogItemID + *out = new(string) + **out = **in + } + if in.CatalogItemVersion != nil { + in, out := &in.CatalogItemVersion, &out.CatalogItemVersion + *out = new(string) + **out = **in + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.ExpandLastRequest != nil { + in, out := &in.ExpandLastRequest, &out.ExpandLastRequest + *out = new(bool) + **out = **in + } + if in.ExpandProject != nil { + in, out := &in.ExpandProject, &out.ExpandProject + *out = new(bool) + **out = **in + } + if in.ExpandResources != nil { + in, out := &in.ExpandResources, &out.ExpandResources + *out = new(bool) + **out = **in + } + if in.Inputs != nil { + in, out := &in.Inputs, &out.Inputs + *out = make(map[string]*string, len(*in)) + for key, val := range *in { + var outVal *string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Owner != nil { + in, out := &in.Owner, &out.Owner + *out = new(string) + **out = **in + } + if in.ProjectID != nil { + in, out := &in.ProjectID, &out.ProjectID + *out = new(string) + **out = **in + } + if in.Reason != nil { + in, out := &in.Reason, &out.Reason + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentParameters. +func (in *DeploymentParameters) DeepCopy() *DeploymentParameters { + if in == nil { + return nil + } + out := new(DeploymentParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeploymentSpec) DeepCopyInto(out *DeploymentSpec) { + *out = *in + in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ForProvider.DeepCopyInto(&out.ForProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentSpec. +func (in *DeploymentSpec) DeepCopy() *DeploymentSpec { + if in == nil { + return nil + } + out := new(DeploymentSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeploymentStatus) DeepCopyInto(out *DeploymentStatus) { + *out = *in + in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) + in.AtProvider.DeepCopyInto(&out.AtProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentStatus. +func (in *DeploymentStatus) DeepCopy() *DeploymentStatus { + if in == nil { + return nil + } + out := new(DeploymentStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExpenseObservation) DeepCopyInto(out *ExpenseObservation) { + *out = *in + if in.AdditionalExpense != nil { + in, out := &in.AdditionalExpense, &out.AdditionalExpense + *out = new(float64) + **out = **in + } + if in.Code != nil { + in, out := &in.Code, &out.Code + *out = new(string) + **out = **in + } + if in.ComputeExpense != nil { + in, out := &in.ComputeExpense, &out.ComputeExpense + *out = new(float64) + **out = **in + } + if in.LastUpdateTime != nil { + in, out := &in.LastUpdateTime, &out.LastUpdateTime + *out = new(string) + **out = **in + } + if in.Message != nil { + in, out := &in.Message, &out.Message + *out = new(string) + **out = **in + } + if in.NetworkExpense != nil { + in, out := &in.NetworkExpense, &out.NetworkExpense + *out = new(float64) + **out = **in + } + if in.StorageExpense != nil { + in, out := &in.StorageExpense, &out.StorageExpense + *out = new(float64) + **out = **in + } + if in.TotalExpense != nil { + in, out := &in.TotalExpense, &out.TotalExpense + *out = new(float64) + **out = **in + } + if in.Unit != nil { + in, out := &in.Unit, &out.Unit + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExpenseObservation. +func (in *ExpenseObservation) DeepCopy() *ExpenseObservation { + if in == nil { + return nil + } + out := new(ExpenseObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExpenseParameters) DeepCopyInto(out *ExpenseParameters) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExpenseParameters. +func (in *ExpenseParameters) DeepCopy() *ExpenseParameters { + if in == nil { + return nil + } + out := new(ExpenseParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LastRequestObservation) DeepCopyInto(out *LastRequestObservation) { + *out = *in + if in.ActionID != nil { + in, out := &in.ActionID, &out.ActionID + *out = new(string) + **out = **in + } + if in.ApprovedAt != nil { + in, out := &in.ApprovedAt, &out.ApprovedAt + *out = new(string) + **out = **in + } + if in.BlueprintID != nil { + in, out := &in.BlueprintID, &out.BlueprintID + *out = new(string) + **out = **in + } + if in.Cancelable != nil { + in, out := &in.Cancelable, &out.Cancelable + *out = new(bool) + **out = **in + } + if in.CatalogItemID != nil { + in, out := &in.CatalogItemID, &out.CatalogItemID + *out = new(string) + **out = **in + } + if in.CompletedAt != nil { + in, out := &in.CompletedAt, &out.CompletedAt + *out = new(string) + **out = **in + } + if in.CompletedTasks != nil { + in, out := &in.CompletedTasks, &out.CompletedTasks + *out = new(float64) + **out = **in + } + if in.CreatedAt != nil { + in, out := &in.CreatedAt, &out.CreatedAt + *out = new(string) + **out = **in + } + if in.Details != nil { + in, out := &in.Details, &out.Details + *out = new(string) + **out = **in + } + if in.Dismissed != nil { + in, out := &in.Dismissed, &out.Dismissed + *out = new(bool) + **out = **in + } + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.InitializedAt != nil { + in, out := &in.InitializedAt, &out.InitializedAt + *out = new(string) + **out = **in + } + if in.Inputs != nil { + in, out := &in.Inputs, &out.Inputs + *out = make(map[string]*string, len(*in)) + for key, val := range *in { + var outVal *string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Outputs != nil { + in, out := &in.Outputs, &out.Outputs + *out = make(map[string]*string, len(*in)) + for key, val := range *in { + var outVal *string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.RequestedBy != nil { + in, out := &in.RequestedBy, &out.RequestedBy + *out = new(string) + **out = **in + } + if in.ResourceIds != nil { + in, out := &in.ResourceIds, &out.ResourceIds + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(string) + **out = **in + } + if in.TotalTasks != nil { + in, out := &in.TotalTasks, &out.TotalTasks + *out = new(float64) + **out = **in + } + if in.UpdatedAt != nil { + in, out := &in.UpdatedAt, &out.UpdatedAt + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LastRequestObservation. +func (in *LastRequestObservation) DeepCopy() *LastRequestObservation { + if in == nil { + return nil + } + out := new(LastRequestObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LastRequestParameters) DeepCopyInto(out *LastRequestParameters) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LastRequestParameters. +func (in *LastRequestParameters) DeepCopy() *LastRequestParameters { + if in == nil { + return nil + } + out := new(LastRequestParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectObservation) DeepCopyInto(out *ProjectObservation) { + *out = *in + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Version != nil { + in, out := &in.Version, &out.Version + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectObservation. +func (in *ProjectObservation) DeepCopy() *ProjectObservation { + if in == nil { + return nil + } + out := new(ProjectObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectParameters) DeepCopyInto(out *ProjectParameters) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectParameters. +func (in *ProjectParameters) DeepCopy() *ProjectParameters { + if in == nil { + return nil + } + out := new(ProjectParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourcesExpenseObservation) DeepCopyInto(out *ResourcesExpenseObservation) { + *out = *in + if in.AdditionalExpense != nil { + in, out := &in.AdditionalExpense, &out.AdditionalExpense + *out = new(float64) + **out = **in + } + if in.Code != nil { + in, out := &in.Code, &out.Code + *out = new(string) + **out = **in + } + if in.ComputeExpense != nil { + in, out := &in.ComputeExpense, &out.ComputeExpense + *out = new(float64) + **out = **in + } + if in.LastUpdateTime != nil { + in, out := &in.LastUpdateTime, &out.LastUpdateTime + *out = new(string) + **out = **in + } + if in.Message != nil { + in, out := &in.Message, &out.Message + *out = new(string) + **out = **in + } + if in.NetworkExpense != nil { + in, out := &in.NetworkExpense, &out.NetworkExpense + *out = new(float64) + **out = **in + } + if in.StorageExpense != nil { + in, out := &in.StorageExpense, &out.StorageExpense + *out = new(float64) + **out = **in + } + if in.TotalExpense != nil { + in, out := &in.TotalExpense, &out.TotalExpense + *out = new(float64) + **out = **in + } + if in.Unit != nil { + in, out := &in.Unit, &out.Unit + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcesExpenseObservation. +func (in *ResourcesExpenseObservation) DeepCopy() *ResourcesExpenseObservation { + if in == nil { + return nil + } + out := new(ResourcesExpenseObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourcesExpenseParameters) DeepCopyInto(out *ResourcesExpenseParameters) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcesExpenseParameters. +func (in *ResourcesExpenseParameters) DeepCopy() *ResourcesExpenseParameters { + if in == nil { + return nil + } + out := new(ResourcesExpenseParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourcesObservation) DeepCopyInto(out *ResourcesObservation) { + *out = *in + if in.CreatedAt != nil { + in, out := &in.CreatedAt, &out.CreatedAt + *out = new(string) + **out = **in + } + if in.DependsOn != nil { + in, out := &in.DependsOn, &out.DependsOn + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.Expense != nil { + in, out := &in.Expense, &out.Expense + *out = make([]ResourcesExpenseObservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.PropertiesJSON != nil { + in, out := &in.PropertiesJSON, &out.PropertiesJSON + *out = new(string) + **out = **in + } + if in.State != nil { + in, out := &in.State, &out.State + *out = new(string) + **out = **in + } + if in.SyncStatus != nil { + in, out := &in.SyncStatus, &out.SyncStatus + *out = new(string) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcesObservation. +func (in *ResourcesObservation) DeepCopy() *ResourcesObservation { + if in == nil { + return nil + } + out := new(ResourcesObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourcesParameters) DeepCopyInto(out *ResourcesParameters) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcesParameters. +func (in *ResourcesParameters) DeepCopy() *ResourcesParameters { + if in == nil { + return nil + } + out := new(ResourcesParameters) + in.DeepCopyInto(out) + return out +} diff --git a/apis/deployment/v1alpha1/zz_generated.managed.go b/apis/deployment/v1alpha1/zz_generated.managed.go new file mode 100644 index 0000000..e5cc3ce --- /dev/null +++ b/apis/deployment/v1alpha1/zz_generated.managed.go @@ -0,0 +1,84 @@ +/* +Copyright 2023 Upbound Inc. - ANKASOFT +*/ +// Code generated by angryjet. DO NOT EDIT. + +package v1alpha1 + +import xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + +// GetCondition of this Deployment. +func (mg *Deployment) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this Deployment. +func (mg *Deployment) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetManagementPolicy of this Deployment. +func (mg *Deployment) GetManagementPolicy() xpv1.ManagementPolicy { + return mg.Spec.ManagementPolicy +} + +// GetProviderConfigReference of this Deployment. +func (mg *Deployment) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +/* +GetProviderReference of this Deployment. +Deprecated: Use GetProviderConfigReference. +*/ +func (mg *Deployment) GetProviderReference() *xpv1.Reference { + return mg.Spec.ProviderReference +} + +// GetPublishConnectionDetailsTo of this Deployment. +func (mg *Deployment) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { + return mg.Spec.PublishConnectionDetailsTo +} + +// GetWriteConnectionSecretToReference of this Deployment. +func (mg *Deployment) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this Deployment. +func (mg *Deployment) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this Deployment. +func (mg *Deployment) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetManagementPolicy of this Deployment. +func (mg *Deployment) SetManagementPolicy(r xpv1.ManagementPolicy) { + mg.Spec.ManagementPolicy = r +} + +// SetProviderConfigReference of this Deployment. +func (mg *Deployment) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +/* +SetProviderReference of this Deployment. +Deprecated: Use SetProviderConfigReference. +*/ +func (mg *Deployment) SetProviderReference(r *xpv1.Reference) { + mg.Spec.ProviderReference = r +} + +// SetPublishConnectionDetailsTo of this Deployment. +func (mg *Deployment) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { + mg.Spec.PublishConnectionDetailsTo = r +} + +// SetWriteConnectionSecretToReference of this Deployment. +func (mg *Deployment) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} diff --git a/apis/deployment/v1alpha1/zz_generated.managedlist.go b/apis/deployment/v1alpha1/zz_generated.managedlist.go new file mode 100644 index 0000000..4577c8d --- /dev/null +++ b/apis/deployment/v1alpha1/zz_generated.managedlist.go @@ -0,0 +1,17 @@ +/* +Copyright 2023 Upbound Inc. - ANKASOFT +*/ +// Code generated by angryjet. DO NOT EDIT. + +package v1alpha1 + +import resource "github.com/crossplane/crossplane-runtime/pkg/resource" + +// GetItems of this DeploymentList. +func (l *DeploymentList) 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/deployment/v1alpha1/zz_generated_terraformed.go b/apis/deployment/v1alpha1/zz_generated_terraformed.go new file mode 100755 index 0000000..309e495 --- /dev/null +++ b/apis/deployment/v1alpha1/zz_generated_terraformed.go @@ -0,0 +1,88 @@ +/* +Copyright 2023 Upbound Inc. - ANKASOFT +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1alpha1 + +import ( + "github.com/pkg/errors" + + "github.com/upbound/upjet/pkg/resource" + "github.com/upbound/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this Deployment +func (mg *Deployment) GetTerraformResourceType() string { + return "vra_deployment" +} + +// GetConnectionDetailsMapping for this Deployment +func (tr *Deployment) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this Deployment +func (tr *Deployment) 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 Deployment +func (tr *Deployment) 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 Deployment +func (tr *Deployment) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this Deployment +func (tr *Deployment) 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 Deployment +func (tr *Deployment) 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) +} + +// LateInitialize this Deployment using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *Deployment) LateInitialize(attrs []byte) (bool, error) { + params := &DeploymentParameters{} + 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 *Deployment) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/deployment/v1alpha1/zz_groupversion_info.go b/apis/deployment/v1alpha1/zz_groupversion_info.go new file mode 100755 index 0000000..78cc103 --- /dev/null +++ b/apis/deployment/v1alpha1/zz_groupversion_info.go @@ -0,0 +1,32 @@ +/* +Copyright 2023 Upbound Inc. - ANKASOFT +*/ + +// Code generated by upjet. DO NOT EDIT. + +// +kubebuilder:object:generate=true +// +groupName=deployment.crossplane.io +// +versionName=v1alpha1 +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +// Package type metadata. +const ( + CRDGroup = "deployment.crossplane.io" + CRDVersion = "v1alpha1" +) + +var ( + // CRDGroupVersion is the API Group Version used to register the objects + CRDGroupVersion = schema.GroupVersion{Group: CRDGroup, Version: CRDVersion} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: CRDGroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/apis/zz_register.go b/apis/zz_register.go index c6cb69b..ab4b537 100755 --- a/apis/zz_register.go +++ b/apis/zz_register.go @@ -11,6 +11,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" v1alpha1 "github.com/ankasoftco/upjet-provider-vra/apis/blueprint/v1alpha1" + v1alpha1deployment "github.com/ankasoftco/upjet-provider-vra/apis/deployment/v1alpha1" v1alpha1project "github.com/ankasoftco/upjet-provider-vra/apis/project/v1alpha1" v1alpha1apis "github.com/ankasoftco/upjet-provider-vra/apis/v1alpha1" v1beta1 "github.com/ankasoftco/upjet-provider-vra/apis/v1beta1" @@ -21,6 +22,7 @@ func init() { AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme, v1alpha1.SchemeBuilder.AddToScheme, + v1alpha1deployment.SchemeBuilder.AddToScheme, v1alpha1project.SchemeBuilder.AddToScheme, v1alpha1apis.SchemeBuilder.AddToScheme, v1beta1.SchemeBuilder.AddToScheme, diff --git a/config/deployment/config.go b/config/deployment/config.go new file mode 100644 index 0000000..2aa565a --- /dev/null +++ b/config/deployment/config.go @@ -0,0 +1,11 @@ +package repository + +import "github.com/upbound/upjet/pkg/config" + +// Configure configures individual resources by adding custom ResourceConfigurators. +func Configure(p *config.Provider) { + p.AddResourceConfigurator("vra_deployment", func(r *config.Resource) { + r.ShortGroup = "deployment" + r.Version = "v1alpha1" + }) +} \ No newline at end of file diff --git a/config/external_name.go b/config/external_name.go index 13f4569..6a94c6c 100644 --- a/config/external_name.go +++ b/config/external_name.go @@ -13,6 +13,7 @@ var ExternalNameConfigs = map[string]config.ExternalName{ "vra_project": config.IdentifierFromProvider, "vra_blueprint": config.IdentifierFromProvider, "vra_blueprint_version": config.IdentifierFromProvider, + "vra_deployment": config.IdentifierFromProvider, } // ExternalNameConfigurations applies all external name configs listed in the diff --git a/config/provider.go b/config/provider.go index dd42afc..d91fd3f 100644 --- a/config/provider.go +++ b/config/provider.go @@ -12,6 +12,7 @@ import ( project "github.com/ankasoftco/upjet-provider-vra/config/project" blueprint "github.com/ankasoftco/upjet-provider-vra/config/blueprint" + deployment "github.com/ankasoftco/upjet-provider-vra/config/deployment" ) const ( @@ -38,7 +39,8 @@ func GetProvider() *ujconfig.Provider { for _, configure := range []func(provider *ujconfig.Provider){ // add custom config functions project.Configure, - blueprint.Configure, + blueprint.Configure, + deployment.Configure, } { configure(pc) } diff --git a/internal/controller/deployment/deployment/zz_controller.go b/internal/controller/deployment/deployment/zz_controller.go new file mode 100755 index 0000000..94029fe --- /dev/null +++ b/internal/controller/deployment/deployment/zz_controller.go @@ -0,0 +1,55 @@ +/* +Copyright 2023 Upbound Inc. - ANKASOFT +*/ + +// Code generated by upjet. DO NOT EDIT. + +package deployment + +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/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + ctrl "sigs.k8s.io/controller-runtime" + + v1alpha1 "github.com/ankasoftco/upjet-provider-vra/apis/deployment/v1alpha1" + features "github.com/ankasoftco/upjet-provider-vra/internal/features" +) + +// Setup adds a controller that reconciles Deployment managed resources. +func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { + name := managed.ControllerName(v1alpha1.Deployment_GroupVersionKind.String()) + var initializers managed.InitializerChain + cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} + if o.SecretStoreConfigGVK != nil { + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + } + opts := []managed.ReconcilerOption{ + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["vra_deployment"], tjcontroller.WithLogger(o.Logger), + tjcontroller.WithCallbackProvider(tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1alpha1.Deployment_GroupVersionKind))), + )), + 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.Features.Enabled(features.EnableAlphaManagementPolicies) { + opts = append(opts, managed.WithManagementPolicies()) + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1alpha1.Deployment_GroupVersionKind), opts...) + + return ctrl.NewControllerManagedBy(mgr). + Named(name). + WithOptions(o.ForControllerRuntime()). + For(&v1alpha1.Deployment{}). + Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) +} diff --git a/internal/controller/zz_setup.go b/internal/controller/zz_setup.go index a3bf328..64376f8 100755 --- a/internal/controller/zz_setup.go +++ b/internal/controller/zz_setup.go @@ -11,6 +11,7 @@ import ( blueprint "github.com/ankasoftco/upjet-provider-vra/internal/controller/blueprint/blueprint" version "github.com/ankasoftco/upjet-provider-vra/internal/controller/blueprint/version" + deployment "github.com/ankasoftco/upjet-provider-vra/internal/controller/deployment/deployment" project "github.com/ankasoftco/upjet-provider-vra/internal/controller/project/project" providerconfig "github.com/ankasoftco/upjet-provider-vra/internal/controller/providerconfig" ) @@ -21,6 +22,7 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { for _, setup := range []func(ctrl.Manager, controller.Options) error{ blueprint.Setup, version.Setup, + deployment.Setup, project.Setup, providerconfig.Setup, } { diff --git a/package/crds/deployment.crossplane.io_deployments.yaml b/package/crds/deployment.crossplane.io_deployments.yaml new file mode 100644 index 0000000..76eca83 --- /dev/null +++ b/package/crds/deployment.crossplane.io_deployments.yaml @@ -0,0 +1,573 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.11.3 + creationTimestamp: null + name: deployments.deployment.crossplane.io +spec: + group: deployment.crossplane.io + names: + categories: + - crossplane + - managed + - vra + kind: Deployment + listKind: DeploymentList + plural: deployments + singular: deployment + 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: Deployment is the Schema for the Deployments 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: DeploymentSpec defines the desired state of Deployment + 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 ManagementPolicy 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: + blueprintContent: + description: The content of the the cloud template to be used + to request the deployment. + type: string + blueprintId: + description: The id of the cloud template to be used to request + the deployment. + type: string + blueprintVersion: + description: The version of the cloud template to be used to request + the deployment. + type: string + catalogItemId: + description: The id of the catalog item to be used to request + the deployment. + type: string + catalogItemVersion: + description: The version of the catalog item to be used to request + the deployment. + type: string + description: + description: A human-friendly description. + type: string + expandLastRequest: + type: boolean + expandProject: + description: Flag to indicate whether to expand project information. + type: boolean + expandResources: + type: boolean + inputs: + additionalProperties: + type: string + description: Inputs provided by the user. For inputs including + those with default values, refer to inputs_including_defaults. + type: object + name: + description: The name of the deployment. + type: string + owner: + description: The user this deployment belongs to. + type: string + projectId: + description: The id of the project this deployment belongs to. + type: string + reason: + description: Reason for requesting/updating a blueprint. + type: string + type: object + managementPolicy: + default: FullControl + description: 'THIS IS AN ALPHA FIELD. Do not use it in production. + It is not honored unless the relevant Crossplane feature flag is + enabled, and may be changed or removed without notice. ManagementPolicy + specifies the level of control Crossplane has over the managed external + resource. 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. + 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: + - FullControl + - ObserveOnly + - OrphanOnDelete + type: string + 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 + providerRef: + description: 'ProviderReference specifies the provider that will be + used to create, observe, update, and delete this managed resource. + Deprecated: Please use ProviderConfigReference, i.e. `providerConfigRef`' + 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: name is a required parameter + rule: self.managementPolicy == 'ObserveOnly' || has(self.forProvider.name) + - message: projectId is a required parameter + rule: self.managementPolicy == 'ObserveOnly' || has(self.forProvider.projectId) + status: + description: DeploymentStatus defines the observed state of Deployment. + properties: + atProvider: + properties: + blueprintContent: + description: The content of the the cloud template to be used + to request the deployment. + type: string + blueprintId: + description: The id of the cloud template to be used to request + the deployment. + type: string + blueprintVersion: + description: The version of the cloud template to be used to request + the deployment. + type: string + catalogItemId: + description: The id of the catalog item to be used to request + the deployment. + type: string + catalogItemVersion: + description: The version of the catalog item to be used to request + the deployment. + type: string + createdAt: + description: Date when the entity was created. The date is in + ISO 6801 and UTC. + type: string + createdBy: + description: The user the entity was created by. + type: string + description: + description: A human-friendly description. + type: string + expandLastRequest: + type: boolean + expandProject: + description: Flag to indicate whether to expand project information. + type: boolean + expandResources: + type: boolean + expense: + items: + properties: + additionalExpense: + type: number + code: + type: string + computeExpense: + type: number + lastUpdateTime: + type: string + message: + type: string + networkExpense: + type: number + storageExpense: + type: number + totalExpense: + type: number + unit: + type: string + type: object + type: array + id: + type: string + inputs: + additionalProperties: + type: string + description: Inputs provided by the user. For inputs including + those with default values, refer to inputs_including_defaults. + type: object + inputsIncludingDefaults: + additionalProperties: + type: string + description: All the inputs applied during last create/update + operation, including those with default values. + type: object + lastRequest: + items: + properties: + actionId: + type: string + approvedAt: + type: string + blueprintId: + type: string + cancelable: + type: boolean + catalogItemId: + type: string + completedAt: + type: string + completedTasks: + type: number + createdAt: + type: string + details: + type: string + dismissed: + type: boolean + id: + type: string + initializedAt: + type: string + inputs: + additionalProperties: + type: string + type: object + name: + type: string + outputs: + additionalProperties: + type: string + type: object + requestedBy: + type: string + resourceIds: + items: + type: string + type: array + status: + type: string + totalTasks: + type: number + updatedAt: + type: string + type: object + type: array + lastUpdatedAt: + description: Date when the entity was last updated. The date is + in ISO 6801 and UTC. + type: string + lastUpdatedBy: + description: The user that last updated the deployment. + type: string + leaseExpireAt: + description: Date when the deployment lease expire. The date is + in ISO 6801 and UTC. + type: string + name: + description: The name of the deployment. + type: string + orgId: + description: The Id of the organization this deployment belongs + to. + type: string + owner: + description: The user this deployment belongs to. + type: string + project: + items: + properties: + description: + type: string + id: + type: string + name: + type: string + version: + type: string + type: object + type: array + projectId: + description: The id of the project this deployment belongs to. + type: string + reason: + description: Reason for requesting/updating a blueprint. + type: string + resources: + items: + properties: + createdAt: + type: string + dependsOn: + items: + type: string + type: array + description: + type: string + expense: + items: + properties: + additionalExpense: + type: number + code: + type: string + computeExpense: + type: number + lastUpdateTime: + type: string + message: + type: string + networkExpense: + type: number + storageExpense: + type: number + totalExpense: + type: number + unit: + type: string + type: object + type: array + id: + type: string + name: + type: string + propertiesJson: + type: string + state: + type: string + syncStatus: + type: string + type: + type: string + type: object + type: array + status: + description: The status of the deployment with respect to its + life cycle operations. + 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 + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {}