From f26d0a88d66fc615a88a9b600b0658d748914d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Gustav=20Str=C3=A5b=C3=B8?= <65334626+nilsgstrabo@users.noreply.github.com> Date: Fri, 12 Apr 2024 14:51:17 +0200 Subject: [PATCH 1/3] Replace device code login with interactive login (#90) * replace device code login with interactive login * add flag --use-device-code for login command * add SilenceUsage and fix usage for flag * extend help for use-device-code * update help --- cmd/login.go | 6 ++++-- pkg/client/auth/client.go | 5 +---- pkg/client/auth/msal_provider.go | 34 ++++++++++++++++++++++++-------- pkg/client/client.go | 8 ++++---- pkg/flagnames/names.go | 1 + 5 files changed, 36 insertions(+), 18 deletions(-) diff --git a/cmd/login.go b/cmd/login.go index 44eb25e..203a782 100644 --- a/cmd/login.go +++ b/cmd/login.go @@ -16,6 +16,7 @@ package cmd import ( "github.com/equinor/radix-cli/pkg/client" + "github.com/equinor/radix-cli/pkg/flagnames" "github.com/spf13/cobra" ) @@ -25,10 +26,10 @@ var loginCmd = &cobra.Command{ Short: "Login to Radix", Long: `Login to Radix.`, RunE: func(cmd *cobra.Command, args []string) error { - cmd.SilenceUsage = true - err := client.LoginCommand(cmd) + useDeviceCode, _ := cmd.Flags().GetBool(flagnames.UseDeviceCode) + err := client.LoginCommand(cmd, useDeviceCode) if err != nil { return err } @@ -39,5 +40,6 @@ var loginCmd = &cobra.Command{ func init() { rootCmd.AddCommand(loginCmd) + loginCmd.Flags().Bool(flagnames.UseDeviceCode, false, "Use CLI's old authentication flow based on device code. The device code flow does not work for compliant device policy enabled accounts.") setVerbosePersistentFlag(loginCmd) } diff --git a/pkg/client/auth/client.go b/pkg/client/auth/client.go index 7b8ffe2..d9c2327 100644 --- a/pkg/client/auth/client.go +++ b/pkg/client/auth/client.go @@ -1,17 +1,14 @@ package auth import ( - "fmt" - "github.com/AzureAD/microsoft-authentication-library-for-go/apps/public" radixconfig "github.com/equinor/radix-cli/pkg/config" ) // newPublicClient creates a new authentication client -func newPublicClient(radixConfig *radixconfig.RadixConfig, clientID, tenantID string) (*public.Client, error) { +func newPublicClient(radixConfig *radixconfig.RadixConfig, clientID, authority string) (*public.Client, error) { cacheAccessor := NewTokenCache(radixConfig) cache := public.WithCache(cacheAccessor) - authority := fmt.Sprintf("https://login.microsoftonline.com/%s", tenantID) client, err := public.New(clientID, cache, public.WithAuthority(authority)) if err != nil { return nil, err diff --git a/pkg/client/auth/msal_provider.go b/pkg/client/auth/msal_provider.go index 6c65294..8644c58 100644 --- a/pkg/client/auth/msal_provider.go +++ b/pkg/client/auth/msal_provider.go @@ -13,24 +13,27 @@ import ( // MSALAuthProvider is an AuthProvider that uses MSAL type MSALAuthProvider interface { - Login(ctx context.Context) error + Login(ctx context.Context, useDeviceCode bool) error Logout(ctx context.Context) error runtime.ClientAuthInfoWriter } // NewMSALAuthProvider creates a new MSALAuthProvider func NewMSALAuthProvider(radixConfig *radixconfig.RadixConfig, clientID, tenantID string) (MSALAuthProvider, error) { - client, err := newPublicClient(radixConfig, clientID, tenantID) + authority := fmt.Sprintf("https://login.microsoftonline.com/%s", tenantID) + client, err := newPublicClient(radixConfig, clientID, authority) if err != nil { return nil, err } return &msalAuthProvider{ - client: client, + client: client, + authority: authority, }, nil } type msalAuthProvider struct { - client *public.Client + authority string + client *public.Client } func (provider *msalAuthProvider) AuthenticateRequest(r runtime.ClientRequest, _ strfmt.Registry) error { @@ -43,8 +46,12 @@ func (provider *msalAuthProvider) AuthenticateRequest(r runtime.ClientRequest, _ // Login allows the plugin to initialize its configuration. It must not // require direct user interaction. -func (provider *msalAuthProvider) Login(ctx context.Context) error { - _, err := provider.loginWithDeviceCode(ctx) +func (provider *msalAuthProvider) Login(ctx context.Context, useDeviceCode bool) error { + var loginCmd func(context.Context) (string, error) = provider.loginInteractive + if useDeviceCode { + loginCmd = provider.loginDeviceCode + } + _, err := loginCmd(ctx) return err } @@ -80,10 +87,21 @@ func (provider *msalAuthProvider) GetToken(ctx context.Context) (string, error) // either there was no cached account/token or the call to AcquireTokenSilent() failed // make a new request to AAD - return provider.loginWithDeviceCode(ctx) + return provider.loginInteractive(ctx) +} + +func (provider *msalAuthProvider) loginInteractive(ctx context.Context) (string, error) { + ctx, cancel := context.WithTimeout(ctx, 100*time.Second) + defer cancel() + fmt.Printf("A web browser has been opened at %s/oauth2/v2.0/authorize. Please continue the login in the web browser.\n", provider.authority) + result, err := provider.client.AcquireTokenInteractive(ctx, getScopes()) + if err != nil { + return "", err + } + return result.AccessToken, nil } -func (provider *msalAuthProvider) loginWithDeviceCode(ctx context.Context) (string, error) { +func (provider *msalAuthProvider) loginDeviceCode(ctx context.Context) (string, error) { ctx, cancel := context.WithTimeout(ctx, 100*time.Second) defer cancel() devCode, err := provider.client.AcquireTokenByDeviceCode(ctx, getScopes()) diff --git a/pkg/client/client.go b/pkg/client/client.go index a546b9f..a31a805 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -84,8 +84,8 @@ func getAuthWriter(cmd *cobra.Command, config *radixconfig.RadixConfig) (runtime } // LoginCommand Login client for command -func LoginCommand(cmd *cobra.Command) error { - return LoginContext() +func LoginCommand(cmd *cobra.Command, useDeviceCode bool) error { + return LoginContext(useDeviceCode) } // LogoutCommand Logout command @@ -112,7 +112,7 @@ func getContextAndCluster(cmd *cobra.Command) (string, string, error) { } // LoginContext Performs login -func LoginContext() error { +func LoginContext(useDeviceCode bool) error { radixConfig, err := radixconfig.GetRadixConfig() if err != nil { return err @@ -124,7 +124,7 @@ func LoginContext() error { if err != nil { return err } - return provider.Login(context.Background()) + return provider.Login(context.Background(), useDeviceCode) } func getAuthProvider(radixConfig *radixconfig.RadixConfig) (auth.MSALAuthProvider, error) { diff --git a/pkg/flagnames/names.go b/pkg/flagnames/names.go index 65db67b..0109c63 100644 --- a/pkg/flagnames/names.go +++ b/pkg/flagnames/names.go @@ -39,6 +39,7 @@ const ( TokenEnvironment = "token-environment" TokenStdin = "token-stdin" UseActiveDeployment = "use-active-deployment" + UseDeviceCode = "use-device-code" User = "user" Variable = "variable" Verbose = "verbose" From aa2df2fdd175e70fad300a58955c63e09b2c0ac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Gustav=20Str=C3=A5b=C3=B8?= Date: Mon, 15 Apr 2024 10:24:18 +0200 Subject: [PATCH 2/3] update radix-operator version --- go.mod | 27 +++++++++++---------- go.sum | 76 ++++++++++++++++++++++++++++++---------------------------- 2 files changed, 55 insertions(+), 48 deletions(-) diff --git a/go.mod b/go.mod index a8bcac6..7bfd609 100644 --- a/go.mod +++ b/go.mod @@ -6,17 +6,17 @@ toolchain go1.21.0 require ( github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 - github.com/equinor/radix-operator v1.49.0 + github.com/equinor/radix-operator v1.50.8 github.com/fatih/color v1.15.0 github.com/go-openapi/errors v0.20.4 github.com/go-openapi/runtime v0.26.2 github.com/go-openapi/strfmt v0.21.8 - github.com/go-openapi/swag v0.22.4 + github.com/go-openapi/swag v0.22.7 github.com/go-openapi/validate v0.22.3 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.8.0 - k8s.io/utils v0.0.0-20231127182322-b307cd553661 + k8s.io/utils v0.0.0-20240102154912-e7106e64919e sigs.k8s.io/yaml v1.4.0 ) @@ -24,15 +24,16 @@ require ( dario.cat/mergo v1.0.0 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/beorn7/perks v1.0.1 // indirect + github.com/cert-manager/cert-manager v1.14.2 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/equinor/radix-common v1.7.1 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/analysis v0.21.4 // indirect - github.com/go-openapi/jsonpointer v0.20.0 // indirect - github.com/go-openapi/jsonreference v0.20.2 // indirect + github.com/go-openapi/jsonpointer v0.20.2 // indirect + github.com/go-openapi/jsonreference v0.20.4 // indirect github.com/go-openapi/loads v0.21.2 // indirect github.com/go-openapi/spec v0.20.11 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -43,7 +44,7 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/uuid v1.5.0 // indirect - github.com/imdario/mergo v0.3.13 // indirect + github.com/imdario/mergo v0.3.16 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -65,11 +66,12 @@ require ( github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect + github.com/rs/zerolog v1.32.0 // indirect github.com/spf13/pflag v1.0.5 // indirect go.mongodb.org/mongo-driver v1.13.1 // indirect - go.opentelemetry.io/otel v1.19.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.opentelemetry.io/otel v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/crypto v0.17.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/oauth2 v0.15.0 // indirect @@ -78,7 +80,7 @@ require ( golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/protobuf v1.31.0 // indirect + google.golang.org/protobuf v1.32.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -87,8 +89,9 @@ require ( k8s.io/apimachinery v0.29.0 // indirect k8s.io/client-go v0.29.0 // indirect k8s.io/klog/v2 v2.110.1 // indirect - k8s.io/kube-openapi v0.0.0-20231129212854-f0671cc7e66a // indirect + k8s.io/kube-openapi v0.0.0-20240103051144-eec4567ac022 // indirect sigs.k8s.io/controller-runtime v0.16.3 // indirect + sigs.k8s.io/gateway-api v1.0.0 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/secrets-store-csi-driver v1.4.0 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect diff --git a/go.sum b/go.sum index 75436d5..7862014 100644 --- a/go.sum +++ b/go.sum @@ -7,8 +7,11 @@ github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3d github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cert-manager/cert-manager v1.14.2 h1:C/uci6yxiCRO04PWomBbSX+T4JT58FIIpDj5SZ6Ks6I= +github.com/cert-manager/cert-manager v1.14.2/go.mod h1:pik7K6jXfgh++lfVJ/i1HzEnDluSUtTVLXSHikj8Lho= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -19,15 +22,16 @@ github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxER github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/equinor/radix-common v1.7.1 h1:kl7Tuo2VEo2WHGm/vkvktrZ9t9S3Nht7Mob3CSIzcJI= github.com/equinor/radix-common v1.7.1/go.mod h1:M6mhgHtFQ3rnjJnyOuECXiZOh7XQ5xVeHMyCAU+YPzQ= -github.com/equinor/radix-operator v1.49.0 h1:yNdb0zocBw7GdWybAGUm2lWmk6I+xeeCjvrN8xjVTyA= -github.com/equinor/radix-operator v1.49.0/go.mod h1:i8A6V/g1OM+Zk2lAASZaoX+lHdJIZYYZHA586SHB2p8= +github.com/equinor/radix-operator v1.50.8 h1:PC9WxMOHxDzRH/2zboCn1Rq1nSuSpYA2/ylgvTgaTsA= +github.com/equinor/radix-operator v1.50.8/go.mod h1:bLL8hVfdEUuucNRGUit33uBjUhuunpNWO5youmZz8e8= github.com/evanphx/json-patch v5.7.0+incompatible h1:vgGkfT/9f8zE6tvSCe74nfpAVDQ2tG6yudJd8LBksgI= github.com/evanphx/json-patch v5.7.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-openapi/analysis v0.21.4 h1:ZDFLvSNxpDaomuCueM0BlSXxpANBlFYiBvr+GXrvIHc= @@ -37,12 +41,11 @@ github.com/go-openapi/errors v0.20.4 h1:unTcVm6PispJsMECE3zWgvG4xTiKda1LIR5rCRWL github.com/go-openapi/errors v0.20.4/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= -github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ= -github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA= +github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= +github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= -github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= -github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/go-openapi/jsonreference v0.20.4 h1:bKlDxQxQJgwpUSgOENiMPzCTBVuc7vTdXSSgNeAhojU= +github.com/go-openapi/jsonreference v0.20.4/go.mod h1:5pZJyJP2MnYCpoeoMAql78cCHauHj0V9Lhc506VOpw4= github.com/go-openapi/loads v0.21.2 h1:r2a/xFIYeZ4Qd2TnGpWDIQNcP80dIaZgf704za8enro= github.com/go-openapi/loads v0.21.2/go.mod h1:Jq58Os6SSGz0rzh62ptiu8Z31I+OTHqmULx5e/gJbNw= github.com/go-openapi/runtime v0.26.2 h1:elWyB9MacRzvIVgAZCBJmqTi7hBzU0hlKD4IvfX0Zl0= @@ -56,13 +59,13 @@ github.com/go-openapi/strfmt v0.21.8/go.mod h1:adeGTkxE44sPyLk0JV235VQAO/ZXUr8KA github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= -github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.22.7 h1:JWrc1uc/P9cSomxfnsFSVWoE1FW6bNbrVPmpQYpCcR8= +github.com/go-openapi/swag v0.22.7/go.mod h1:Gl91UqO+btAM0plGGxHqJcQZ1ZTy6jbmridBTsDy8A0= github.com/go-openapi/validate v0.22.3 h1:KxG9mu5HBRYbecRb37KRCihvGGtND2aXziBAv0NNfyI= github.com/go-openapi/validate v0.22.3/go.mod h1:kVxh31KbfsxU8ZyoHaDbLBWU5CnMdqBUEtadQ2G4d5M= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= @@ -89,8 +92,8 @@ github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLe github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= -github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= +github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= +github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= @@ -101,7 +104,6 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -163,8 +165,11 @@ github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lne github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= +github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= @@ -174,14 +179,11 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= @@ -198,14 +200,14 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= go.mongodb.org/mongo-driver v1.13.1 h1:YIc7HTYsKndGK4RFzJ3covLz1byri52x0IoMB0Pt/vk= go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo= -go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= -go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= -go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= -go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= -go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o= -go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A= -go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= -go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -248,6 +250,7 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -270,8 +273,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss= -golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= +golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= +golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -280,8 +283,8 @@ google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAs google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -296,7 +299,6 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/api v0.29.0 h1:NiCdQMY1QOp1H8lfRyeEf8eOwV6+0xA6XEE44ohDX2A= @@ -309,12 +311,14 @@ k8s.io/client-go v0.29.0 h1:KmlDtFcrdUzOYrBhXHgKw5ycWzc3ryPX5mQe0SkG3y8= k8s.io/client-go v0.29.0/go.mod h1:yLkXH4HKMAywcrD82KMSmfYg2DlE8mepPR4JGSo5n38= k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= -k8s.io/kube-openapi v0.0.0-20231129212854-f0671cc7e66a h1:ZeIPbyHHqahGIbeyLJJjAUhnxCKqXaDY+n89Ms8szyA= -k8s.io/kube-openapi v0.0.0-20231129212854-f0671cc7e66a/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= -k8s.io/utils v0.0.0-20231127182322-b307cd553661 h1:FepOBzJ0GXm8t0su67ln2wAZjbQ6RxQGZDnzuLcrUTI= -k8s.io/utils v0.0.0-20231127182322-b307cd553661/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/kube-openapi v0.0.0-20240103051144-eec4567ac022 h1:avRdiaB03v88Mfvum2S3BBwkNuTlmuar4LlfO9Hajko= +k8s.io/kube-openapi v0.0.0-20240103051144-eec4567ac022/go.mod h1:sIV51WBTkZrlGOJMCDZDA1IaPBUDTulPpD4y7oe038k= +k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ= +k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/controller-runtime v0.16.3 h1:2TuvuokmfXvDUamSx1SuAOO3eTyye+47mJCigwG62c4= sigs.k8s.io/controller-runtime v0.16.3/go.mod h1:j7bialYoSn142nv9sCOJmQgDXQXxnroFU4VnX/brVJ0= +sigs.k8s.io/gateway-api v1.0.0 h1:iPTStSv41+d9p0xFydll6d7f7MOBGuqXM6p2/zVYMAs= +sigs.k8s.io/gateway-api v1.0.0/go.mod h1:4cUgr0Lnp5FZ0Cdq8FdRwCvpiWws7LVhLHGIudLlf4c= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/secrets-store-csi-driver v1.4.0 h1:R9JVcKOs11fEuiOLlH1BWMeyb6WYzvElRVkq1BWJkr4= From 6ba1912b80ea2de724f8d75f5800a43aa7b42447 Mon Sep 17 00:00:00 2001 From: Sergey Smolnikov Date: Fri, 19 Apr 2024 11:15:43 +0200 Subject: [PATCH 3/3] add-pipeline-job-apply-config (#93) * Added apply-config pipeline-job type * Updated radix-operator version --- cmd/createApplyConfigPipelineJob.go | 93 +++++++ .../client/application/application_client.go | 41 ++++ ...rigger_pipeline_apply_config_parameters.go | 225 +++++++++++++++++ ...trigger_pipeline_apply_config_responses.go | 227 ++++++++++++++++++ .../client/job/job_log_parameters.go | 34 +++ generated-client/models/application.go | 62 +++++ generated-client/models/component.go | 62 ++++- generated-client/models/component_summary.go | 71 +++++- generated-client/models/dns_external_alias.go | 108 +++++++++ generated-client/models/job.go | 4 - .../pipeline_parameters_apply_config.go | 51 ++++ generated-client/models/replica_status.go | 14 +- generated-client/models/replica_summary.go | 87 +++++++ .../models/scheduled_job_summary.go | 7 +- generated-client/models/tls.go | 51 ++++ generated-client/models/tls_automation.go | 117 +++++++++ go.mod | 2 +- go.sum | 4 +- 18 files changed, 1246 insertions(+), 14 deletions(-) create mode 100644 cmd/createApplyConfigPipelineJob.go create mode 100644 generated-client/client/application/trigger_pipeline_apply_config_parameters.go create mode 100644 generated-client/client/application/trigger_pipeline_apply_config_responses.go create mode 100644 generated-client/models/dns_external_alias.go create mode 100644 generated-client/models/pipeline_parameters_apply_config.go create mode 100644 generated-client/models/tls_automation.go diff --git a/cmd/createApplyConfigPipelineJob.go b/cmd/createApplyConfigPipelineJob.go new file mode 100644 index 0000000..b0dc914 --- /dev/null +++ b/cmd/createApplyConfigPipelineJob.go @@ -0,0 +1,93 @@ +// Copyright © 2023 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd + +import ( + "errors" + + "github.com/equinor/radix-cli/generated-client/client/application" + "github.com/equinor/radix-cli/generated-client/models" + "github.com/equinor/radix-cli/pkg/client" + "github.com/equinor/radix-cli/pkg/flagnames" + log "github.com/sirupsen/logrus" + "github.com/spf13/cobra" +) + +var createApplyConfigPipelineJobCmd = &cobra.Command{ + Use: "apply-config", + Short: "Will trigger apply-config of a Radix application", + Long: "Triggers applyConfig of a Radix application according to the radix config in its repository's master branch.", + Example: ` # Create a Radix pipeline apply-config job to apply the radixconfig properties without re-building or re-deploying components. +Currently applied changes in properties DNS alias, build secrets, create new or soft-delete existing environments. + rx create job apply-config --application radix-test + + # Create a Radix pipeline applyConfig-only job, short option versions + rx create job apply-config -a radix-test`, + RunE: func(cmd *cobra.Command, args []string) error { + var errs []error + appName, err := getAppNameFromConfigOrFromParameter(cmd, flagnames.Application) + if err != nil { + errs = append(errs, err) + } + triggeredByUser, err := cmd.Flags().GetString(flagnames.User) + if err != nil { + errs = append(errs, err) + } + follow, err := cmd.Flags().GetBool(flagnames.Follow) + if err != nil { + errs = append(errs, err) + } + if len(errs) > 0 { + return errors.Join(errs...) + } + if appName == nil || *appName == "" { + return errors.New("application name is required") + } + + cmd.SilenceUsage = true + + apiClient, err := client.GetForCommand(cmd) + if err != nil { + return err + } + + triggerPipelineParams := application.NewTriggerPipelineApplyConfigParams() + triggerPipelineParams.SetAppName(*appName) + parametersApplyConfig := models.PipelineParametersApplyConfig{ + TriggeredBy: triggeredByUser, + } + triggerPipelineParams.SetPipelineParametersApplyConfig(¶metersApplyConfig) + + newJob, err := apiClient.Application.TriggerPipelineApplyConfig(triggerPipelineParams, nil) + if err != nil { + return err + } + + jobName := newJob.GetPayload().Name + log.Infof("Apply-config pipeline job triggered with the name %s\n", jobName) + if !follow { + return nil + } + return getLogsJob(cmd, apiClient, *appName, jobName) + }, +} + +func init() { + createJobCmd.AddCommand(createApplyConfigPipelineJobCmd) + createApplyConfigPipelineJobCmd.Flags().StringP(flagnames.Application, "a", "", "Name of the application to apply-config") + createApplyConfigPipelineJobCmd.Flags().StringP(flagnames.User, "u", "", "The user who triggered the apply-config") + createApplyConfigPipelineJobCmd.Flags().BoolP(flagnames.Follow, "f", false, "Follow applyConfig") + setContextSpecificPersistentFlags(createApplyConfigPipelineJobCmd) +} diff --git a/generated-client/client/application/application_client.go b/generated-client/client/application/application_client.go index 4474959..6ac7f93 100644 --- a/generated-client/client/application/application_client.go +++ b/generated-client/client/application/application_client.go @@ -64,6 +64,8 @@ type ClientService interface { StopApplication(params *StopApplicationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StopApplicationOK, error) + TriggerPipelineApplyConfig(params *TriggerPipelineApplyConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TriggerPipelineApplyConfigOK, error) + TriggerPipelineBuild(params *TriggerPipelineBuildParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TriggerPipelineBuildOK, error) TriggerPipelineBuildDeploy(params *TriggerPipelineBuildDeployParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TriggerPipelineBuildDeployOK, error) @@ -744,6 +746,45 @@ func (a *Client) StopApplication(params *StopApplicationParams, authInfo runtime panic(msg) } +/* +TriggerPipelineApplyConfig runs a apply config pipeline for a given application +*/ +func (a *Client) TriggerPipelineApplyConfig(params *TriggerPipelineApplyConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TriggerPipelineApplyConfigOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewTriggerPipelineApplyConfigParams() + } + op := &runtime.ClientOperation{ + ID: "triggerPipelineApplyConfig", + Method: "POST", + PathPattern: "/applications/{appName}/pipelines/apply-config", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &TriggerPipelineApplyConfigReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*TriggerPipelineApplyConfigOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for triggerPipelineApplyConfig: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* TriggerPipelineBuild runs a build pipeline for a given application and branch */ diff --git a/generated-client/client/application/trigger_pipeline_apply_config_parameters.go b/generated-client/client/application/trigger_pipeline_apply_config_parameters.go new file mode 100644 index 0000000..ec1e9c4 --- /dev/null +++ b/generated-client/client/application/trigger_pipeline_apply_config_parameters.go @@ -0,0 +1,225 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/equinor/radix-cli/generated-client/models" +) + +// NewTriggerPipelineApplyConfigParams creates a new TriggerPipelineApplyConfigParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewTriggerPipelineApplyConfigParams() *TriggerPipelineApplyConfigParams { + return &TriggerPipelineApplyConfigParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewTriggerPipelineApplyConfigParamsWithTimeout creates a new TriggerPipelineApplyConfigParams object +// with the ability to set a timeout on a request. +func NewTriggerPipelineApplyConfigParamsWithTimeout(timeout time.Duration) *TriggerPipelineApplyConfigParams { + return &TriggerPipelineApplyConfigParams{ + timeout: timeout, + } +} + +// NewTriggerPipelineApplyConfigParamsWithContext creates a new TriggerPipelineApplyConfigParams object +// with the ability to set a context for a request. +func NewTriggerPipelineApplyConfigParamsWithContext(ctx context.Context) *TriggerPipelineApplyConfigParams { + return &TriggerPipelineApplyConfigParams{ + Context: ctx, + } +} + +// NewTriggerPipelineApplyConfigParamsWithHTTPClient creates a new TriggerPipelineApplyConfigParams object +// with the ability to set a custom HTTPClient for a request. +func NewTriggerPipelineApplyConfigParamsWithHTTPClient(client *http.Client) *TriggerPipelineApplyConfigParams { + return &TriggerPipelineApplyConfigParams{ + HTTPClient: client, + } +} + +/* +TriggerPipelineApplyConfigParams contains all the parameters to send to the API endpoint + + for the trigger pipeline apply config operation. + + Typically these are written to a http.Request. +*/ +type TriggerPipelineApplyConfigParams struct { + + /* ImpersonateGroup. + + Works only with custom setup of cluster. Allow impersonation of a comma-seperated list of test groups (Required if Impersonate-User is set) + */ + ImpersonateGroup *string + + /* ImpersonateUser. + + Works only with custom setup of cluster. Allow impersonation of test users (Required if Impersonate-Group is set) + */ + ImpersonateUser *string + + /* PipelineParametersApplyConfig. + + Pipeline parameters + */ + PipelineParametersApplyConfig *models.PipelineParametersApplyConfig + + /* AppName. + + Name of application + */ + AppName string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the trigger pipeline apply config params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TriggerPipelineApplyConfigParams) WithDefaults() *TriggerPipelineApplyConfigParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the trigger pipeline apply config params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TriggerPipelineApplyConfigParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the trigger pipeline apply config params +func (o *TriggerPipelineApplyConfigParams) WithTimeout(timeout time.Duration) *TriggerPipelineApplyConfigParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the trigger pipeline apply config params +func (o *TriggerPipelineApplyConfigParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the trigger pipeline apply config params +func (o *TriggerPipelineApplyConfigParams) WithContext(ctx context.Context) *TriggerPipelineApplyConfigParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the trigger pipeline apply config params +func (o *TriggerPipelineApplyConfigParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the trigger pipeline apply config params +func (o *TriggerPipelineApplyConfigParams) WithHTTPClient(client *http.Client) *TriggerPipelineApplyConfigParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the trigger pipeline apply config params +func (o *TriggerPipelineApplyConfigParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithImpersonateGroup adds the impersonateGroup to the trigger pipeline apply config params +func (o *TriggerPipelineApplyConfigParams) WithImpersonateGroup(impersonateGroup *string) *TriggerPipelineApplyConfigParams { + o.SetImpersonateGroup(impersonateGroup) + return o +} + +// SetImpersonateGroup adds the impersonateGroup to the trigger pipeline apply config params +func (o *TriggerPipelineApplyConfigParams) SetImpersonateGroup(impersonateGroup *string) { + o.ImpersonateGroup = impersonateGroup +} + +// WithImpersonateUser adds the impersonateUser to the trigger pipeline apply config params +func (o *TriggerPipelineApplyConfigParams) WithImpersonateUser(impersonateUser *string) *TriggerPipelineApplyConfigParams { + o.SetImpersonateUser(impersonateUser) + return o +} + +// SetImpersonateUser adds the impersonateUser to the trigger pipeline apply config params +func (o *TriggerPipelineApplyConfigParams) SetImpersonateUser(impersonateUser *string) { + o.ImpersonateUser = impersonateUser +} + +// WithPipelineParametersApplyConfig adds the pipelineParametersApplyConfig to the trigger pipeline apply config params +func (o *TriggerPipelineApplyConfigParams) WithPipelineParametersApplyConfig(pipelineParametersApplyConfig *models.PipelineParametersApplyConfig) *TriggerPipelineApplyConfigParams { + o.SetPipelineParametersApplyConfig(pipelineParametersApplyConfig) + return o +} + +// SetPipelineParametersApplyConfig adds the pipelineParametersApplyConfig to the trigger pipeline apply config params +func (o *TriggerPipelineApplyConfigParams) SetPipelineParametersApplyConfig(pipelineParametersApplyConfig *models.PipelineParametersApplyConfig) { + o.PipelineParametersApplyConfig = pipelineParametersApplyConfig +} + +// WithAppName adds the appName to the trigger pipeline apply config params +func (o *TriggerPipelineApplyConfigParams) WithAppName(appName string) *TriggerPipelineApplyConfigParams { + o.SetAppName(appName) + return o +} + +// SetAppName adds the appName to the trigger pipeline apply config params +func (o *TriggerPipelineApplyConfigParams) SetAppName(appName string) { + o.AppName = appName +} + +// WriteToRequest writes these params to a swagger request +func (o *TriggerPipelineApplyConfigParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ImpersonateGroup != nil { + + // header param Impersonate-Group + if err := r.SetHeaderParam("Impersonate-Group", *o.ImpersonateGroup); err != nil { + return err + } + } + + if o.ImpersonateUser != nil { + + // header param Impersonate-User + if err := r.SetHeaderParam("Impersonate-User", *o.ImpersonateUser); err != nil { + return err + } + } + if o.PipelineParametersApplyConfig != nil { + if err := r.SetBodyParam(o.PipelineParametersApplyConfig); err != nil { + return err + } + } + + // path param appName + if err := r.SetPathParam("appName", o.AppName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/generated-client/client/application/trigger_pipeline_apply_config_responses.go b/generated-client/client/application/trigger_pipeline_apply_config_responses.go new file mode 100644 index 0000000..7587344 --- /dev/null +++ b/generated-client/client/application/trigger_pipeline_apply_config_responses.go @@ -0,0 +1,227 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package application + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/equinor/radix-cli/generated-client/models" +) + +// TriggerPipelineApplyConfigReader is a Reader for the TriggerPipelineApplyConfig structure. +type TriggerPipelineApplyConfigReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *TriggerPipelineApplyConfigReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewTriggerPipelineApplyConfigOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 403: + result := NewTriggerPipelineApplyConfigForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewTriggerPipelineApplyConfigNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /applications/{appName}/pipelines/apply-config] triggerPipelineApplyConfig", response, response.Code()) + } +} + +// NewTriggerPipelineApplyConfigOK creates a TriggerPipelineApplyConfigOK with default headers values +func NewTriggerPipelineApplyConfigOK() *TriggerPipelineApplyConfigOK { + return &TriggerPipelineApplyConfigOK{} +} + +/* +TriggerPipelineApplyConfigOK describes a response with status code 200, with default header values. + +Successful trigger pipeline +*/ +type TriggerPipelineApplyConfigOK struct { + Payload *models.JobSummary +} + +// IsSuccess returns true when this trigger pipeline apply config o k response has a 2xx status code +func (o *TriggerPipelineApplyConfigOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this trigger pipeline apply config o k response has a 3xx status code +func (o *TriggerPipelineApplyConfigOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this trigger pipeline apply config o k response has a 4xx status code +func (o *TriggerPipelineApplyConfigOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this trigger pipeline apply config o k response has a 5xx status code +func (o *TriggerPipelineApplyConfigOK) IsServerError() bool { + return false +} + +// IsCode returns true when this trigger pipeline apply config o k response a status code equal to that given +func (o *TriggerPipelineApplyConfigOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the trigger pipeline apply config o k response +func (o *TriggerPipelineApplyConfigOK) Code() int { + return 200 +} + +func (o *TriggerPipelineApplyConfigOK) Error() string { + return fmt.Sprintf("[POST /applications/{appName}/pipelines/apply-config][%d] triggerPipelineApplyConfigOK %+v", 200, o.Payload) +} + +func (o *TriggerPipelineApplyConfigOK) String() string { + return fmt.Sprintf("[POST /applications/{appName}/pipelines/apply-config][%d] triggerPipelineApplyConfigOK %+v", 200, o.Payload) +} + +func (o *TriggerPipelineApplyConfigOK) GetPayload() *models.JobSummary { + return o.Payload +} + +func (o *TriggerPipelineApplyConfigOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.JobSummary) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewTriggerPipelineApplyConfigForbidden creates a TriggerPipelineApplyConfigForbidden with default headers values +func NewTriggerPipelineApplyConfigForbidden() *TriggerPipelineApplyConfigForbidden { + return &TriggerPipelineApplyConfigForbidden{} +} + +/* +TriggerPipelineApplyConfigForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type TriggerPipelineApplyConfigForbidden struct { +} + +// IsSuccess returns true when this trigger pipeline apply config forbidden response has a 2xx status code +func (o *TriggerPipelineApplyConfigForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this trigger pipeline apply config forbidden response has a 3xx status code +func (o *TriggerPipelineApplyConfigForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this trigger pipeline apply config forbidden response has a 4xx status code +func (o *TriggerPipelineApplyConfigForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this trigger pipeline apply config forbidden response has a 5xx status code +func (o *TriggerPipelineApplyConfigForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this trigger pipeline apply config forbidden response a status code equal to that given +func (o *TriggerPipelineApplyConfigForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the trigger pipeline apply config forbidden response +func (o *TriggerPipelineApplyConfigForbidden) Code() int { + return 403 +} + +func (o *TriggerPipelineApplyConfigForbidden) Error() string { + return fmt.Sprintf("[POST /applications/{appName}/pipelines/apply-config][%d] triggerPipelineApplyConfigForbidden ", 403) +} + +func (o *TriggerPipelineApplyConfigForbidden) String() string { + return fmt.Sprintf("[POST /applications/{appName}/pipelines/apply-config][%d] triggerPipelineApplyConfigForbidden ", 403) +} + +func (o *TriggerPipelineApplyConfigForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTriggerPipelineApplyConfigNotFound creates a TriggerPipelineApplyConfigNotFound with default headers values +func NewTriggerPipelineApplyConfigNotFound() *TriggerPipelineApplyConfigNotFound { + return &TriggerPipelineApplyConfigNotFound{} +} + +/* +TriggerPipelineApplyConfigNotFound describes a response with status code 404, with default header values. + +Not found +*/ +type TriggerPipelineApplyConfigNotFound struct { +} + +// IsSuccess returns true when this trigger pipeline apply config not found response has a 2xx status code +func (o *TriggerPipelineApplyConfigNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this trigger pipeline apply config not found response has a 3xx status code +func (o *TriggerPipelineApplyConfigNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this trigger pipeline apply config not found response has a 4xx status code +func (o *TriggerPipelineApplyConfigNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this trigger pipeline apply config not found response has a 5xx status code +func (o *TriggerPipelineApplyConfigNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this trigger pipeline apply config not found response a status code equal to that given +func (o *TriggerPipelineApplyConfigNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the trigger pipeline apply config not found response +func (o *TriggerPipelineApplyConfigNotFound) Code() int { + return 404 +} + +func (o *TriggerPipelineApplyConfigNotFound) Error() string { + return fmt.Sprintf("[POST /applications/{appName}/pipelines/apply-config][%d] triggerPipelineApplyConfigNotFound ", 404) +} + +func (o *TriggerPipelineApplyConfigNotFound) String() string { + return fmt.Sprintf("[POST /applications/{appName}/pipelines/apply-config][%d] triggerPipelineApplyConfigNotFound ", 404) +} + +func (o *TriggerPipelineApplyConfigNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/generated-client/client/job/job_log_parameters.go b/generated-client/client/job/job_log_parameters.go index d7228db..2ae7c0f 100644 --- a/generated-client/client/job/job_log_parameters.go +++ b/generated-client/client/job/job_log_parameters.go @@ -107,6 +107,12 @@ type JobLogParams struct { */ Lines *string + /* ReplicaName. + + Name of the job replica + */ + ReplicaName *string + /* ScheduledJobName. Name of scheduled job @@ -251,6 +257,17 @@ func (o *JobLogParams) SetLines(lines *string) { o.Lines = lines } +// WithReplicaName adds the replicaName to the job log params +func (o *JobLogParams) WithReplicaName(replicaName *string) *JobLogParams { + o.SetReplicaName(replicaName) + return o +} + +// SetReplicaName adds the replicaName to the job log params +func (o *JobLogParams) SetReplicaName(replicaName *string) { + o.ReplicaName = replicaName +} + // WithScheduledJobName adds the scheduledJobName to the job log params func (o *JobLogParams) WithScheduledJobName(scheduledJobName string) *JobLogParams { o.SetScheduledJobName(scheduledJobName) @@ -346,6 +363,23 @@ func (o *JobLogParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regist } } + if o.ReplicaName != nil { + + // query param replicaName + var qrReplicaName string + + if o.ReplicaName != nil { + qrReplicaName = *o.ReplicaName + } + qReplicaName := qrReplicaName + if qReplicaName != "" { + + if err := r.SetQueryParam("replicaName", qReplicaName); err != nil { + return err + } + } + } + // path param scheduledJobName if err := r.SetPathParam("scheduledJobName", o.ScheduledJobName); err != nil { return err diff --git a/generated-client/models/application.go b/generated-client/models/application.go index e9caeba..c58ec48 100644 --- a/generated-client/models/application.go +++ b/generated-client/models/application.go @@ -23,6 +23,9 @@ type Application struct { // DNS aliases showing nicer endpoint for application, without "app." subdomain domain DNSAliases []*DNSAlias `json:"dnsAliases"` + // List of external DNS names and which component and environment incoming requests shall be routed to. + DNSExternalAliases []*DNSExternalAlias `json:"dnsExternalAliases"` + // Environments List of environments for this application Environments []*EnvironmentSummary `json:"environments"` @@ -52,6 +55,10 @@ func (m *Application) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateDNSExternalAliases(formats); err != nil { + res = append(res, err) + } + if err := m.validateEnvironments(formats); err != nil { res = append(res, err) } @@ -104,6 +111,32 @@ func (m *Application) validateDNSAliases(formats strfmt.Registry) error { return nil } +func (m *Application) validateDNSExternalAliases(formats strfmt.Registry) error { + if swag.IsZero(m.DNSExternalAliases) { // not required + return nil + } + + for i := 0; i < len(m.DNSExternalAliases); i++ { + if swag.IsZero(m.DNSExternalAliases[i]) { // not required + continue + } + + if m.DNSExternalAliases[i] != nil { + if err := m.DNSExternalAliases[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dnsExternalAliases" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dnsExternalAliases" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + func (m *Application) validateEnvironments(formats strfmt.Registry) error { if swag.IsZero(m.Environments) { // not required return nil @@ -211,6 +244,10 @@ func (m *Application) ContextValidate(ctx context.Context, formats strfmt.Regist res = append(res, err) } + if err := m.contextValidateDNSExternalAliases(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateEnvironments(ctx, formats); err != nil { res = append(res, err) } @@ -258,6 +295,31 @@ func (m *Application) contextValidateDNSAliases(ctx context.Context, formats str return nil } +func (m *Application) contextValidateDNSExternalAliases(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.DNSExternalAliases); i++ { + + if m.DNSExternalAliases[i] != nil { + + if swag.IsZero(m.DNSExternalAliases[i]) { // not required + return nil + } + + if err := m.DNSExternalAliases[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dnsExternalAliases" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dnsExternalAliases" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + func (m *Application) contextValidateEnvironments(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Environments); i++ { diff --git a/generated-client/models/component.go b/generated-client/models/component.go index d6ea085..f9d3f95 100644 --- a/generated-client/models/component.go +++ b/generated-client/models/component.go @@ -22,11 +22,16 @@ import ( type Component struct { // Commit ID for the component. It can be different from the Commit ID, specified in deployment label - CommitID string `json:"CommitID,omitempty"` + // Example: 4faca8595c5283a9d0f17a623b9255a0d9866a2e + CommitID string `json:"commitID,omitempty"` // Array of external DNS configurations ExternalDNS []*ExternalDNS `json:"externalDNS"` + // GitTags the git tags that the git commit hash points to + // Example: \"v1.22.1 v1.22.3\ + GitTags string `json:"gitTags,omitempty"` + // Image name // Example: radixdev.azurecr.io/app-server:cdgkg // Required: true @@ -59,6 +64,10 @@ type Component struct { // Example: ["DB_CON","A_SECRET"] Secrets []string `json:"secrets"` + // SkipDeployment The component should not be deployed, but used existing + // Example: true + SkipDeployment bool `json:"skipDeployment,omitempty"` + // Status of the component // Example: Consistent // Enum: [Stopped Consistent Reconciling Restarting Outdated] @@ -84,6 +93,9 @@ type Component struct { // oauth2 Oauth2 *OAuth2AuxiliaryResource `json:"oauth2,omitempty"` + + // resources + Resources *ResourceRequirements `json:"resources,omitempty"` } // Validate validates this component @@ -134,6 +146,10 @@ func (m *Component) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateResources(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -406,6 +422,25 @@ func (m *Component) validateOauth2(formats strfmt.Registry) error { return nil } +func (m *Component) validateResources(formats strfmt.Registry) error { + if swag.IsZero(m.Resources) { // not required + return nil + } + + if m.Resources != nil { + if err := m.Resources.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("resources") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("resources") + } + return err + } + } + + return nil +} + // ContextValidate validate this component based on the context it is used func (m *Component) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -438,6 +473,10 @@ func (m *Component) ContextValidate(ctx context.Context, formats strfmt.Registry res = append(res, err) } + if err := m.contextValidateResources(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -603,6 +642,27 @@ func (m *Component) contextValidateOauth2(ctx context.Context, formats strfmt.Re return nil } +func (m *Component) contextValidateResources(ctx context.Context, formats strfmt.Registry) error { + + if m.Resources != nil { + + if swag.IsZero(m.Resources) { // not required + return nil + } + + if err := m.Resources.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("resources") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("resources") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Component) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/generated-client/models/component_summary.go b/generated-client/models/component_summary.go index 7900a4c..09986cd 100644 --- a/generated-client/models/component_summary.go +++ b/generated-client/models/component_summary.go @@ -20,6 +20,15 @@ import ( // swagger:model ComponentSummary type ComponentSummary struct { + // CommitID the commit ID of the branch to build + // REQUIRED for "build" and "build-deploy" pipelines + // Example: 4faca8595c5283a9d0f17a623b9255a0d9866a2e + CommitID string `json:"commitID,omitempty"` + + // GitTags the git tags that the git commit hash points to + // Example: \"v1.22.1 v1.22.3\ + GitTags string `json:"gitTags,omitempty"` + // Image name // Example: radixdev.azurecr.io/app-server:cdgkg // Required: true @@ -30,11 +39,18 @@ type ComponentSummary struct { // Required: true Name *string `json:"name"` + // SkipDeployment The component should not be deployed, but used existing + // Example: true + SkipDeployment bool `json:"skipDeployment,omitempty"` + // Type of component // Example: component // Required: true // Enum: [component job] Type *string `json:"type"` + + // resources + Resources *ResourceRequirements `json:"resources,omitempty"` } // Validate validates this component summary @@ -53,6 +69,10 @@ func (m *ComponentSummary) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateResources(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -120,8 +140,57 @@ func (m *ComponentSummary) validateType(formats strfmt.Registry) error { return nil } -// ContextValidate validates this component summary based on context it is used +func (m *ComponentSummary) validateResources(formats strfmt.Registry) error { + if swag.IsZero(m.Resources) { // not required + return nil + } + + if m.Resources != nil { + if err := m.Resources.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("resources") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("resources") + } + return err + } + } + + return nil +} + +// ContextValidate validate this component summary based on the context it is used func (m *ComponentSummary) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResources(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ComponentSummary) contextValidateResources(ctx context.Context, formats strfmt.Registry) error { + + if m.Resources != nil { + + if swag.IsZero(m.Resources) { // not required + return nil + } + + if err := m.Resources.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("resources") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("resources") + } + return err + } + } + return nil } diff --git a/generated-client/models/dns_external_alias.go b/generated-client/models/dns_external_alias.go new file mode 100644 index 0000000..2d5ba59 --- /dev/null +++ b/generated-client/models/dns_external_alias.go @@ -0,0 +1,108 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// DNSExternalAlias DNSExternalAlias holds public external DNS alias information +// +// swagger:model DNSExternalAlias +type DNSExternalAlias struct { + + // ComponentName the component exposing the endpoint + // Example: frontend + // Required: true + ComponentName *string `json:"componentName"` + + // EnvironmentName the environment hosting the endpoint + // Example: prod + // Required: true + EnvironmentName *string `json:"environmentName"` + + // URL the public endpoint + // Example: https://my-app.equinor.com + // Required: true + URL *string `json:"url"` +} + +// Validate validates this DNS external alias +func (m *DNSExternalAlias) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateComponentName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEnvironmentName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateURL(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DNSExternalAlias) validateComponentName(formats strfmt.Registry) error { + + if err := validate.Required("componentName", "body", m.ComponentName); err != nil { + return err + } + + return nil +} + +func (m *DNSExternalAlias) validateEnvironmentName(formats strfmt.Registry) error { + + if err := validate.Required("environmentName", "body", m.EnvironmentName); err != nil { + return err + } + + return nil +} + +func (m *DNSExternalAlias) validateURL(formats strfmt.Registry) error { + + if err := validate.Required("url", "body", m.URL); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this DNS external alias based on context it is used +func (m *DNSExternalAlias) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *DNSExternalAlias) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DNSExternalAlias) UnmarshalBinary(b []byte) error { + var res DNSExternalAlias + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/generated-client/models/job.go b/generated-client/models/job.go index 9f1884a..489e8c6 100644 --- a/generated-client/models/job.go +++ b/generated-client/models/job.go @@ -34,10 +34,6 @@ type Job struct { // Deprecated: Inspect each deployment to get list of components created by the job Components []*ComponentSummary `json:"components"` - // ComponentsToDeploy List of components to deploy - // OPTIONAL If specified, only these components are deployed - ComponentsToDeploy []string `json:"componentsToDeploy"` - // Created timestamp // Example: 2006-01-02T15:04:05Z Created string `json:"created,omitempty"` diff --git a/generated-client/models/pipeline_parameters_apply_config.go b/generated-client/models/pipeline_parameters_apply_config.go new file mode 100644 index 0000000..a8cc72d --- /dev/null +++ b/generated-client/models/pipeline_parameters_apply_config.go @@ -0,0 +1,51 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PipelineParametersApplyConfig PipelineParametersApplyConfig describes base info +// +// swagger:model PipelineParametersApplyConfig +type PipelineParametersApplyConfig struct { + + // TriggeredBy of the job - if empty will use user token upn (user principle name) + // Example: a_user@equinor.com + TriggeredBy string `json:"triggeredBy,omitempty"` +} + +// Validate validates this pipeline parameters apply config +func (m *PipelineParametersApplyConfig) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this pipeline parameters apply config based on context it is used +func (m *PipelineParametersApplyConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PipelineParametersApplyConfig) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PipelineParametersApplyConfig) UnmarshalBinary(b []byte) error { + var res PipelineParametersApplyConfig + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/generated-client/models/replica_status.go b/generated-client/models/replica_status.go index f241f5f..bac6fef 100644 --- a/generated-client/models/replica_status.go +++ b/generated-client/models/replica_status.go @@ -22,12 +22,14 @@ type ReplicaStatus struct { // Status of the container // Pending = Container in Waiting state and the reason is ContainerCreating - // Failing = Container in Waiting state and the reason is anything else but ContainerCreating + // Failed = Container is failed + // Failing = Container is failed // Running = Container in Running state + // Succeeded = Container in Succeeded state // Terminated = Container in Terminated state // Example: Running // Required: true - // Enum: [Pending Failing Running Terminated Starting] + // Enum: [Pending Succeeded Failing Failed Running Terminated Starting] Status *string `json:"status"` } @@ -49,7 +51,7 @@ var replicaStatusTypeStatusPropEnum []interface{} func init() { var res []string - if err := json.Unmarshal([]byte(`["Pending","Failing","Running","Terminated","Starting"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["Pending","Succeeded","Failing","Failed","Running","Terminated","Starting"]`), &res); err != nil { panic(err) } for _, v := range res { @@ -62,9 +64,15 @@ const ( // ReplicaStatusStatusPending captures enum value "Pending" ReplicaStatusStatusPending string = "Pending" + // ReplicaStatusStatusSucceeded captures enum value "Succeeded" + ReplicaStatusStatusSucceeded string = "Succeeded" + // ReplicaStatusStatusFailing captures enum value "Failing" ReplicaStatusStatusFailing string = "Failing" + // ReplicaStatusStatusFailed captures enum value "Failed" + ReplicaStatusStatusFailed string = "Failed" + // ReplicaStatusStatusRunning captures enum value "Running" ReplicaStatusStatusRunning string = "Running" diff --git a/generated-client/models/replica_summary.go b/generated-client/models/replica_summary.go index 43eef4c..69015e3 100644 --- a/generated-client/models/replica_summary.go +++ b/generated-client/models/replica_summary.go @@ -7,6 +7,7 @@ package models import ( "context" + "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" @@ -27,6 +28,13 @@ type ReplicaSummary struct { // Example: 2006-01-02T15:04:05Z Created string `json:"created,omitempty"` + // The time at which the batch job's pod finishedAt. + // Example: 2006-01-02T15:04:05Z + EndTime string `json:"endTime,omitempty"` + + // Exit status from the last termination of the container + ExitCode int32 `json:"exitCode,omitempty"` + // The image the container is running. // Example: radixdev.azurecr.io/app-server:cdgkg Image string `json:"image,omitempty"` @@ -40,12 +48,33 @@ type ReplicaSummary struct { // Required: true Name *string `json:"name"` + // The index of the pod in the re-starts + PodIndex int64 `json:"podIndex,omitempty"` + + // A brief CamelCase message indicating details about why the job is in this phase + Reason string `json:"reason,omitempty"` + // RestartCount count of restarts of a component container inside a pod RestartCount int32 `json:"restartCount,omitempty"` + // The time at which the batch job's pod startedAt + // Example: 2006-01-02T15:04:05Z + StartTime string `json:"startTime,omitempty"` + // StatusMessage provides message describing the status of a component container inside a pod StatusMessage string `json:"statusMessage,omitempty"` + // Pod type + // ComponentReplica = Replica of a Radix component + // ScheduledJobReplica = Replica of a Radix job-component + // JobManager = Replica of a Radix job-component scheduler + // JobManagerAux = Replica of a Radix job-component scheduler auxiliary + // OAuth2 = Replica of a Radix OAuth2 component + // Undefined = Replica without defined type - to be extended + // Example: ComponentReplica + // Enum: [ComponentReplica ScheduledJobReplica JobManager JobManagerAux OAuth2 Undefined] + Type string `json:"type,omitempty"` + // replica status ReplicaStatus *ReplicaStatus `json:"replicaStatus,omitempty"` @@ -61,6 +90,10 @@ func (m *ReplicaSummary) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateType(formats); err != nil { + res = append(res, err) + } + if err := m.validateReplicaStatus(formats); err != nil { res = append(res, err) } @@ -84,6 +117,60 @@ func (m *ReplicaSummary) validateName(formats strfmt.Registry) error { return nil } +var replicaSummaryTypeTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["ComponentReplica","ScheduledJobReplica","JobManager","JobManagerAux","OAuth2","Undefined"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + replicaSummaryTypeTypePropEnum = append(replicaSummaryTypeTypePropEnum, v) + } +} + +const ( + + // ReplicaSummaryTypeComponentReplica captures enum value "ComponentReplica" + ReplicaSummaryTypeComponentReplica string = "ComponentReplica" + + // ReplicaSummaryTypeScheduledJobReplica captures enum value "ScheduledJobReplica" + ReplicaSummaryTypeScheduledJobReplica string = "ScheduledJobReplica" + + // ReplicaSummaryTypeJobManager captures enum value "JobManager" + ReplicaSummaryTypeJobManager string = "JobManager" + + // ReplicaSummaryTypeJobManagerAux captures enum value "JobManagerAux" + ReplicaSummaryTypeJobManagerAux string = "JobManagerAux" + + // ReplicaSummaryTypeOAuth2 captures enum value "OAuth2" + ReplicaSummaryTypeOAuth2 string = "OAuth2" + + // ReplicaSummaryTypeUndefined captures enum value "Undefined" + ReplicaSummaryTypeUndefined string = "Undefined" +) + +// prop value enum +func (m *ReplicaSummary) validateTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, replicaSummaryTypeTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *ReplicaSummary) validateType(formats strfmt.Registry) error { + if swag.IsZero(m.Type) { // not required + return nil + } + + // value enum + if err := m.validateTypeEnum("type", "body", m.Type); err != nil { + return err + } + + return nil +} + func (m *ReplicaSummary) validateReplicaStatus(formats strfmt.Registry) error { if swag.IsZero(m.ReplicaStatus) { // not required return nil diff --git a/generated-client/models/scheduled_job_summary.go b/generated-client/models/scheduled_job_summary.go index 1210de5..c39dd08 100644 --- a/generated-client/models/scheduled_job_summary.go +++ b/generated-client/models/scheduled_job_summary.go @@ -72,7 +72,7 @@ type ScheduledJobSummary struct { // Status of the job // Example: Waiting // Required: true - // Enum: [Running Succeeded Failed Waiting Stopping Stopped] + // Enum: [Running Active Succeeded Failed Waiting Stopping Stopped] Status *string `json:"status"` // TimeLimitSeconds How long the job supposed to run at maximum @@ -168,7 +168,7 @@ var scheduledJobSummaryTypeStatusPropEnum []interface{} func init() { var res []string - if err := json.Unmarshal([]byte(`["Running","Succeeded","Failed","Waiting","Stopping","Stopped"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["Running","Active","Succeeded","Failed","Waiting","Stopping","Stopped"]`), &res); err != nil { panic(err) } for _, v := range res { @@ -181,6 +181,9 @@ const ( // ScheduledJobSummaryStatusRunning captures enum value "Running" ScheduledJobSummaryStatusRunning string = "Running" + // ScheduledJobSummaryStatusActive captures enum value "Active" + ScheduledJobSummaryStatusActive string = "Active" + // ScheduledJobSummaryStatusSucceeded captures enum value "Succeeded" ScheduledJobSummaryStatusSucceeded string = "Succeeded" diff --git a/generated-client/models/tls.go b/generated-client/models/tls.go index 31d3421..8156c9d 100644 --- a/generated-client/models/tls.go +++ b/generated-client/models/tls.go @@ -40,6 +40,9 @@ type TLS struct { // UseAutomation describes if TLS certificate is automatically issued using automation (ACME) // Required: true UseAutomation *bool `json:"useAutomation"` + + // automation + Automation *TLSAutomation `json:"automation,omitempty"` } // Validate validates this TLS @@ -58,6 +61,10 @@ func (m *TLS) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateAutomation(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -145,6 +152,25 @@ func (m *TLS) validateUseAutomation(formats strfmt.Registry) error { return nil } +func (m *TLS) validateAutomation(formats strfmt.Registry) error { + if swag.IsZero(m.Automation) { // not required + return nil + } + + if m.Automation != nil { + if err := m.Automation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("automation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("automation") + } + return err + } + } + + return nil +} + // ContextValidate validate this TLS based on the context it is used func (m *TLS) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -153,6 +179,10 @@ func (m *TLS) ContextValidate(ctx context.Context, formats strfmt.Registry) erro res = append(res, err) } + if err := m.contextValidateAutomation(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -184,6 +214,27 @@ func (m *TLS) contextValidateCertificates(ctx context.Context, formats strfmt.Re return nil } +func (m *TLS) contextValidateAutomation(ctx context.Context, formats strfmt.Registry) error { + + if m.Automation != nil { + + if swag.IsZero(m.Automation) { // not required + return nil + } + + if err := m.Automation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("automation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("automation") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TLS) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/generated-client/models/tls_automation.go b/generated-client/models/tls_automation.go new file mode 100644 index 0000000..0429996 --- /dev/null +++ b/generated-client/models/tls_automation.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TLSAutomation TLSAutomation describes the current condition of TLS automation +// +// swagger:model TLSAutomation +type TLSAutomation struct { + + // Message is a human readable description of the reason for the status + Message string `json:"message,omitempty"` + + // Status of certificate automation request + // Pending TLSAutomationPending Certificate automation request pending + // Success TLSAutomationSuccess Certificate automation request succeeded + // Failed TLSAutomationFailed Certificate automation request failed + // Example: Pending + // Required: true + // Enum: [Pending Success Failed] + Status *string `json:"status"` +} + +// Validate validates this TLS automation +func (m *TLSAutomation) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var tlsAutomationTypeStatusPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["Pending","Success","Failed"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + tlsAutomationTypeStatusPropEnum = append(tlsAutomationTypeStatusPropEnum, v) + } +} + +const ( + + // TLSAutomationStatusPending captures enum value "Pending" + TLSAutomationStatusPending string = "Pending" + + // TLSAutomationStatusSuccess captures enum value "Success" + TLSAutomationStatusSuccess string = "Success" + + // TLSAutomationStatusFailed captures enum value "Failed" + TLSAutomationStatusFailed string = "Failed" +) + +// prop value enum +func (m *TLSAutomation) validateStatusEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, tlsAutomationTypeStatusPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *TLSAutomation) validateStatus(formats strfmt.Registry) error { + + if err := validate.Required("status", "body", m.Status); err != nil { + return err + } + + // value enum + if err := m.validateStatusEnum("status", "body", *m.Status); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this TLS automation based on context it is used +func (m *TLSAutomation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TLSAutomation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TLSAutomation) UnmarshalBinary(b []byte) error { + var res TLSAutomation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/go.mod b/go.mod index 7bfd609..addc548 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.21.0 require ( github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 - github.com/equinor/radix-operator v1.50.8 + github.com/equinor/radix-operator v1.51.2 github.com/fatih/color v1.15.0 github.com/go-openapi/errors v0.20.4 github.com/go-openapi/runtime v0.26.2 diff --git a/go.sum b/go.sum index 7862014..a9f2e0e 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxER github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/equinor/radix-common v1.7.1 h1:kl7Tuo2VEo2WHGm/vkvktrZ9t9S3Nht7Mob3CSIzcJI= github.com/equinor/radix-common v1.7.1/go.mod h1:M6mhgHtFQ3rnjJnyOuECXiZOh7XQ5xVeHMyCAU+YPzQ= -github.com/equinor/radix-operator v1.50.8 h1:PC9WxMOHxDzRH/2zboCn1Rq1nSuSpYA2/ylgvTgaTsA= -github.com/equinor/radix-operator v1.50.8/go.mod h1:bLL8hVfdEUuucNRGUit33uBjUhuunpNWO5youmZz8e8= +github.com/equinor/radix-operator v1.51.2 h1:O/FvXfCCPrzdlXpRVXH2rGf4v0sn1uHQxvMn//T5Al0= +github.com/equinor/radix-operator v1.51.2/go.mod h1:bLL8hVfdEUuucNRGUit33uBjUhuunpNWO5youmZz8e8= github.com/evanphx/json-patch v5.7.0+incompatible h1:vgGkfT/9f8zE6tvSCe74nfpAVDQ2tG6yudJd8LBksgI= github.com/evanphx/json-patch v5.7.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=