diff --git a/.tmpl/create.go b/.tmpl/create.go index 67c1b86f4..ea2e314da 100644 --- a/.tmpl/create.go +++ b/.tmpl/create.go @@ -62,6 +62,8 @@ type CreateCommand struct { // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(in io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, Client: c.Globals.Client, Manifest: c.manifest, diff --git a/.tmpl/delete.go b/.tmpl/delete.go index dd9d9a665..b51fe7a2b 100644 --- a/.tmpl/delete.go +++ b/.tmpl/delete.go @@ -62,6 +62,8 @@ type DeleteCommand struct { // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(in io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, Client: c.Globals.Client, Manifest: c.manifest, diff --git a/.tmpl/describe.go b/.tmpl/describe.go index e800b9ac8..f99a1ec05 100644 --- a/.tmpl/describe.go +++ b/.tmpl/describe.go @@ -57,7 +57,6 @@ type DescribeCommand struct { // Exec invokes the application logic for the command. func (c *DescribeCommand) Exec(in io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, Client: c.Globals.Client, Manifest: c.manifest, Out: out, diff --git a/.tmpl/list.go b/.tmpl/list.go index ed26c304c..fbc2178eb 100644 --- a/.tmpl/list.go +++ b/.tmpl/list.go @@ -58,7 +58,6 @@ type ListCommand struct { // Exec invokes the application logic for the command. func (c *ListCommand) Exec(in io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, Client: c.Globals.Client, Manifest: c.manifest, Out: out, diff --git a/.tmpl/test.go b/.tmpl/test.go index 59f986d86..b1c57f06f 100644 --- a/.tmpl/test.go +++ b/.tmpl/test.go @@ -25,12 +25,20 @@ func TestCreate(t *testing.T) { WantError: "error reading service: no service ID found", }, { - Name: "validate missing --autoclone flag", + Name: "validate missing --autoclone flag with 'active' service", API: mock.API{ ListVersionsFn: testutil.ListVersions, }, Args: "--service-id 123 --version 1", - WantError: "service version 1 is not editable", + WantError: "service version 1 is active", + }, + { + Name: "validate missing --autoclone flag with 'locked' service", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + Args: "--service-id 123 --version 2", + WantError: "service version 2 is locked", }, { Name: "validate Create${CLI_API} API error", @@ -88,12 +96,20 @@ func TestDelete(t *testing.T) { WantError: "error reading service: no service ID found", }, { - Name: "validate missing --autoclone flag", + Name: "validate missing --autoclone flag with 'active' service", API: mock.API{ ListVersionsFn: testutil.ListVersions, }, Args: "--service-id 123 --version 1", - WantError: "service version 1 is not editable", + WantError: "service version 1 is active", + }, + { + Name: "validate missing --autoclone flag with 'locked' service", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + Args: "--service-id 123 --version 2", + WantError: "service version 2 is locked", }, { Name: "validate Delete${CLI_API} API error", @@ -233,12 +249,20 @@ func TestUpdate(t *testing.T) { WantError: "error reading service: no service ID found", }, { - Name: "validate missing --autoclone flag", + Name: "validate missing --autoclone flag with 'active' service", API: mock.API{ ListVersionsFn: testutil.ListVersions, }, - Args: "--service-id 123 --version 1", - WantError: "service version 1 is not editable", + Args: "--name foobar --service-id 123 --version 1", + WantError: "service version 1 is active", + }, + { + Name: "validate missing --autoclone flag with 'locked' service", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + Args: "--name foobar --service-id 123 --version 2", + WantError: "service version 2 is locked", }, { Name: "validate Update${CLI_API} API error", diff --git a/.tmpl/update.go b/.tmpl/update.go index cd41e20f9..9ef517ba1 100644 --- a/.tmpl/update.go +++ b/.tmpl/update.go @@ -66,6 +66,8 @@ type UpdateCommand struct { // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(in io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, Client: c.Globals.Client, Manifest: c.manifest, diff --git a/go.mod b/go.mod index 5d7db7575..497d84761 100644 --- a/go.mod +++ b/go.mod @@ -79,4 +79,4 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -require 4d63.com/go-optional v0.2.0 +require 4d63.com/optional v0.2.0 diff --git a/pkg/argparser/cmd.go b/pkg/argparser/cmd.go index 6484250ca..9d851a6db 100644 --- a/pkg/argparser/cmd.go +++ b/pkg/argparser/cmd.go @@ -7,6 +7,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" "github.com/fastly/kingpin" + "4d63.com/optional" "github.com/fastly/cli/pkg/api" "github.com/fastly/cli/pkg/env" fsterr "github.com/fastly/cli/pkg/errors" @@ -108,7 +109,14 @@ type OptionalFloat64 struct { // ServiceDetailsOpts provides data and behaviours required by the // ServiceDetails function. type ServiceDetailsOpts struct { - AllowActiveLocked bool + // Active controls whether active serviceversions will be included in the result; + // if this is Empty, then the 'active' state of the version is ignored; + // otherwise, the 'active' state must match the value + Active optional.Optional[bool] + // Locked controls whether locked serviceversions will be included in the result; + // if this is Empty, then the 'locked' state of the version is ignored; + // otherwise, the 'locked' state must match the value + Locked optional.Optional[bool] AutoCloneFlag OptionalAutoClone APIClient api.Interface Manifest manifest.Data @@ -140,14 +148,41 @@ func ServiceDetails(opts ServiceDetailsOpts) (serviceID string, serviceVersion * if err != nil { return serviceID, currentVersion, err } - } else if !opts.AllowActiveLocked && (fastly.ToValue(v.Active) || fastly.ToValue(v.Locked)) { + return serviceID, v, nil + } + + failure := false + var failureState string + + if active, present := opts.Active.Get(); present { + if active && !fastly.ToValue(v.Active) { + failure = true + failureState = "not active" + } + if !active && fastly.ToValue(v.Active) { + failure = true + failureState = "active" + } + } + + if locked, present := opts.Locked.Get(); present { + if locked && !fastly.ToValue(v.Locked) { + failure = true + failureState = "not locked" + } + if !locked && fastly.ToValue(v.Locked) { + failure = true + failureState = "locked" + } + } + + if failure { err = fsterr.RemediationError{ - Inner: fmt.Errorf("service version %d is not editable", fastly.ToValue(v.Number)), + Inner: fmt.Errorf("service version %d is %s", fastly.ToValue(v.Number), failureState), Remediation: fsterr.AutoCloneRemediation, } return serviceID, v, err } - return serviceID, v, nil } diff --git a/pkg/commands/acl/acl_test.go b/pkg/commands/acl/acl_test.go index cfc65d896..66eed5640 100644 --- a/pkg/commands/acl/acl_test.go +++ b/pkg/commands/acl/acl_test.go @@ -28,12 +28,20 @@ func TestACLCreate(t *testing.T) { WantError: "error reading service: no service ID found", }, { - Name: "validate missing --autoclone flag", + Name: "validate missing --autoclone flag with 'active' service", API: mock.API{ ListVersionsFn: testutil.ListVersions, }, Arg: "--name foo --service-id 123 --version 1", - WantError: "service version 1 is not editable", + WantError: "service version 1 is active", + }, + { + Name: "validate missing --autoclone flag with 'locked' service", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + Arg: "--name foo --service-id 123 --version 2", + WantError: "service version 2 is locked", }, { Name: "validate CreateACL API error", @@ -102,12 +110,20 @@ func TestACLDelete(t *testing.T) { WantError: "error reading service: no service ID found", }, { - Name: "validate missing --autoclone flag", + Name: "validate missing --autoclone flag with 'active' service", API: mock.API{ ListVersionsFn: testutil.ListVersions, }, Arg: "--name foobar --service-id 123 --version 1", - WantError: "service version 1 is not editable", + WantError: "service version 1 is active", + }, + { + Name: "validate missing --autoclone flag with 'locked' service", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + Arg: "--name foo --service-id 123 --version 2", + WantError: "service version 2 is locked", }, { Name: "validate DeleteACL API error", @@ -276,12 +292,20 @@ func TestACLUpdate(t *testing.T) { WantError: "error reading service: no service ID found", }, { - Name: "validate missing --autoclone flag", + Name: "validate missing --autoclone flag with 'active' service", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + Arg: "--name foo --new-name beepboop --service-id 123 --version 1", + WantError: "service version 1 is active", + }, + { + Name: "validate missing --autoclone flag with 'locked' service", API: mock.API{ ListVersionsFn: testutil.ListVersions, }, - Arg: "--name foobar --new-name beepboop --service-id 123 --version 1", - WantError: "service version 1 is not editable", + Arg: "--name foo --new-name beepboop --service-id 123 --version 2", + WantError: "service version 2 is locked", }, { Name: "validate UpdateACL API error", diff --git a/pkg/commands/acl/create.go b/pkg/commands/acl/create.go index f8fbde362..f2d2976f6 100644 --- a/pkg/commands/acl/create.go +++ b/pkg/commands/acl/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -64,6 +65,8 @@ type CreateCommand struct { // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, ErrLog: c.Globals.ErrLog, diff --git a/pkg/commands/acl/delete.go b/pkg/commands/acl/delete.go index c3456bb6b..d19cd97a3 100644 --- a/pkg/commands/acl/delete.go +++ b/pkg/commands/acl/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -63,6 +64,8 @@ type DeleteCommand struct { // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/acl/describe.go b/pkg/commands/acl/describe.go index 10272cb9c..a06ea414f 100644 --- a/pkg/commands/acl/describe.go +++ b/pkg/commands/acl/describe.go @@ -64,7 +64,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/acl/list.go b/pkg/commands/acl/list.go index 0301478ce..3353f8c56 100644 --- a/pkg/commands/acl/list.go +++ b/pkg/commands/acl/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/acl/update.go b/pkg/commands/acl/update.go index cba750784..339c82af3 100644 --- a/pkg/commands/acl/update.go +++ b/pkg/commands/acl/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -65,6 +66,8 @@ type UpdateCommand struct { // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/backend/backend_test.go b/pkg/commands/backend/backend_test.go index 0d95745ee..a2839f72b 100644 --- a/pkg/commands/backend/backend_test.go +++ b/pkg/commands/backend/backend_test.go @@ -30,9 +30,31 @@ func TestBackendCreate(t *testing.T) { API: mock.API{ ListVersionsFn: testutil.ListVersions, }, - WantError: "service version 1 is not editable", + WantError: "service version 1 is active", }, - // The following test is the same as the above but it appends --autoclone + // The following test specifies a service version that's 'locked', and + // subsequently we expect it to not be cloned as we don't provide the + // --autoclone flag and trying to add a backend to a locked service + // should cause an error. + { + Arg: "--service-id 123 --version 2 --address example.com --name www.test.com", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + WantError: "service version 2 is locked", + }, + // The following test is the same as the 'active' test above but it appends --autoclone + // so we can be sure the backend creation error still occurs. + { + Arg: "--service-id 123 --version 1 --address example.com --name www.test.com --autoclone", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + CloneVersionFn: testutil.CloneVersionResult(4), + CreateBackendFn: createBackendError, + }, + WantError: errTest.Error(), + }, + // The following test is the same as the 'locked' test above but it appends --autoclone // so we can be sure the backend creation error still occurs. { Arg: "--service-id 123 --version 1 --address example.com --name www.test.com --autoclone", @@ -122,8 +144,8 @@ func TestBackendCreate(t *testing.T) { }, WantOutput: "Created backend www.test.com (service 123 version 4)", }, - // The following test specifies a service version that's 'inactive', and - // subsequently we expect it to be the same editable version. + // The following test specifies a service version that's 'inactive' and not 'locked', + // and subsequently we expect it to be the same editable version. { Arg: "--service-id 123 --version 3 --address 127.0.0.1 --name www.test.com", API: mock.API{ diff --git a/pkg/commands/backend/create.go b/pkg/commands/backend/create.go index 7de3e92ee..864b69f6a 100644 --- a/pkg/commands/backend/create.go +++ b/pkg/commands/backend/create.go @@ -7,6 +7,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" fsterr "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -127,6 +128,8 @@ func NewCreateCommand(parent argparser.Registerer, g *global.Data) *CreateComman // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/backend/delete.go b/pkg/commands/backend/delete.go index 1e20e244f..24895c334 100644 --- a/pkg/commands/backend/delete.go +++ b/pkg/commands/backend/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -62,6 +63,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/backend/describe.go b/pkg/commands/backend/describe.go index 0e3f336d8..61de8686c 100644 --- a/pkg/commands/backend/describe.go +++ b/pkg/commands/backend/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/backend/list.go b/pkg/commands/backend/list.go index b0d19874a..f6f73cccd 100644 --- a/pkg/commands/backend/list.go +++ b/pkg/commands/backend/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/backend/update.go b/pkg/commands/backend/update.go index 4adf32651..f4ff47d63 100644 --- a/pkg/commands/backend/update.go +++ b/pkg/commands/backend/update.go @@ -6,6 +6,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" fsterr "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -124,6 +125,8 @@ func NewUpdateCommand(parent argparser.Registerer, g *global.Data) *UpdateComman // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/compute/deploy_test.go b/pkg/commands/compute/deploy_test.go index e1bb21fa2..1b07b9674 100644 --- a/pkg/commands/compute/deploy_test.go +++ b/pkg/commands/compute/deploy_test.go @@ -198,6 +198,17 @@ func TestDeploy(t *testing.T) { }, wantError: fmt.Sprintf("error cloning service version: %s", testutil.Err.Error()), }, + { + name: "service version is locked, clone version error", + args: args("compute deploy --service-id 123 --token 123 --version 2"), + api: mock.API{ + CloneVersionFn: testutil.CloneVersionError, + GetPackageFn: getPackageOk, + GetServiceDetailsFn: getServiceDetailsWasm, + ListVersionsFn: testutil.ListVersions, + }, + wantError: fmt.Sprintf("error cloning service version: %s", testutil.Err.Error()), + }, { name: "list domains error", args: args("compute deploy --service-id 123 --token 123"), diff --git a/pkg/commands/dictionary/create.go b/pkg/commands/dictionary/create.go index 3f321e9b1..7fa468fa9 100644 --- a/pkg/commands/dictionary/create.go +++ b/pkg/commands/dictionary/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -67,6 +68,8 @@ func NewCreateCommand(parent argparser.Registerer, g *global.Data) *CreateComman // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/dictionary/delete.go b/pkg/commands/dictionary/delete.go index c1846bb90..6fd96e026 100644 --- a/pkg/commands/dictionary/delete.go +++ b/pkg/commands/dictionary/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/dictionary/describe.go b/pkg/commands/dictionary/describe.go index ff16fed8d..4f4a56740 100644 --- a/pkg/commands/dictionary/describe.go +++ b/pkg/commands/dictionary/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/dictionary/list.go b/pkg/commands/dictionary/list.go index 21aa5ff84..636269fa4 100644 --- a/pkg/commands/dictionary/list.go +++ b/pkg/commands/dictionary/list.go @@ -62,7 +62,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { return fsterr.ErrInvalidVerboseJSONCombo } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/dictionary/update.go b/pkg/commands/dictionary/update.go index 71ff2db53..579b9769c 100644 --- a/pkg/commands/dictionary/update.go +++ b/pkg/commands/dictionary/update.go @@ -7,6 +7,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" fsterr "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -70,6 +71,8 @@ func NewUpdateCommand(parent argparser.Registerer, g *global.Data) *UpdateComman // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/domain/create.go b/pkg/commands/domain/create.go index 34dabb09c..70b45f340 100644 --- a/pkg/commands/domain/create.go +++ b/pkg/commands/domain/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -67,6 +68,8 @@ func NewCreateCommand(parent argparser.Registerer, g *global.Data) *CreateComman // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/domain/delete.go b/pkg/commands/domain/delete.go index 7a652b284..7702a652a 100644 --- a/pkg/commands/domain/delete.go +++ b/pkg/commands/domain/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/domain/describe.go b/pkg/commands/domain/describe.go index c7bee1df9..1bbbc492a 100644 --- a/pkg/commands/domain/describe.go +++ b/pkg/commands/domain/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/domain/list.go b/pkg/commands/domain/list.go index 49b5aeb4d..e8da0dd48 100644 --- a/pkg/commands/domain/list.go +++ b/pkg/commands/domain/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/domain/update.go b/pkg/commands/domain/update.go index dd91068bb..dcbf1752e 100644 --- a/pkg/commands/domain/update.go +++ b/pkg/commands/domain/update.go @@ -6,6 +6,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -67,6 +68,8 @@ func NewUpdateCommand(parent argparser.Registerer, g *global.Data) *UpdateComman // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/domain/validate.go b/pkg/commands/domain/validate.go index 95ee13838..54b62c211 100644 --- a/pkg/commands/domain/validate.go +++ b/pkg/commands/domain/validate.go @@ -57,7 +57,6 @@ type ValidateCommand struct { // Exec invokes the application logic for the command. func (c *ValidateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/healthcheck/create.go b/pkg/commands/healthcheck/create.go index 51f494bbc..b4b7a11ac 100644 --- a/pkg/commands/healthcheck/create.go +++ b/pkg/commands/healthcheck/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -87,6 +88,8 @@ func NewCreateCommand(parent argparser.Registerer, g *global.Data) *CreateComman // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/healthcheck/delete.go b/pkg/commands/healthcheck/delete.go index f1ba044ed..d325e7978 100644 --- a/pkg/commands/healthcheck/delete.go +++ b/pkg/commands/healthcheck/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/healthcheck/describe.go b/pkg/commands/healthcheck/describe.go index ca90a2ad3..bf34c82aa 100644 --- a/pkg/commands/healthcheck/describe.go +++ b/pkg/commands/healthcheck/describe.go @@ -64,7 +64,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/healthcheck/list.go b/pkg/commands/healthcheck/list.go index f26f37f8e..77acbf0e9 100644 --- a/pkg/commands/healthcheck/list.go +++ b/pkg/commands/healthcheck/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/healthcheck/update.go b/pkg/commands/healthcheck/update.go index bbc89a872..51f697e7a 100644 --- a/pkg/commands/healthcheck/update.go +++ b/pkg/commands/healthcheck/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -86,6 +87,8 @@ func NewUpdateCommand(parent argparser.Registerer, g *global.Data) *UpdateComman // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/azureblob/create.go b/pkg/commands/logging/azureblob/create.go index ecd144812..291bc8f87 100644 --- a/pkg/commands/logging/azureblob/create.go +++ b/pkg/commands/logging/azureblob/create.go @@ -6,6 +6,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -165,6 +166,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/azureblob/delete.go b/pkg/commands/logging/azureblob/delete.go index a3031ae8f..2d34fa034 100644 --- a/pkg/commands/logging/azureblob/delete.go +++ b/pkg/commands/logging/azureblob/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/azureblob/describe.go b/pkg/commands/logging/azureblob/describe.go index 3c94fd36b..f90c2a075 100644 --- a/pkg/commands/logging/azureblob/describe.go +++ b/pkg/commands/logging/azureblob/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/azureblob/list.go b/pkg/commands/logging/azureblob/list.go index 4baa6e4be..eea494279 100644 --- a/pkg/commands/logging/azureblob/list.go +++ b/pkg/commands/logging/azureblob/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/azureblob/update.go b/pkg/commands/logging/azureblob/update.go index 89c7abc1d..876d6df1e 100644 --- a/pkg/commands/logging/azureblob/update.go +++ b/pkg/commands/logging/azureblob/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -163,6 +164,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/bigquery/create.go b/pkg/commands/logging/bigquery/create.go index e1c254b29..ceda33141 100644 --- a/pkg/commands/logging/bigquery/create.go +++ b/pkg/commands/logging/bigquery/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" fsterr "github.com/fastly/cli/pkg/errors" @@ -137,6 +138,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/bigquery/delete.go b/pkg/commands/logging/bigquery/delete.go index 1b969680d..0580ccc46 100644 --- a/pkg/commands/logging/bigquery/delete.go +++ b/pkg/commands/logging/bigquery/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/bigquery/describe.go b/pkg/commands/logging/bigquery/describe.go index 2ef1e7c57..2500f8308 100644 --- a/pkg/commands/logging/bigquery/describe.go +++ b/pkg/commands/logging/bigquery/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/bigquery/list.go b/pkg/commands/logging/bigquery/list.go index a52711457..bf5765828 100644 --- a/pkg/commands/logging/bigquery/list.go +++ b/pkg/commands/logging/bigquery/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/bigquery/update.go b/pkg/commands/logging/bigquery/update.go index 6b2a749ed..a533956a1 100644 --- a/pkg/commands/logging/bigquery/update.go +++ b/pkg/commands/logging/bigquery/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" fsterr "github.com/fastly/cli/pkg/errors" @@ -140,6 +141,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/cloudfiles/create.go b/pkg/commands/logging/cloudfiles/create.go index 8fdc0314c..4c0cd33f3 100644 --- a/pkg/commands/logging/cloudfiles/create.go +++ b/pkg/commands/logging/cloudfiles/create.go @@ -6,6 +6,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" fsterr "github.com/fastly/cli/pkg/errors" @@ -165,6 +166,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/cloudfiles/delete.go b/pkg/commands/logging/cloudfiles/delete.go index d9ae12958..a0888b2d9 100644 --- a/pkg/commands/logging/cloudfiles/delete.go +++ b/pkg/commands/logging/cloudfiles/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/cloudfiles/describe.go b/pkg/commands/logging/cloudfiles/describe.go index 55a0f7ee0..71a2bcc90 100644 --- a/pkg/commands/logging/cloudfiles/describe.go +++ b/pkg/commands/logging/cloudfiles/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/cloudfiles/list.go b/pkg/commands/logging/cloudfiles/list.go index 6d42d589c..13c33156d 100644 --- a/pkg/commands/logging/cloudfiles/list.go +++ b/pkg/commands/logging/cloudfiles/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/cloudfiles/update.go b/pkg/commands/logging/cloudfiles/update.go index f1adc8f1c..26e9106cb 100644 --- a/pkg/commands/logging/cloudfiles/update.go +++ b/pkg/commands/logging/cloudfiles/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" fsterr "github.com/fastly/cli/pkg/errors" @@ -176,6 +177,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/datadog/create.go b/pkg/commands/logging/datadog/create.go index 1c1240713..3a1122eb0 100644 --- a/pkg/commands/logging/datadog/create.go +++ b/pkg/commands/logging/datadog/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -116,6 +117,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/datadog/delete.go b/pkg/commands/logging/datadog/delete.go index 2dc61c178..86fbcc0e1 100644 --- a/pkg/commands/logging/datadog/delete.go +++ b/pkg/commands/logging/datadog/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/datadog/describe.go b/pkg/commands/logging/datadog/describe.go index a6264c338..a6337cd6b 100644 --- a/pkg/commands/logging/datadog/describe.go +++ b/pkg/commands/logging/datadog/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/datadog/list.go b/pkg/commands/logging/datadog/list.go index f73447f58..e003ca088 100644 --- a/pkg/commands/logging/datadog/list.go +++ b/pkg/commands/logging/datadog/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/datadog/update.go b/pkg/commands/logging/datadog/update.go index c97966bf8..fcc8966ac 100644 --- a/pkg/commands/logging/datadog/update.go +++ b/pkg/commands/logging/datadog/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -121,6 +122,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/digitalocean/create.go b/pkg/commands/logging/digitalocean/create.go index 297776353..ae70419db 100644 --- a/pkg/commands/logging/digitalocean/create.go +++ b/pkg/commands/logging/digitalocean/create.go @@ -6,6 +6,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -175,6 +176,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/digitalocean/delete.go b/pkg/commands/logging/digitalocean/delete.go index e5acb7cbd..7ed3954b6 100644 --- a/pkg/commands/logging/digitalocean/delete.go +++ b/pkg/commands/logging/digitalocean/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/digitalocean/describe.go b/pkg/commands/logging/digitalocean/describe.go index fa42d7d5c..c4cf5d97f 100644 --- a/pkg/commands/logging/digitalocean/describe.go +++ b/pkg/commands/logging/digitalocean/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/digitalocean/list.go b/pkg/commands/logging/digitalocean/list.go index c27da6fe8..eb8fa8a42 100644 --- a/pkg/commands/logging/digitalocean/list.go +++ b/pkg/commands/logging/digitalocean/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/digitalocean/update.go b/pkg/commands/logging/digitalocean/update.go index 9b2161d1d..27b07cbcb 100644 --- a/pkg/commands/logging/digitalocean/update.go +++ b/pkg/commands/logging/digitalocean/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -176,6 +177,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/elasticsearch/create.go b/pkg/commands/logging/elasticsearch/create.go index 3621d4613..4c23a9c35 100644 --- a/pkg/commands/logging/elasticsearch/create.go +++ b/pkg/commands/logging/elasticsearch/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -167,6 +168,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/elasticsearch/delete.go b/pkg/commands/logging/elasticsearch/delete.go index a36d3ee6e..15aecdc44 100644 --- a/pkg/commands/logging/elasticsearch/delete.go +++ b/pkg/commands/logging/elasticsearch/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/elasticsearch/describe.go b/pkg/commands/logging/elasticsearch/describe.go index d4690cdcc..b0d2b6f30 100644 --- a/pkg/commands/logging/elasticsearch/describe.go +++ b/pkg/commands/logging/elasticsearch/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/elasticsearch/list.go b/pkg/commands/logging/elasticsearch/list.go index 5ab5a475b..ddb62908d 100644 --- a/pkg/commands/logging/elasticsearch/list.go +++ b/pkg/commands/logging/elasticsearch/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/elasticsearch/update.go b/pkg/commands/logging/elasticsearch/update.go index 3b7332160..44272e239 100644 --- a/pkg/commands/logging/elasticsearch/update.go +++ b/pkg/commands/logging/elasticsearch/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -173,6 +174,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/ftp/create.go b/pkg/commands/logging/ftp/create.go index 94da7aec0..23b818c2b 100644 --- a/pkg/commands/logging/ftp/create.go +++ b/pkg/commands/logging/ftp/create.go @@ -6,6 +6,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -163,6 +164,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/ftp/delete.go b/pkg/commands/logging/ftp/delete.go index 0eafdaaee..f9cfea102 100644 --- a/pkg/commands/logging/ftp/delete.go +++ b/pkg/commands/logging/ftp/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/ftp/describe.go b/pkg/commands/logging/ftp/describe.go index 18fcac5e9..7c8817263 100644 --- a/pkg/commands/logging/ftp/describe.go +++ b/pkg/commands/logging/ftp/describe.go @@ -59,7 +59,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/ftp/list.go b/pkg/commands/logging/ftp/list.go index 657e44815..1f7b5b0eb 100644 --- a/pkg/commands/logging/ftp/list.go +++ b/pkg/commands/logging/ftp/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/ftp/update.go b/pkg/commands/logging/ftp/update.go index 97585a9c0..19356947c 100644 --- a/pkg/commands/logging/ftp/update.go +++ b/pkg/commands/logging/ftp/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -170,6 +171,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/gcs/create.go b/pkg/commands/logging/gcs/create.go index f3ea6721c..645f94d27 100644 --- a/pkg/commands/logging/gcs/create.go +++ b/pkg/commands/logging/gcs/create.go @@ -6,6 +6,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -164,6 +165,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/gcs/delete.go b/pkg/commands/logging/gcs/delete.go index 6cdedb810..91434a60a 100644 --- a/pkg/commands/logging/gcs/delete.go +++ b/pkg/commands/logging/gcs/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/gcs/describe.go b/pkg/commands/logging/gcs/describe.go index c33a1c700..bf35842e2 100644 --- a/pkg/commands/logging/gcs/describe.go +++ b/pkg/commands/logging/gcs/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/gcs/list.go b/pkg/commands/logging/gcs/list.go index 571d7fd32..94067023c 100644 --- a/pkg/commands/logging/gcs/list.go +++ b/pkg/commands/logging/gcs/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/gcs/update.go b/pkg/commands/logging/gcs/update.go index 77d3541aa..d8d3b7d11 100644 --- a/pkg/commands/logging/gcs/update.go +++ b/pkg/commands/logging/gcs/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -160,6 +161,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/googlepubsub/create.go b/pkg/commands/logging/googlepubsub/create.go index f65a53235..6ce345cc3 100644 --- a/pkg/commands/logging/googlepubsub/create.go +++ b/pkg/commands/logging/googlepubsub/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -127,6 +128,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/googlepubsub/delete.go b/pkg/commands/logging/googlepubsub/delete.go index 1df2ea017..9a564ec92 100644 --- a/pkg/commands/logging/googlepubsub/delete.go +++ b/pkg/commands/logging/googlepubsub/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/googlepubsub/describe.go b/pkg/commands/logging/googlepubsub/describe.go index 8f6094c02..791b0dca8 100644 --- a/pkg/commands/logging/googlepubsub/describe.go +++ b/pkg/commands/logging/googlepubsub/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/googlepubsub/list.go b/pkg/commands/logging/googlepubsub/list.go index 2e764d855..82abe6ef9 100644 --- a/pkg/commands/logging/googlepubsub/list.go +++ b/pkg/commands/logging/googlepubsub/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/googlepubsub/update.go b/pkg/commands/logging/googlepubsub/update.go index 939723bd2..76f78d517 100644 --- a/pkg/commands/logging/googlepubsub/update.go +++ b/pkg/commands/logging/googlepubsub/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -130,6 +131,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/heroku/create.go b/pkg/commands/logging/heroku/create.go index 904058e6a..53b2ad3db 100644 --- a/pkg/commands/logging/heroku/create.go +++ b/pkg/commands/logging/heroku/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -115,6 +116,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/heroku/delete.go b/pkg/commands/logging/heroku/delete.go index 6988e5ab7..96991fdbc 100644 --- a/pkg/commands/logging/heroku/delete.go +++ b/pkg/commands/logging/heroku/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/heroku/describe.go b/pkg/commands/logging/heroku/describe.go index 4566416bc..d4737c421 100644 --- a/pkg/commands/logging/heroku/describe.go +++ b/pkg/commands/logging/heroku/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/heroku/list.go b/pkg/commands/logging/heroku/list.go index 367f9f1e0..1cab3749d 100644 --- a/pkg/commands/logging/heroku/list.go +++ b/pkg/commands/logging/heroku/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/heroku/update.go b/pkg/commands/logging/heroku/update.go index f5ef721b3..1c8da3139 100644 --- a/pkg/commands/logging/heroku/update.go +++ b/pkg/commands/logging/heroku/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -121,6 +122,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/honeycomb/create.go b/pkg/commands/logging/honeycomb/create.go index 0d96a30f8..5fe041fe0 100644 --- a/pkg/commands/logging/honeycomb/create.go +++ b/pkg/commands/logging/honeycomb/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -115,6 +116,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/honeycomb/delete.go b/pkg/commands/logging/honeycomb/delete.go index e747363d9..733ee2d95 100644 --- a/pkg/commands/logging/honeycomb/delete.go +++ b/pkg/commands/logging/honeycomb/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/honeycomb/describe.go b/pkg/commands/logging/honeycomb/describe.go index e4dba3ab5..9ea8579df 100644 --- a/pkg/commands/logging/honeycomb/describe.go +++ b/pkg/commands/logging/honeycomb/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/honeycomb/list.go b/pkg/commands/logging/honeycomb/list.go index af590e3b7..f62345e91 100644 --- a/pkg/commands/logging/honeycomb/list.go +++ b/pkg/commands/logging/honeycomb/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/honeycomb/update.go b/pkg/commands/logging/honeycomb/update.go index 1d2fc9f03..ab2e4227c 100644 --- a/pkg/commands/logging/honeycomb/update.go +++ b/pkg/commands/logging/honeycomb/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -121,6 +122,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/https/create.go b/pkg/commands/logging/https/create.go index 2aab8a461..0c58e5ba8 100644 --- a/pkg/commands/logging/https/create.go +++ b/pkg/commands/logging/https/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -182,6 +183,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/https/delete.go b/pkg/commands/logging/https/delete.go index a7fc11aac..1f1decce3 100644 --- a/pkg/commands/logging/https/delete.go +++ b/pkg/commands/logging/https/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/https/describe.go b/pkg/commands/logging/https/describe.go index 81253849f..1ba8048d6 100644 --- a/pkg/commands/logging/https/describe.go +++ b/pkg/commands/logging/https/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/https/list.go b/pkg/commands/logging/https/list.go index 94f8f2234..5650bd8e5 100644 --- a/pkg/commands/logging/https/list.go +++ b/pkg/commands/logging/https/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/https/update.go b/pkg/commands/logging/https/update.go index 28214dfad..59e5db779 100644 --- a/pkg/commands/logging/https/update.go +++ b/pkg/commands/logging/https/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -187,6 +188,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/kafka/create.go b/pkg/commands/logging/kafka/create.go index 3be1af72c..a32b95999 100644 --- a/pkg/commands/logging/kafka/create.go +++ b/pkg/commands/logging/kafka/create.go @@ -6,6 +6,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -198,6 +199,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/kafka/delete.go b/pkg/commands/logging/kafka/delete.go index f73146d55..8af7fb831 100644 --- a/pkg/commands/logging/kafka/delete.go +++ b/pkg/commands/logging/kafka/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/kafka/describe.go b/pkg/commands/logging/kafka/describe.go index b7faadce7..8594f81e4 100644 --- a/pkg/commands/logging/kafka/describe.go +++ b/pkg/commands/logging/kafka/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/kafka/list.go b/pkg/commands/logging/kafka/list.go index 1e7cc8d0a..0b911be3a 100644 --- a/pkg/commands/logging/kafka/list.go +++ b/pkg/commands/logging/kafka/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/kafka/update.go b/pkg/commands/logging/kafka/update.go index 994877ad3..2a21292f4 100644 --- a/pkg/commands/logging/kafka/update.go +++ b/pkg/commands/logging/kafka/update.go @@ -6,6 +6,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -211,6 +212,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/kinesis/create.go b/pkg/commands/logging/kinesis/create.go index 66a60e6d8..2145003a6 100644 --- a/pkg/commands/logging/kinesis/create.go +++ b/pkg/commands/logging/kinesis/create.go @@ -6,6 +6,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -158,6 +159,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/kinesis/delete.go b/pkg/commands/logging/kinesis/delete.go index 3e8e834c5..f951025b7 100644 --- a/pkg/commands/logging/kinesis/delete.go +++ b/pkg/commands/logging/kinesis/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -62,6 +63,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/kinesis/describe.go b/pkg/commands/logging/kinesis/describe.go index d5d3debe4..6efea8d31 100644 --- a/pkg/commands/logging/kinesis/describe.go +++ b/pkg/commands/logging/kinesis/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/kinesis/list.go b/pkg/commands/logging/kinesis/list.go index c923260af..ec04e5cbd 100644 --- a/pkg/commands/logging/kinesis/list.go +++ b/pkg/commands/logging/kinesis/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/kinesis/update.go b/pkg/commands/logging/kinesis/update.go index 32395cb4c..c15986218 100644 --- a/pkg/commands/logging/kinesis/update.go +++ b/pkg/commands/logging/kinesis/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -139,6 +140,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/loggly/create.go b/pkg/commands/logging/loggly/create.go index 798f2d847..7cef93ef3 100644 --- a/pkg/commands/logging/loggly/create.go +++ b/pkg/commands/logging/loggly/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -110,6 +111,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/loggly/delete.go b/pkg/commands/logging/loggly/delete.go index be1ec6a1d..c76069783 100644 --- a/pkg/commands/logging/loggly/delete.go +++ b/pkg/commands/logging/loggly/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/loggly/describe.go b/pkg/commands/logging/loggly/describe.go index af44f3d71..43591b86f 100644 --- a/pkg/commands/logging/loggly/describe.go +++ b/pkg/commands/logging/loggly/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/loggly/list.go b/pkg/commands/logging/loggly/list.go index 749fca048..fed95c650 100644 --- a/pkg/commands/logging/loggly/list.go +++ b/pkg/commands/logging/loggly/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/loggly/update.go b/pkg/commands/logging/loggly/update.go index 9fb4d8b20..e492b2bc8 100644 --- a/pkg/commands/logging/loggly/update.go +++ b/pkg/commands/logging/loggly/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -115,6 +116,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/logshuttle/create.go b/pkg/commands/logging/logshuttle/create.go index e8b85423a..44e819e52 100644 --- a/pkg/commands/logging/logshuttle/create.go +++ b/pkg/commands/logging/logshuttle/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -115,6 +116,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/logshuttle/delete.go b/pkg/commands/logging/logshuttle/delete.go index c11f29d9d..64812970b 100644 --- a/pkg/commands/logging/logshuttle/delete.go +++ b/pkg/commands/logging/logshuttle/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/logshuttle/describe.go b/pkg/commands/logging/logshuttle/describe.go index ecf5224c8..3914a48f6 100644 --- a/pkg/commands/logging/logshuttle/describe.go +++ b/pkg/commands/logging/logshuttle/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/logshuttle/list.go b/pkg/commands/logging/logshuttle/list.go index 26d49fad1..41b05cc45 100644 --- a/pkg/commands/logging/logshuttle/list.go +++ b/pkg/commands/logging/logshuttle/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/logshuttle/update.go b/pkg/commands/logging/logshuttle/update.go index 9235f35fd..1de475d94 100644 --- a/pkg/commands/logging/logshuttle/update.go +++ b/pkg/commands/logging/logshuttle/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -122,6 +123,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/newrelic/create.go b/pkg/commands/logging/newrelic/create.go index d5220865f..91145b74a 100644 --- a/pkg/commands/logging/newrelic/create.go +++ b/pkg/commands/logging/newrelic/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -79,6 +80,8 @@ func NewCreateCommand(parent argparser.Registerer, g *global.Data) *CreateComman // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/newrelic/delete.go b/pkg/commands/logging/newrelic/delete.go index fd924036d..6efa7075f 100644 --- a/pkg/commands/logging/newrelic/delete.go +++ b/pkg/commands/logging/newrelic/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -63,6 +64,8 @@ type DeleteCommand struct { // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/newrelic/describe.go b/pkg/commands/logging/newrelic/describe.go index 13bbe939f..0fb5895b6 100644 --- a/pkg/commands/logging/newrelic/describe.go +++ b/pkg/commands/logging/newrelic/describe.go @@ -64,7 +64,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/newrelic/list.go b/pkg/commands/logging/newrelic/list.go index 9e3add715..2d919b9a5 100644 --- a/pkg/commands/logging/newrelic/list.go +++ b/pkg/commands/logging/newrelic/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/newrelic/newrelic_test.go b/pkg/commands/logging/newrelic/newrelic_test.go index 3324ac083..5a8e17194 100644 --- a/pkg/commands/logging/newrelic/newrelic_test.go +++ b/pkg/commands/logging/newrelic/newrelic_test.go @@ -19,12 +19,20 @@ func TestNewRelicCreate(t *testing.T) { WantError: "error reading service: no service ID found", }, { - Name: "validate missing --autoclone flag", + Name: "validate missing --autoclone flag with 'active' service", API: mock.API{ ListVersionsFn: testutil.ListVersions, }, Arg: "--key abc --name foo --service-id 123 --version 1", - WantError: "service version 1 is not editable", + WantError: "service version 1 is active", + }, + { + Name: "validate missing --autoclone flag with 'locked' service", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + Arg: "--key abc --name foo --service-id 123 --version 2", + WantError: "service version 2 is locked", }, { Name: "validate CreateNewRelic API error", @@ -91,12 +99,20 @@ func TestNewRelicDelete(t *testing.T) { WantError: "error reading service: no service ID found", }, { - Name: "validate missing --autoclone flag", + Name: "validate missing --autoclone flag with 'active' service", API: mock.API{ ListVersionsFn: testutil.ListVersions, }, Arg: "--name foobar --service-id 123 --version 1", - WantError: "service version 1 is not editable", + WantError: "service version 1 is active", + }, + { + Name: "validate missing --autoclone flag with 'locked' service", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + Arg: "--name foobar --service-id 123 --version 2", + WantError: "service version 2 is locked", }, { Name: "validate DeleteNewRelic API error", @@ -260,12 +276,20 @@ func TestNewRelicUpdate(t *testing.T) { WantError: "error reading service: no service ID found", }, { - Name: "validate missing --autoclone flag", + Name: "validate missing --autoclone flag with 'active' service", API: mock.API{ ListVersionsFn: testutil.ListVersions, }, Arg: "--name foobar --service-id 123 --version 1", - WantError: "service version 1 is not editable", + WantError: "service version 1 is active", + }, + { + Name: "validate missing --autoclone flag with 'locked' service", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + Arg: "--name foobar --service-id 123 --version 2", + WantError: "service version 2 is locked", }, { Name: "validate UpdateNewRelic API error", diff --git a/pkg/commands/logging/newrelic/update.go b/pkg/commands/logging/newrelic/update.go index 4648aa527..b5a7c542f 100644 --- a/pkg/commands/logging/newrelic/update.go +++ b/pkg/commands/logging/newrelic/update.go @@ -6,6 +6,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -80,6 +81,8 @@ func NewUpdateCommand(parent argparser.Registerer, g *global.Data) *UpdateComman // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/newrelicotlp/create.go b/pkg/commands/logging/newrelicotlp/create.go index 160666292..4888e50ce 100644 --- a/pkg/commands/logging/newrelicotlp/create.go +++ b/pkg/commands/logging/newrelicotlp/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -81,6 +82,8 @@ func NewCreateCommand(parent argparser.Registerer, g *global.Data) *CreateComman // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/newrelicotlp/delete.go b/pkg/commands/logging/newrelicotlp/delete.go index ca8ee9395..75efcbebe 100644 --- a/pkg/commands/logging/newrelicotlp/delete.go +++ b/pkg/commands/logging/newrelicotlp/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -63,6 +64,8 @@ type DeleteCommand struct { // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/newrelicotlp/describe.go b/pkg/commands/logging/newrelicotlp/describe.go index 1c72669d2..21a20d0b2 100644 --- a/pkg/commands/logging/newrelicotlp/describe.go +++ b/pkg/commands/logging/newrelicotlp/describe.go @@ -64,7 +64,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/newrelicotlp/list.go b/pkg/commands/logging/newrelicotlp/list.go index a24f0a119..86064aef1 100644 --- a/pkg/commands/logging/newrelicotlp/list.go +++ b/pkg/commands/logging/newrelicotlp/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/newrelicotlp/newrelicotlp_test.go b/pkg/commands/logging/newrelicotlp/newrelicotlp_test.go index a2e517b8d..94cecac1b 100644 --- a/pkg/commands/logging/newrelicotlp/newrelicotlp_test.go +++ b/pkg/commands/logging/newrelicotlp/newrelicotlp_test.go @@ -19,12 +19,20 @@ func TestNewRelicOTLPCreate(t *testing.T) { WantError: "error reading service: no service ID found", }, { - Name: "validate missing --autoclone flag", + Name: "validate missing --autoclone flag with 'active' service", API: mock.API{ ListVersionsFn: testutil.ListVersions, }, Arg: "--key abc --name foo --service-id 123 --version 1", - WantError: "service version 1 is not editable", + WantError: "service version 1 is active", + }, + { + Name: "validate missing --autoclone flag with 'locked' service", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + Arg: "--key abc --name foo --service-id 123 --version 2", + WantError: "service version 2 is locked", }, { Name: "validate CreateNewRelicOTLP API error", @@ -91,12 +99,20 @@ func TestNewRelicOTLPDelete(t *testing.T) { WantError: "error reading service: no service ID found", }, { - Name: "validate missing --autoclone flag", + Name: "validate missing --autoclone flag with 'active' service", API: mock.API{ ListVersionsFn: testutil.ListVersions, }, Arg: "--name foobar --service-id 123 --version 1", - WantError: "service version 1 is not editable", + WantError: "service version 1 is active", + }, + { + Name: "validate missing --autoclone flag with 'locked' service", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + Arg: "--name foobar --service-id 123 --version 2", + WantError: "service version 2 is locked", }, { Name: "validate DeleteNewRelic API error", @@ -260,12 +276,20 @@ func TestNewRelicUpdate(t *testing.T) { WantError: "error reading service: no service ID found", }, { - Name: "validate missing --autoclone flag", + Name: "validate missing --autoclone flag with 'active' service", API: mock.API{ ListVersionsFn: testutil.ListVersions, }, Arg: "--name foobar --service-id 123 --version 1", - WantError: "service version 1 is not editable", + WantError: "service version 1 is active", + }, + { + Name: "validate missing --autoclone flag with 'locked' service", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + Arg: "--name foobar --service-id 123 --version 2", + WantError: "service version 2 is locked", }, { Name: "validate UpdateNewRelic API error", diff --git a/pkg/commands/logging/newrelicotlp/update.go b/pkg/commands/logging/newrelicotlp/update.go index 5a03799db..f7822948b 100644 --- a/pkg/commands/logging/newrelicotlp/update.go +++ b/pkg/commands/logging/newrelicotlp/update.go @@ -6,6 +6,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -82,6 +83,8 @@ func NewUpdateCommand(parent argparser.Registerer, g *global.Data) *UpdateComman // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/openstack/create.go b/pkg/commands/logging/openstack/create.go index 88c951bb0..2af0c5b18 100644 --- a/pkg/commands/logging/openstack/create.go +++ b/pkg/commands/logging/openstack/create.go @@ -6,6 +6,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -174,6 +175,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/openstack/delete.go b/pkg/commands/logging/openstack/delete.go index 333141a4b..b549c394a 100644 --- a/pkg/commands/logging/openstack/delete.go +++ b/pkg/commands/logging/openstack/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/openstack/describe.go b/pkg/commands/logging/openstack/describe.go index a5ca374fd..6d2d752be 100644 --- a/pkg/commands/logging/openstack/describe.go +++ b/pkg/commands/logging/openstack/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/openstack/list.go b/pkg/commands/logging/openstack/list.go index da1a74ca9..0a9d77cdb 100644 --- a/pkg/commands/logging/openstack/list.go +++ b/pkg/commands/logging/openstack/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/openstack/update.go b/pkg/commands/logging/openstack/update.go index 05ecf0f35..067913ccd 100644 --- a/pkg/commands/logging/openstack/update.go +++ b/pkg/commands/logging/openstack/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -177,6 +178,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/papertrail/create.go b/pkg/commands/logging/papertrail/create.go index 85533a765..11d45f900 100644 --- a/pkg/commands/logging/papertrail/create.go +++ b/pkg/commands/logging/papertrail/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -116,6 +117,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/papertrail/delete.go b/pkg/commands/logging/papertrail/delete.go index a4214725b..12678b627 100644 --- a/pkg/commands/logging/papertrail/delete.go +++ b/pkg/commands/logging/papertrail/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/papertrail/describe.go b/pkg/commands/logging/papertrail/describe.go index fd745823f..9198a3ac9 100644 --- a/pkg/commands/logging/papertrail/describe.go +++ b/pkg/commands/logging/papertrail/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/papertrail/list.go b/pkg/commands/logging/papertrail/list.go index 557b1f0b1..3482b59ff 100644 --- a/pkg/commands/logging/papertrail/list.go +++ b/pkg/commands/logging/papertrail/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/papertrail/update.go b/pkg/commands/logging/papertrail/update.go index f058f42c6..b4d5bc1e0 100644 --- a/pkg/commands/logging/papertrail/update.go +++ b/pkg/commands/logging/papertrail/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -126,6 +127,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/s3/create.go b/pkg/commands/logging/s3/create.go index e19887409..1cea2f68f 100644 --- a/pkg/commands/logging/s3/create.go +++ b/pkg/commands/logging/s3/create.go @@ -6,6 +6,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -263,6 +264,8 @@ func ValidateRedundancy(val string) (redundancy fastly.S3Redundancy, err error) // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/s3/delete.go b/pkg/commands/logging/s3/delete.go index c2343ce8c..5be83493f 100644 --- a/pkg/commands/logging/s3/delete.go +++ b/pkg/commands/logging/s3/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/s3/describe.go b/pkg/commands/logging/s3/describe.go index 753e7c155..3d19eb048 100644 --- a/pkg/commands/logging/s3/describe.go +++ b/pkg/commands/logging/s3/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/s3/list.go b/pkg/commands/logging/s3/list.go index 7fa486abe..f18e5d8d5 100644 --- a/pkg/commands/logging/s3/list.go +++ b/pkg/commands/logging/s3/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/s3/update.go b/pkg/commands/logging/s3/update.go index 28c11d671..debb58b51 100644 --- a/pkg/commands/logging/s3/update.go +++ b/pkg/commands/logging/s3/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -214,6 +215,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/scalyr/create.go b/pkg/commands/logging/scalyr/create.go index d85bd6beb..8ca1c2803 100644 --- a/pkg/commands/logging/scalyr/create.go +++ b/pkg/commands/logging/scalyr/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -116,6 +117,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/scalyr/delete.go b/pkg/commands/logging/scalyr/delete.go index 35789ff0c..302534a59 100644 --- a/pkg/commands/logging/scalyr/delete.go +++ b/pkg/commands/logging/scalyr/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/scalyr/describe.go b/pkg/commands/logging/scalyr/describe.go index c8281bf74..c246a09c3 100644 --- a/pkg/commands/logging/scalyr/describe.go +++ b/pkg/commands/logging/scalyr/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/scalyr/list.go b/pkg/commands/logging/scalyr/list.go index 9d2473f46..24c5e6d45 100644 --- a/pkg/commands/logging/scalyr/list.go +++ b/pkg/commands/logging/scalyr/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/scalyr/update.go b/pkg/commands/logging/scalyr/update.go index 86484bd62..1705c4110 100644 --- a/pkg/commands/logging/scalyr/update.go +++ b/pkg/commands/logging/scalyr/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -118,6 +119,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/sftp/create.go b/pkg/commands/logging/sftp/create.go index 19584a5d7..40a61094d 100644 --- a/pkg/commands/logging/sftp/create.go +++ b/pkg/commands/logging/sftp/create.go @@ -6,6 +6,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -187,6 +188,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/sftp/delete.go b/pkg/commands/logging/sftp/delete.go index 7bb12e0fa..7562aae53 100644 --- a/pkg/commands/logging/sftp/delete.go +++ b/pkg/commands/logging/sftp/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/sftp/describe.go b/pkg/commands/logging/sftp/describe.go index 8f9fc86fd..d52d5ce6a 100644 --- a/pkg/commands/logging/sftp/describe.go +++ b/pkg/commands/logging/sftp/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/sftp/list.go b/pkg/commands/logging/sftp/list.go index 6634539fc..733bba5bb 100644 --- a/pkg/commands/logging/sftp/list.go +++ b/pkg/commands/logging/sftp/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/sftp/update.go b/pkg/commands/logging/sftp/update.go index 337e1363b..32953e4c8 100644 --- a/pkg/commands/logging/sftp/update.go +++ b/pkg/commands/logging/sftp/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -187,6 +188,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/splunk/create.go b/pkg/commands/logging/splunk/create.go index 2fd68d79e..49fa84029 100644 --- a/pkg/commands/logging/splunk/create.go +++ b/pkg/commands/logging/splunk/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -141,6 +142,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/splunk/delete.go b/pkg/commands/logging/splunk/delete.go index 0cd486d34..599fac1b9 100644 --- a/pkg/commands/logging/splunk/delete.go +++ b/pkg/commands/logging/splunk/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/splunk/describe.go b/pkg/commands/logging/splunk/describe.go index f6fbeb5e1..de6a20b94 100644 --- a/pkg/commands/logging/splunk/describe.go +++ b/pkg/commands/logging/splunk/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/splunk/list.go b/pkg/commands/logging/splunk/list.go index 7dc51ac82..7d9485a04 100644 --- a/pkg/commands/logging/splunk/list.go +++ b/pkg/commands/logging/splunk/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/splunk/update.go b/pkg/commands/logging/splunk/update.go index e529b157b..01efdde58 100644 --- a/pkg/commands/logging/splunk/update.go +++ b/pkg/commands/logging/splunk/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -146,6 +147,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/sumologic/create.go b/pkg/commands/logging/sumologic/create.go index 5abced065..8c74deca9 100644 --- a/pkg/commands/logging/sumologic/create.go +++ b/pkg/commands/logging/sumologic/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -116,6 +117,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/sumologic/delete.go b/pkg/commands/logging/sumologic/delete.go index 9062a2556..c157b896b 100644 --- a/pkg/commands/logging/sumologic/delete.go +++ b/pkg/commands/logging/sumologic/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/sumologic/describe.go b/pkg/commands/logging/sumologic/describe.go index 2afffe50c..28fc10d93 100644 --- a/pkg/commands/logging/sumologic/describe.go +++ b/pkg/commands/logging/sumologic/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/sumologic/list.go b/pkg/commands/logging/sumologic/list.go index 834d19da9..c63a9c7b7 100644 --- a/pkg/commands/logging/sumologic/list.go +++ b/pkg/commands/logging/sumologic/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/sumologic/update.go b/pkg/commands/logging/sumologic/update.go index 78b7277f5..ba4096c69 100644 --- a/pkg/commands/logging/sumologic/update.go +++ b/pkg/commands/logging/sumologic/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -122,6 +123,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/syslog/create.go b/pkg/commands/logging/syslog/create.go index 34d368172..5290edf17 100644 --- a/pkg/commands/logging/syslog/create.go +++ b/pkg/commands/logging/syslog/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -157,6 +158,8 @@ func (c *CreateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/syslog/delete.go b/pkg/commands/logging/syslog/delete.go index 164a4332a..a41733e86 100644 --- a/pkg/commands/logging/syslog/delete.go +++ b/pkg/commands/logging/syslog/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -61,6 +62,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/logging/syslog/describe.go b/pkg/commands/logging/syslog/describe.go index 314b48c1b..a32123124 100644 --- a/pkg/commands/logging/syslog/describe.go +++ b/pkg/commands/logging/syslog/describe.go @@ -63,7 +63,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/syslog/list.go b/pkg/commands/logging/syslog/list.go index 04ca88dae..b53dd2fda 100644 --- a/pkg/commands/logging/syslog/list.go +++ b/pkg/commands/logging/syslog/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/logging/syslog/update.go b/pkg/commands/logging/syslog/update.go index 404814a0f..3f7cce96e 100644 --- a/pkg/commands/logging/syslog/update.go +++ b/pkg/commands/logging/syslog/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/commands/logging/common" "github.com/fastly/cli/pkg/errors" @@ -164,6 +165,8 @@ func (c *UpdateCommand) ConstructInput(serviceID string, serviceVersion int) (*f // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.AutoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/ratelimit/create.go b/pkg/commands/ratelimit/create.go index 7691acc03..228cdb1cb 100644 --- a/pkg/commands/ratelimit/create.go +++ b/pkg/commands/ratelimit/create.go @@ -8,6 +8,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" fsterr "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -133,6 +134,8 @@ func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/ratelimit/list.go b/pkg/commands/ratelimit/list.go index 6a49b66f9..9ae294a9a 100644 --- a/pkg/commands/ratelimit/list.go +++ b/pkg/commands/ratelimit/list.go @@ -59,7 +59,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/resourcelink/create.go b/pkg/commands/resourcelink/create.go index 23de4e354..b14a78f5f 100644 --- a/pkg/commands/resourcelink/create.go +++ b/pkg/commands/resourcelink/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" fsterr "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -88,6 +89,8 @@ func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/resourcelink/delete.go b/pkg/commands/resourcelink/delete.go index 7db639e5a..4a21c6b40 100644 --- a/pkg/commands/resourcelink/delete.go +++ b/pkg/commands/resourcelink/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" fsterr "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -76,6 +77,8 @@ func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/resourcelink/update.go b/pkg/commands/resourcelink/update.go index fc1c2232c..eef8e793e 100644 --- a/pkg/commands/resourcelink/update.go +++ b/pkg/commands/resourcelink/update.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" fsterr "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -87,6 +88,8 @@ func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/serviceversion/activate.go b/pkg/commands/serviceversion/activate.go index 813ce2d76..dc5deff39 100644 --- a/pkg/commands/serviceversion/activate.go +++ b/pkg/commands/serviceversion/activate.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -53,6 +54,7 @@ func NewActivateCommand(parent argparser.Registerer, g *global.Data) *ActivateCo // Exec invokes the application logic for the command. func (c *ActivateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/serviceversion/clone.go b/pkg/commands/serviceversion/clone.go index c5fd0b239..804d2177a 100644 --- a/pkg/commands/serviceversion/clone.go +++ b/pkg/commands/serviceversion/clone.go @@ -48,7 +48,6 @@ func NewCloneCommand(parent argparser.Registerer, g *global.Data) *CloneCommand // Exec invokes the application logic for the command. func (c *CloneCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/serviceversion/deactivate.go b/pkg/commands/serviceversion/deactivate.go index 8551d1e88..ccb919701 100644 --- a/pkg/commands/serviceversion/deactivate.go +++ b/pkg/commands/serviceversion/deactivate.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -48,7 +49,7 @@ func NewDeactivateCommand(parent argparser.Registerer, g *global.Data) *Deactiva // Exec invokes the application logic for the command. func (c *DeactivateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, + Active: optional.Of(true), APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/serviceversion/lock.go b/pkg/commands/serviceversion/lock.go index 1a197d8fc..59819cce3 100644 --- a/pkg/commands/serviceversion/lock.go +++ b/pkg/commands/serviceversion/lock.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -48,7 +49,7 @@ func NewLockCommand(parent argparser.Registerer, g *global.Data) *LockCommand { // Exec invokes the application logic for the command. func (c *LockCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, + Locked: optional.Of(false), APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/serviceversion/serviceversion_test.go b/pkg/commands/serviceversion/serviceversion_test.go index be92db91c..1e50bd1b0 100644 --- a/pkg/commands/serviceversion/serviceversion_test.go +++ b/pkg/commands/serviceversion/serviceversion_test.go @@ -122,6 +122,13 @@ func TestVersionActivate(t *testing.T) { Arg: "--service-id 123", WantError: "error parsing arguments: required flag --version not provided", }, + { + Arg: "--service-id 123 --version 1", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + WantError: "service version 1 is active", + }, { Arg: "--service-id 123 --version 1 --autoclone", API: mock.API{ @@ -140,6 +147,15 @@ func TestVersionActivate(t *testing.T) { }, WantOutput: "Activated service 123 version 4", }, + { + Arg: "--service-id 123 --version 2 --autoclone", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + CloneVersionFn: testutil.CloneVersionResult(4), + ActivateVersionFn: activateVersionOK, + }, + WantOutput: "Activated service 123 version 4", + }, { Arg: "--service-id 123 --version 3 --autoclone", API: mock.API{ @@ -173,10 +189,10 @@ func TestVersionDeactivate(t *testing.T) { ListVersionsFn: testutil.ListVersions, DeactivateVersionFn: deactivateVersionOK, }, - WantOutput: "Deactivated service 123 version 3", + WantError: "service version 3 is not active", }, { - Arg: "--service-id 123 --version 3", + Arg: "--service-id 123 --version 1", API: mock.API{ ListVersionsFn: testutil.ListVersions, DeactivateVersionFn: deactivateVersionError, diff --git a/pkg/commands/vcl/condition/create.go b/pkg/commands/vcl/condition/create.go index d4db3f7c7..bd8891613 100644 --- a/pkg/commands/vcl/condition/create.go +++ b/pkg/commands/vcl/condition/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -76,6 +77,8 @@ func NewCreateCommand(parent argparser.Registerer, g *global.Data) *CreateComman // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/vcl/condition/delete.go b/pkg/commands/vcl/condition/delete.go index b0fd071a0..eba778f5f 100644 --- a/pkg/commands/vcl/condition/delete.go +++ b/pkg/commands/vcl/condition/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -62,6 +63,8 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/vcl/condition/describe.go b/pkg/commands/vcl/condition/describe.go index ffdfd22f9..4dcf0115d 100644 --- a/pkg/commands/vcl/condition/describe.go +++ b/pkg/commands/vcl/condition/describe.go @@ -61,7 +61,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/vcl/condition/list.go b/pkg/commands/vcl/condition/list.go index 152907837..1a7fc94c7 100644 --- a/pkg/commands/vcl/condition/list.go +++ b/pkg/commands/vcl/condition/list.go @@ -59,7 +59,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/vcl/condition/update.go b/pkg/commands/vcl/condition/update.go index 8429b0c68..569ef7535 100644 --- a/pkg/commands/vcl/condition/update.go +++ b/pkg/commands/vcl/condition/update.go @@ -6,6 +6,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -72,6 +73,8 @@ func NewUpdateCommand(parent argparser.Registerer, g *global.Data) *UpdateComman // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/vcl/custom/create.go b/pkg/commands/vcl/custom/create.go index b613357fe..355d7a6c3 100644 --- a/pkg/commands/vcl/custom/create.go +++ b/pkg/commands/vcl/custom/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -67,6 +68,8 @@ type CreateCommand struct { // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/vcl/custom/custom_test.go b/pkg/commands/vcl/custom/custom_test.go index f67d7707b..d7d0b247c 100644 --- a/pkg/commands/vcl/custom/custom_test.go +++ b/pkg/commands/vcl/custom/custom_test.go @@ -15,12 +15,20 @@ func TestVCLCustomCreate(t *testing.T) { var content string scenarios := []testutil.TestScenario{ { - Name: "validate missing --autoclone flag", + Name: "validate missing --autoclone flag with 'active' service", API: mock.API{ ListVersionsFn: testutil.ListVersions, }, Arg: "--content ./testdata/example.vcl --name foo --service-id 123 --version 1", - WantError: "service version 1 is not editable", + WantError: "service version 1 is active", + }, + { + Name: "validate missing --autoclone flag with 'locked' service", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + Arg: "--content ./testdata/example.vcl --name foo --service-id 123 --version 2", + WantError: "service version 2 is locked", }, { Name: "validate CreateVCL API error", @@ -178,12 +186,20 @@ func TestVCLCustomDelete(t *testing.T) { WantError: "error reading service: no service ID found", }, { - Name: "validate missing --autoclone flag", + Name: "validate missing --autoclone flag with 'active' service", API: mock.API{ ListVersionsFn: testutil.ListVersions, }, Arg: "--name foobar --service-id 123 --version 1", - WantError: "service version 1 is not editable", + WantError: "service version 1 is active", + }, + { + Name: "validate missing --autoclone flag with 'locked' service", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + Arg: "--name foobar --service-id 123 --version 2", + WantError: "service version 2 is locked", }, { Name: "validate DeleteVCL API error", @@ -348,12 +364,20 @@ func TestVCLCustomUpdate(t *testing.T) { WantError: "error reading service: no service ID found", }, { - Name: "validate missing --autoclone flag", + Name: "validate missing --autoclone flag with 'active' service", API: mock.API{ ListVersionsFn: testutil.ListVersions, }, Arg: "--name foobar --service-id 123 --version 1", - WantError: "service version 1 is not editable", + WantError: "service version 1 is active", + }, + { + Name: "validate missing --autoclone flag with 'locked' service", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + Arg: "--name foobar --service-id 123 --version 2", + WantError: "service version 2 is locked", }, { Name: "validate UpdateVCL API error", diff --git a/pkg/commands/vcl/custom/delete.go b/pkg/commands/vcl/custom/delete.go index e2272b61c..35aa5f886 100644 --- a/pkg/commands/vcl/custom/delete.go +++ b/pkg/commands/vcl/custom/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -63,6 +64,8 @@ type DeleteCommand struct { // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/vcl/custom/describe.go b/pkg/commands/vcl/custom/describe.go index 7cc2e9385..a404e7213 100644 --- a/pkg/commands/vcl/custom/describe.go +++ b/pkg/commands/vcl/custom/describe.go @@ -64,7 +64,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/vcl/custom/list.go b/pkg/commands/vcl/custom/list.go index 36cade8d4..da105c7e8 100644 --- a/pkg/commands/vcl/custom/list.go +++ b/pkg/commands/vcl/custom/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/vcl/custom/update.go b/pkg/commands/vcl/custom/update.go index a210694d2..ad714dbd7 100644 --- a/pkg/commands/vcl/custom/update.go +++ b/pkg/commands/vcl/custom/update.go @@ -6,6 +6,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" fsterr "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -68,6 +69,8 @@ type UpdateCommand struct { // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/vcl/snippet/create.go b/pkg/commands/vcl/snippet/create.go index 4345d8074..d71400df9 100644 --- a/pkg/commands/vcl/snippet/create.go +++ b/pkg/commands/vcl/snippet/create.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -75,6 +76,8 @@ type CreateCommand struct { // Exec invokes the application logic for the command. func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/vcl/snippet/delete.go b/pkg/commands/vcl/snippet/delete.go index d77a7877d..1a7bf5d61 100644 --- a/pkg/commands/vcl/snippet/delete.go +++ b/pkg/commands/vcl/snippet/delete.go @@ -5,6 +5,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -63,6 +64,8 @@ type DeleteCommand struct { // Exec invokes the application logic for the command. func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error { serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ + Active: optional.Of(false), + Locked: optional.Of(false), AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, diff --git a/pkg/commands/vcl/snippet/describe.go b/pkg/commands/vcl/snippet/describe.go index 3ef0f3c3f..77879cb99 100644 --- a/pkg/commands/vcl/snippet/describe.go +++ b/pkg/commands/vcl/snippet/describe.go @@ -68,7 +68,6 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/vcl/snippet/list.go b/pkg/commands/vcl/snippet/list.go index c2cccf3d6..9562509c4 100644 --- a/pkg/commands/vcl/snippet/list.go +++ b/pkg/commands/vcl/snippet/list.go @@ -63,7 +63,6 @@ func (c *ListCommand) Exec(_ io.Reader, out io.Writer) error { } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: true, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest, Out: out, diff --git a/pkg/commands/vcl/snippet/snippet_test.go b/pkg/commands/vcl/snippet/snippet_test.go index f05a67957..ff872e506 100644 --- a/pkg/commands/vcl/snippet/snippet_test.go +++ b/pkg/commands/vcl/snippet/snippet_test.go @@ -20,12 +20,20 @@ func TestVCLSnippetCreate(t *testing.T) { WantError: "error reading service: no service ID found", }, { - Name: "validate missing --autoclone flag", + Name: "validate missing --autoclone flag with 'active' service", API: mock.API{ ListVersionsFn: testutil.ListVersions, }, Arg: "--content ./testdata/snippet.vcl --name foo --type recv --service-id 123 --version 1", - WantError: "service version 1 is not editable", + WantError: "service version 1 is active", + }, + { + Name: "validate missing --autoclone flag with 'locked' service", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + Arg: "--content ./testdata/snippet.vcl --name foo --type recv --service-id 123 --version 2", + WantError: "service version 2 is locked", }, { Name: "validate CreateSnippet API error", @@ -213,12 +221,20 @@ func TestVCLSnippetDelete(t *testing.T) { WantError: "error reading service: no service ID found", }, { - Name: "validate missing --autoclone flag", + Name: "validate missing --autoclone flag with 'active' service", API: mock.API{ ListVersionsFn: testutil.ListVersions, }, Arg: "--name foobar --service-id 123 --version 1", - WantError: "service version 1 is not editable", + WantError: "service version 1 is active", + }, + { + Name: "validate missing --autoclone flag with 'locked' service", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + Arg: "--name foobar --service-id 123 --version 2", + WantError: "service version 2 is locked", }, { Name: "validate DeleteSnippet API error", @@ -396,12 +412,20 @@ func TestVCLSnippetUpdate(t *testing.T) { WantError: "error reading service: no service ID found", }, { - Name: "validate missing --autoclone flag", + Name: "validate missing --autoclone flag with 'active' service", API: mock.API{ ListVersionsFn: testutil.ListVersions, }, Arg: "--service-id 123 --version 1", - WantError: "service version 1 is not editable", + WantError: "service version 1 is active", + }, + { + Name: "validate missing --autoclone flag with 'locked' service", + API: mock.API{ + ListVersionsFn: testutil.ListVersions, + }, + Arg: "--service-id 123 --version 2", + WantError: "service version 2 is locked", }, { Name: "validate versioned snippet missing --name", diff --git a/pkg/commands/vcl/snippet/update.go b/pkg/commands/vcl/snippet/update.go index 34a286c85..443bb98a8 100644 --- a/pkg/commands/vcl/snippet/update.go +++ b/pkg/commands/vcl/snippet/update.go @@ -6,6 +6,7 @@ import ( "github.com/fastly/go-fastly/v9/fastly" + "4d63.com/optional" "github.com/fastly/cli/pkg/argparser" fsterr "github.com/fastly/cli/pkg/errors" "github.com/fastly/cli/pkg/global" @@ -77,8 +78,19 @@ type UpdateCommand struct { // Exec invokes the application logic for the command. func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error { + // in the normal case, we do not want to allow 'active' or 'locked' services to be updated, + // so we require those states to be 'false' + var allowActive = optional.Of(false) + var allowLocked = optional.Of(false) + if c.dynamic.WasSet && c.dynamic.Value { + // in this case, we will accept all states ('active' and 'inactive', 'locked' and 'unlocked'), + // so we mark the Optional[bool] fields as 'empty' and they will not be applied as filters + allowActive = optional.Empty[bool]() + allowLocked = optional.Empty[bool]() + } serviceID, serviceVersion, err := argparser.ServiceDetails(argparser.ServiceDetailsOpts{ - AllowActiveLocked: c.dynamic.WasSet && c.dynamic.Value, + Active: allowActive, + Locked: allowLocked, AutoCloneFlag: c.autoClone, APIClient: c.Globals.APIClient, Manifest: *c.Globals.Manifest,