From 5f41ec7eee5d94c839ba2543688181acd3324b93 Mon Sep 17 00:00:00 2001 From: Russel Vela Date: Fri, 31 May 2024 03:34:00 -0600 Subject: [PATCH] feat(cloud-provisioning): Machine Identity struct changes Changes type of Machine Identity IDs from UUID to string for ease of use --- pkg/domain/cloudproviders.go | 10 +++---- .../cloudproviders/cloudproviders.go | 29 ++++--------------- 2 files changed, 9 insertions(+), 30 deletions(-) diff --git a/pkg/domain/cloudproviders.go b/pkg/domain/cloudproviders.go index d5c096fc..d6e33b41 100644 --- a/pkg/domain/cloudproviders.go +++ b/pkg/domain/cloudproviders.go @@ -2,8 +2,6 @@ package domain import ( "strings" - - "github.com/google/uuid" ) type CloudProviderStatus int @@ -221,12 +219,12 @@ func (ccm *CertificateCloudMetadata) GetValue(key string) interface{} { } type CloudMachineIdentity struct { - ID uuid.UUID - CloudKeystoreID uuid.UUID + ID string + CloudKeystoreID string CloudKeystoreName string - CloudProviderID uuid.UUID + CloudProviderID string CloudProviderName string - CertificateID uuid.UUID + CertificateID string Metadata *CertificateCloudMetadata Status MachineIdentityStatus StatusDetails string diff --git a/pkg/webclient/cloudproviders/cloudproviders.go b/pkg/webclient/cloudproviders/cloudproviders.go index 29f57115..94d8a471 100644 --- a/pkg/webclient/cloudproviders/cloudproviders.go +++ b/pkg/webclient/cloudproviders/cloudproviders.go @@ -7,8 +7,6 @@ import ( "net/http" "github.com/Khan/genqlient/graphql" - "github.com/google/uuid" - "github.com/Venafi/vcert/v5/pkg/domain" "github.com/Venafi/vcert/v5/pkg/util" ) @@ -172,27 +170,10 @@ func (c *CloudProvidersClient) ProvisionCertificateToMachineIdentity(ctx context } func (v *GetMachineIdentitiesCloudMachineIdentitiesMachineIdentityConnectionNodesMachineIdentity) toDomain() (*domain.CloudMachineIdentity, error) { - id, err := uuid.Parse(v.Id) - if err != nil { - return nil, fmt.Errorf("failed to parse cloud machine identity id %s: %w", v.Id, err) - } - keystoreID, err := uuid.Parse(v.CloudKeystoreId) - if err != nil { - return nil, fmt.Errorf("failed to parse cloud key store id %s: %w", v.CloudKeystoreId, err) - } - certificateID, err := uuid.Parse(v.CertificateId) - if err != nil { - return nil, fmt.Errorf("failed to parse cloud certificate id %s: %w", v.CertificateId, err) - } - providerIDStr := "" + providerID := "" if v.CloudProviderId != nil { - providerIDStr = *v.CloudProviderId + providerID = *v.CloudProviderId } - providerID, err := uuid.Parse(providerIDStr) - if err != nil { - return nil, fmt.Errorf("failed to parse cloud provider id %s: %w", providerIDStr, err) - } - keystoreName := "" if v.CloudKeystoreName != nil { keystoreName = *v.CloudKeystoreName @@ -211,12 +192,12 @@ func (v *GetMachineIdentitiesCloudMachineIdentitiesMachineIdentityConnectionNode } return &domain.CloudMachineIdentity{ - ID: id, - CloudKeystoreID: keystoreID, + ID: v.Id, + CloudKeystoreID: v.CloudKeystoreId, CloudKeystoreName: keystoreName, CloudProviderID: providerID, CloudProviderName: providerName, - CertificateID: certificateID, + CertificateID: v.CertificateId, Metadata: metadata, Status: v.Status.toDomain(), StatusDetails: statusDetails,