From e29ddaeb09c4a4207fa12ae0b22d9cde12865aca Mon Sep 17 00:00:00 2001 From: pggb25 Date: Thu, 5 Oct 2023 11:24:23 +0200 Subject: [PATCH] chore: generate_certificated flag becomes required (#206) --- cmd/application_domain_create.go | 4 ++-- cmd/application_domain_edit.go | 4 ++-- cmd/application_domain_list.go | 7 +------ cmd/container_domain_create.go | 4 ++-- cmd/container_domain_edit.go | 4 ++-- cmd/container_domain_list.go | 7 +------ cmd/container_update.go | 2 +- go.mod | 2 +- go.sum | 4 ++++ 9 files changed, 16 insertions(+), 22 deletions(-) diff --git a/cmd/application_domain_create.go b/cmd/application_domain_create.go index a328aa2a..35eb9670 100644 --- a/cmd/application_domain_create.go +++ b/cmd/application_domain_create.go @@ -71,7 +71,7 @@ var applicationDomainCreateCmd = &cobra.Command{ generateCertificate := !doNotGenerateCertificate req := qovery.CustomDomainRequest{ Domain: applicationCustomDomain, - GenerateCertificate: &generateCertificate, + GenerateCertificate: generateCertificate, } createdDomain, _, err := client.CustomDomainApi.CreateApplicationCustomDomain(context.Background(), application.Id).CustomDomainRequest(req).Execute() @@ -82,7 +82,7 @@ var applicationDomainCreateCmd = &cobra.Command{ panic("unreachable") // staticcheck false positive: https://staticcheck.io/docs/checks#SA5011 } - utils.Println(fmt.Sprintf("Custom domain %s has been created (generate certificate: %s)", pterm.FgBlue.Sprintf(createdDomain.Domain), pterm.FgBlue.Sprintf(strconv.FormatBool(*createdDomain.GenerateCertificate)))) + utils.Println(fmt.Sprintf("Custom domain %s has been created (generate certificate: %s)", pterm.FgBlue.Sprintf(createdDomain.Domain), pterm.FgBlue.Sprintf(strconv.FormatBool(createdDomain.GenerateCertificate)))) }, } diff --git a/cmd/application_domain_edit.go b/cmd/application_domain_edit.go index 8b119cbe..522cc057 100644 --- a/cmd/application_domain_edit.go +++ b/cmd/application_domain_edit.go @@ -69,7 +69,7 @@ var applicationDomainEditCmd = &cobra.Command{ generateCertificate := !doNotGenerateCertificate req := qovery.CustomDomainRequest{ Domain: applicationCustomDomain, - GenerateCertificate: &generateCertificate, + GenerateCertificate: generateCertificate, } editedDomain, _, err := client.CustomDomainApi.EditCustomDomain(context.Background(), application.Id, customDomain.Id).CustomDomainRequest(req).Execute() @@ -80,7 +80,7 @@ var applicationDomainEditCmd = &cobra.Command{ panic("unreachable") // staticcheck false positive: https://staticcheck.io/docs/checks#SA5011 } - utils.Println(fmt.Sprintf("Custom domain %s has been edited (generate certificate: %s)", pterm.FgBlue.Sprintf(editedDomain.Domain), pterm.FgBlue.Sprintf(strconv.FormatBool(*editedDomain.GenerateCertificate)))) + utils.Println(fmt.Sprintf("Custom domain %s has been edited (generate certificate: %s)", pterm.FgBlue.Sprintf(editedDomain.Domain), pterm.FgBlue.Sprintf(strconv.FormatBool(editedDomain.GenerateCertificate)))) }, } diff --git a/cmd/application_domain_list.go b/cmd/application_domain_list.go index 143d1b50..ba77f5b1 100644 --- a/cmd/application_domain_list.go +++ b/cmd/application_domain_list.go @@ -80,17 +80,12 @@ var applicationDomainListCmd = &cobra.Command{ for _, customDomain := range customDomains.GetResults() { customDomainsSet[customDomain.Domain] = true - generateCertificate := "N/A" - if customDomain.GenerateCertificate != nil { - generateCertificate = strconv.FormatBool(*customDomain.GenerateCertificate) - } - data = append(data, []string{ customDomain.Id, "CUSTOM_DOMAIN", customDomain.Domain, *customDomain.ValidationDomain, - generateCertificate, + strconv.FormatBool(customDomain.GenerateCertificate), }) } diff --git a/cmd/container_domain_create.go b/cmd/container_domain_create.go index 40d747d5..f02e4af5 100644 --- a/cmd/container_domain_create.go +++ b/cmd/container_domain_create.go @@ -71,7 +71,7 @@ var containerDomainCreateCmd = &cobra.Command{ generateCertificate := !doNotGenerateCertificate req := qovery.CustomDomainRequest{ Domain: containerCustomDomain, - GenerateCertificate: &generateCertificate, + GenerateCertificate: generateCertificate, } createdDomain, _, err := client.ContainerCustomDomainApi.CreateContainerCustomDomain(context.Background(), container.Id).CustomDomainRequest(req).Execute() @@ -82,7 +82,7 @@ var containerDomainCreateCmd = &cobra.Command{ panic("unreachable") // staticcheck false positive: https://staticcheck.io/docs/checks#SA5011 } - utils.Println(fmt.Sprintf("Custom domain %s has been created (generate certificate: %s)", pterm.FgBlue.Sprintf(createdDomain.Domain), pterm.FgBlue.Sprintf(strconv.FormatBool(*createdDomain.GenerateCertificate)))) + utils.Println(fmt.Sprintf("Custom domain %s has been created (generate certificate: %s)", pterm.FgBlue.Sprintf(createdDomain.Domain), pterm.FgBlue.Sprintf(strconv.FormatBool(createdDomain.GenerateCertificate)))) }, } diff --git a/cmd/container_domain_edit.go b/cmd/container_domain_edit.go index effa9e6a..5ceac198 100644 --- a/cmd/container_domain_edit.go +++ b/cmd/container_domain_edit.go @@ -69,7 +69,7 @@ var containerDomainEditCmd = &cobra.Command{ generateCertificate := !doNotGenerateCertificate req := qovery.CustomDomainRequest{ Domain: containerCustomDomain, - GenerateCertificate: &generateCertificate, + GenerateCertificate: generateCertificate, } editedDomain, _, err := client.ContainerCustomDomainApi.EditContainerCustomDomain(context.Background(), container.Id, customDomain.Id).CustomDomainRequest(req).Execute() @@ -80,7 +80,7 @@ var containerDomainEditCmd = &cobra.Command{ panic("unreachable") // staticcheck false positive: https://staticcheck.io/docs/checks#SA5011 } - utils.Println(fmt.Sprintf("Custom domain %s has been edited (generate certificate: %s)", pterm.FgBlue.Sprintf(editedDomain.Domain), pterm.FgBlue.Sprintf(strconv.FormatBool(*editedDomain.GenerateCertificate)))) + utils.Println(fmt.Sprintf("Custom domain %s has been edited (generate certificate: %s)", pterm.FgBlue.Sprintf(editedDomain.Domain), pterm.FgBlue.Sprintf(strconv.FormatBool(editedDomain.GenerateCertificate)))) }, } diff --git a/cmd/container_domain_list.go b/cmd/container_domain_list.go index 03548667..7033191f 100644 --- a/cmd/container_domain_list.go +++ b/cmd/container_domain_list.go @@ -67,17 +67,12 @@ var containerDomainListCmd = &cobra.Command{ for _, customDomain := range customDomains.GetResults() { customDomainsSet[customDomain.Domain] = true - generateCertificate := "N/A" - if customDomain.GenerateCertificate != nil { - generateCertificate = strconv.FormatBool(*customDomain.GenerateCertificate) - } - data = append(data, []string{ customDomain.Id, "CUSTOM_DOMAIN", customDomain.Domain, *customDomain.ValidationDomain, - generateCertificate, + strconv.FormatBool(customDomain.GenerateCertificate), }) } diff --git a/cmd/container_update.go b/cmd/container_update.go index 1ffcd829..331ea8bb 100644 --- a/cmd/container_update.go +++ b/cmd/container_update.go @@ -88,7 +88,7 @@ var containerUpdateCmd = &cobra.Command{ Ports: ports, Name: container.Name, Description: container.Description, - RegistryId: *container.Registry.Id, + RegistryId: container.Registry.Id, ImageName: imageName, Tag: tag, Arguments: container.Arguments, diff --git a/go.mod b/go.mod index 9b0860e7..42b04c50 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/posthog/posthog-go v0.0.0-20221221115252-24dfed35d71a github.com/pterm/pterm v0.12.55 - github.com/qovery/qovery-client-go v0.0.0-20231003154456-09b5ae9eae15 + github.com/qovery/qovery-client-go v0.0.0-20231005085710-02b1085fcf27 github.com/sirupsen/logrus v1.9.0 github.com/spf13/cobra v1.6.1 github.com/spf13/pflag v1.0.5 diff --git a/go.sum b/go.sum index 7e7738c6..944923e7 100644 --- a/go.sum +++ b/go.sum @@ -295,6 +295,10 @@ github.com/qovery/qovery-client-go v0.0.0-20231003144739-772ce5bcc19e h1:o0TQ5QH github.com/qovery/qovery-client-go v0.0.0-20231003144739-772ce5bcc19e/go.mod h1:7su0Zq+YniKNRSXNJsdrbR2/dGn7UHz3QJ2WpcxyP8k= github.com/qovery/qovery-client-go v0.0.0-20231003154456-09b5ae9eae15 h1:pwdYIUSwOMXjYtuVErvuWN3IQYY1RhjYvGFKOt+y9CQ= github.com/qovery/qovery-client-go v0.0.0-20231003154456-09b5ae9eae15/go.mod h1:7su0Zq+YniKNRSXNJsdrbR2/dGn7UHz3QJ2WpcxyP8k= +github.com/qovery/qovery-client-go v0.0.0-20231004152120-c3f72c7ff7aa h1:gym7RXHFht0nCflEiWC87hm1JNosaqOGM/dZhZPb5ZU= +github.com/qovery/qovery-client-go v0.0.0-20231004152120-c3f72c7ff7aa/go.mod h1:7su0Zq+YniKNRSXNJsdrbR2/dGn7UHz3QJ2WpcxyP8k= +github.com/qovery/qovery-client-go v0.0.0-20231005085710-02b1085fcf27 h1:biZ8BWw9tzYSMHz+ohs6B6DTEoQQBaXdZyU7BRA0taA= +github.com/qovery/qovery-client-go v0.0.0-20231005085710-02b1085fcf27/go.mod h1:7su0Zq+YniKNRSXNJsdrbR2/dGn7UHz3QJ2WpcxyP8k= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=