Skip to content

Commit

Permalink
Add dev mode flag for creating and updating customers (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
divolgin authored Dec 31, 2024
1 parent f34298c commit 82f48c4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
5 changes: 4 additions & 1 deletion cli/cmd/customer_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type createCustomerOpts struct {
IsIdentityServiceSupported bool
IsInstallerSupportEnabled bool
IsSupportBundleUploadEnabled bool
IsDeveloperModeEnabled bool
Email string
CustomerType string
}
Expand Down Expand Up @@ -69,7 +70,7 @@ The --app flag must be set to specify the target application.`,
return r.createCustomer(cmd, opts, outputFormat)
},
SilenceUsage: false,
SilenceErrors: true,
SilenceErrors: false,
}

parent.AddCommand(cmd)
Expand All @@ -89,6 +90,7 @@ The --app flag must be set to specify the target application.`,
cmd.Flags().BoolVar(&opts.IsIdentityServiceSupported, "identity-service", false, "If set, the license will allow Identity Service usage.")
cmd.Flags().BoolVar(&opts.IsInstallerSupportEnabled, "installer-support", false, "If set, the license will allow installer support.")
cmd.Flags().BoolVar(&opts.IsSupportBundleUploadEnabled, "support-bundle-upload", false, "If set, the license will allow uploading support bundles.")
cmd.Flags().BoolVar(&opts.IsDeveloperModeEnabled, "developer-mode", false, "If set, Replicated SDK installed in dev mode will use mock data.")
cmd.Flags().StringVar(&opts.Email, "email", "", "Email address of the customer that is to be created.")
cmd.Flags().StringVar(&opts.CustomerType, "type", "dev", "The license type to create. One of: dev|trial|paid|community|test (default: dev)")
cmd.Flags().StringVar(&outputFormat, "output", "table", "The output format to use. One of: json|table (default: table)")
Expand Down Expand Up @@ -180,6 +182,7 @@ func (r *runners) createCustomer(cmd *cobra.Command, opts createCustomerOpts, ou
IsIdentityServiceSupported: opts.IsIdentityServiceSupported,
IsInstallerSupportEnabled: opts.IsInstallerSupportEnabled,
IsSupportBundleUploadEnabled: opts.IsSupportBundleUploadEnabled,
IsDeveloperModeEnabled: opts.IsDeveloperModeEnabled,
LicenseType: opts.CustomerType,
Email: opts.Email,
}
Expand Down
5 changes: 4 additions & 1 deletion cli/cmd/customer_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type updateCustomerOpts struct {
IsHelmVMDownloadEnabled bool
IsIdentityServiceSupported bool
IsSupportBundleUploadEnabled bool
IsDeveloperModeEnabled bool
Email string
Type string
}
Expand Down Expand Up @@ -68,7 +69,7 @@ func (r *runners) InitCustomerUpdateCommand(parent *cobra.Command) *cobra.Comman
return r.updateCustomer(cmd, opts, outputFormat)
},
SilenceUsage: false,
SilenceErrors: true, // this command uses custom error printing
SilenceErrors: false,
}

parent.AddCommand(cmd)
Expand All @@ -89,6 +90,7 @@ func (r *runners) InitCustomerUpdateCommand(parent *cobra.Command) *cobra.Comman
cmd.Flags().BoolVar(&opts.IsHelmVMDownloadEnabled, "helmvm-cluster-download", false, "If set, the license will allow helmvm cluster downloads.")
cmd.Flags().BoolVar(&opts.IsIdentityServiceSupported, "identity-service", false, "If set, the license will allow Identity Service usage.")
cmd.Flags().BoolVar(&opts.IsSupportBundleUploadEnabled, "support-bundle-upload", false, "If set, the license will allow uploading support bundles.")
cmd.Flags().BoolVar(&opts.IsDeveloperModeEnabled, "developer-mode", false, "If set, Replicated SDK installed in dev mode will use mock data.")
cmd.Flags().StringVar(&opts.Email, "email", "", "Email address of the customer that is to be updated.")
cmd.Flags().StringVar(&opts.Type, "type", "dev", "The license type to update. One of: dev|trial|paid|community|test (default: dev)")
cmd.Flags().StringVar(&outputFormat, "output", "table", "The output format to use. One of: json|table (default: table)")
Expand Down Expand Up @@ -186,6 +188,7 @@ func (r *runners) updateCustomer(cmd *cobra.Command, opts updateCustomerOpts, ou
IsHelmVMDownloadEnabled: opts.IsHelmVMDownloadEnabled,
IsIdentityServiceSupported: opts.IsIdentityServiceSupported,
IsSupportBundleUploadEnabled: opts.IsSupportBundleUploadEnabled,
IsDeveloperModeEnabled: opts.IsDeveloperModeEnabled,
LicenseType: opts.Type,
Email: opts.Email,
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/kotsclient/customer_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type CreateCustomerRequest struct {
IsIdentityServiceSupported bool `json:"is_identity_service_supported"`
IsInstallerSupportEnabled bool `json:"is_installer_support_enabled"`
IsSupportBundleUploadEnabled bool `json:"is_support_bundle_upload_enabled"`
IsDeveloperModeEnabled bool `json:"is_dev_mode_enabled"`
Email string `json:"email,omitempty"`
EntitlementValues []EntitlementValue `json:"entitlementValues"`
}
Expand All @@ -62,6 +63,7 @@ type CreateCustomerOpts struct {
IsIdentityServiceSupported bool
IsInstallerSupportEnabled bool
IsSupportBundleUploadEnabled bool
IsDeveloperModeEnabled bool
LicenseType string
Email string
EntitlementValues []EntitlementValue
Expand All @@ -84,6 +86,7 @@ func (c *VendorV3Client) CreateCustomer(opts CreateCustomerOpts) (*types.Custome
IsIdentityServiceSupported: opts.IsIdentityServiceSupported,
IsInstallerSupportEnabled: opts.IsInstallerSupportEnabled,
IsSupportBundleUploadEnabled: opts.IsSupportBundleUploadEnabled,
IsDeveloperModeEnabled: opts.IsDeveloperModeEnabled,
Email: opts.Email,
EntitlementValues: opts.EntitlementValues,
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/kotsclient/customer_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type UpdateCustomerRequest struct {
IsHelmVMDownloadEnabled bool `json:"is_helm_vm_download_enabled"`
IsIdentityServiceSupported bool `json:"is_identity_service_supported"`
IsSupportBundleUploadEnabled bool `json:"is_support_bundle_upload_enabled"`
IsDeveloperModeEnabled bool `json:"is_dev_mode_enabled"`
Email string `json:"email,omitempty"`
EntitlementValues []EntitlementValue `json:"entitlementValues"`
}
Expand All @@ -50,6 +51,7 @@ type UpdateCustomerOpts struct {
IsHelmVMDownloadEnabled bool
IsIdentityServiceSupported bool
IsSupportBundleUploadEnabled bool
IsDeveloperModeEnabled bool
LicenseType string
Email string
EntitlementValues []EntitlementValue
Expand All @@ -71,6 +73,7 @@ func (c *VendorV3Client) UpdateCustomer(customerID string, opts UpdateCustomerOp
IsHelmVMDownloadEnabled: opts.IsHelmVMDownloadEnabled,
IsIdentityServiceSupported: opts.IsIdentityServiceSupported,
IsSupportBundleUploadEnabled: opts.IsSupportBundleUploadEnabled,
IsDeveloperModeEnabled: opts.IsDeveloperModeEnabled,
Email: opts.Email,
EntitlementValues: opts.EntitlementValues,
}
Expand Down

0 comments on commit 82f48c4

Please sign in to comment.