From b403b64bc94d964119f5ebe1231064ec83fa9a7d Mon Sep 17 00:00:00 2001 From: Marcus Noble Date: Tue, 15 Oct 2024 14:01:12 +0100 Subject: [PATCH] Added cloud-director as a future provider, currently unsupported (#1441) Signed-off-by: Marcus Noble --- sdk/CHANGELOG.md | 14 ++++++++++++-- sdk/api/v1alpha1/types.go | 6 ++++++ sdk/repo.go | 14 ++++++++------ 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/sdk/CHANGELOG.md b/sdk/CHANGELOG.md index 869d4a6f7..194ea08bd 100644 --- a/sdk/CHANGELOG.md +++ b/sdk/CHANGELOG.md @@ -5,13 +5,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] +## [0.8.0] - 2024-10-15 -## [Unreleased] +### Added + +- Add Cloud Director provider to the list of supported providers. + +### Changed + +- Made the `getProviderDirectory` function more dynamic and less hardcoded for most cases. + +## [0.7.0] - 2024-10-15 ### Added -- Add Azure provider to the list of supported providers. +- Add VSphere provider to the list of supported providers. ## [0.6.0] - 2024-07-26 diff --git a/sdk/api/v1alpha1/types.go b/sdk/api/v1alpha1/types.go index 62072bc37..32cf47c6c 100644 --- a/sdk/api/v1alpha1/types.go +++ b/sdk/api/v1alpha1/types.go @@ -13,12 +13,18 @@ const ( // ProviderVsphere represents the new Vsphere provider which is implemented with Cluster API. ProviderVsphere Provider = "vsphere" + + // ProviderCloudDirector represents the new VCD provider which is implemented with Cluster API. + ProviderCloudDirector Provider = "cloud-director" ) var SupportedProviders = []Provider{ ProviderAws, ProviderAzure, ProviderVsphere, + + // Not yet supported: + // ProviderCloudDirector, } type Provider string diff --git a/sdk/repo.go b/sdk/repo.go index 79b5efd06..61df980ab 100644 --- a/sdk/repo.go +++ b/sdk/repo.go @@ -12,13 +12,15 @@ const ( func getProviderDirectory(provider Provider) (string, error) { switch provider { + case "": + return "", microerror.Maskf(InvalidProviderError, "no provider supplied") + + // Providers that use a different path name to their provider name case ProviderAws: return "capa", nil - case ProviderAzure: - return "azure", nil - case ProviderVsphere: - return "vsphere", nil - } - return "", microerror.Maskf(InvalidProviderError, "unknown provider: %s", provider) + // By default, the value of the provider is used as the path + default: + return string(provider), nil + } }