Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/app/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@
}
],
"apis": [
"https://developer.fastly.com/reference/api/services/resources/object-store-item/#set-value-for-key"
"https://developer.fastly.com/reference/api/services/resources/kv-store-item/#set-value-for-key"
]
}
},
Expand Down
9 changes: 5 additions & 4 deletions pkg/commands/configstore/configstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import (
"testing"
"time"

"github.com/fastly/go-fastly/v8/fastly"

"github.com/fastly/cli/pkg/app"
"github.com/fastly/cli/pkg/commands/configstore"
fstfmt "github.com/fastly/cli/pkg/fmt"
"github.com/fastly/cli/pkg/mock"
"github.com/fastly/cli/pkg/testutil"
"github.com/fastly/go-fastly/v8/fastly"
)

func TestCreateStoreCommand(t *testing.T) {
Expand Down Expand Up @@ -46,7 +47,7 @@ func TestCreateStoreCommand(t *testing.T) {
}, nil
},
},
WantOutput: fstfmt.Success("Created config store %s (name %s)", storeID, storeName),
WantOutput: fstfmt.Success("Created Config Store '%s' (%s)", storeName, storeID),
},
{
Args: testutil.Args(fmt.Sprintf("%s create --name %s --json", configstore.RootName, storeName)),
Expand Down Expand Up @@ -116,7 +117,7 @@ func TestDeleteStoreCommand(t *testing.T) {
return nil
},
},
WantOutput: fstfmt.Success("Deleted config store %s\n", storeID),
WantOutput: fstfmt.Success("Deleted Config Store '%s'\n", storeID),
},
{
Args: testutil.Args(fmt.Sprintf("%s delete --store-id %s --json", configstore.RootName, storeID)),
Expand Down Expand Up @@ -418,7 +419,7 @@ func TestUpdateStoreCommand(t *testing.T) {
}, nil
},
},
WantOutput: fstfmt.Success("Updated config store %s (name %s)", storeID, storeName),
WantOutput: fstfmt.Success("Updated Config Store '%s' (%s)", storeName, storeID),
},
{
Args: testutil.Args(fmt.Sprintf("%s update --store-id %s --name %s --json", configstore.RootName, storeID, storeName)),
Expand Down
5 changes: 3 additions & 2 deletions pkg/commands/configstore/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package configstore
import (
"io"

"github.com/fastly/go-fastly/v8/fastly"

"github.com/fastly/cli/pkg/cmd"
fsterr "github.com/fastly/cli/pkg/errors"
"github.com/fastly/cli/pkg/global"
"github.com/fastly/cli/pkg/manifest"
"github.com/fastly/cli/pkg/text"
"github.com/fastly/go-fastly/v8/fastly"
)

// NewCreateCommand returns a usable command registered under the parent.
Expand Down Expand Up @@ -62,7 +63,7 @@ func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error {
return err
}

text.Success(out, "Created config store %s (name %s)", o.ID, o.Name)
text.Success(out, "Created Config Store '%s' (%s)", o.Name, o.ID)

return nil
}
5 changes: 3 additions & 2 deletions pkg/commands/configstore/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package configstore
import (
"io"

"github.com/fastly/go-fastly/v8/fastly"

"github.com/fastly/cli/pkg/cmd"
fsterr "github.com/fastly/cli/pkg/errors"
"github.com/fastly/cli/pkg/global"
"github.com/fastly/cli/pkg/manifest"
"github.com/fastly/cli/pkg/text"
"github.com/fastly/go-fastly/v8/fastly"
)

// NewDeleteCommand returns a usable command registered under the parent.
Expand Down Expand Up @@ -64,7 +65,7 @@ func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error {
return err
}

text.Success(out, "Deleted config store %s", c.input.ID)
text.Success(out, "Deleted Config Store '%s'", c.input.ID)

return nil
}
5 changes: 3 additions & 2 deletions pkg/commands/configstore/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package configstore
import (
"io"

"github.com/fastly/go-fastly/v8/fastly"

"github.com/fastly/cli/pkg/cmd"
fsterr "github.com/fastly/cli/pkg/errors"
"github.com/fastly/cli/pkg/global"
"github.com/fastly/cli/pkg/manifest"
"github.com/fastly/cli/pkg/text"
"github.com/fastly/go-fastly/v8/fastly"
)

// NewUpdateCommand returns a usable command registered under the parent.
Expand Down Expand Up @@ -63,7 +64,7 @@ func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error {
return err
}

text.Success(out, "Updated config store %s (name %s)", o.ID, o.Name)
text.Success(out, "Updated Config Store '%s' (%s)", o.Name, o.ID)

return nil
}
9 changes: 5 additions & 4 deletions pkg/commands/configstoreentry/configstoreentry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import (
"testing"
"time"

"github.com/fastly/go-fastly/v8/fastly"

"github.com/fastly/cli/pkg/app"
"github.com/fastly/cli/pkg/commands/configstoreentry"
fstfmt "github.com/fastly/cli/pkg/fmt"
"github.com/fastly/cli/pkg/mock"
"github.com/fastly/cli/pkg/testutil"
"github.com/fastly/cli/pkg/text"
"github.com/fastly/go-fastly/v8/fastly"
)

func TestCreateEntryCommand(t *testing.T) {
Expand Down Expand Up @@ -49,7 +50,7 @@ func TestCreateEntryCommand(t *testing.T) {
}, nil
},
},
WantOutput: fstfmt.Success("Created config store item %s in store %s", itemKey, storeID),
WantOutput: fstfmt.Success("Created key '%s' in Config Store '%s'", itemKey, storeID),
},
{
Args: testutil.Args(fmt.Sprintf("%s create --store-id %s --key %s --value %s --json", configstoreentry.RootName, storeID, itemKey, itemValue)),
Expand Down Expand Up @@ -117,7 +118,7 @@ func TestDeleteEntryCommand(t *testing.T) {
return nil
},
},
WantOutput: fstfmt.Success("Deleted config store item %s from store %s", itemKey, storeID),
WantOutput: fstfmt.Success("Deleted key '%s' from Config Store '%s'", itemKey, storeID),
},
{
Args: testutil.Args(fmt.Sprintf("%s delete --store-id %s --key %s --json", configstoreentry.RootName, storeID, itemKey)),
Expand All @@ -128,7 +129,7 @@ func TestDeleteEntryCommand(t *testing.T) {
},
WantOutput: fstfmt.EncodeJSON(struct {
StoreID string `json:"store_id"`
Key string `json:"item_key"`
Key string `json:"key"`
Deleted bool `json:"deleted"`
}{
storeID,
Expand Down
5 changes: 3 additions & 2 deletions pkg/commands/configstoreentry/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package configstoreentry
import (
"io"

"github.com/fastly/go-fastly/v8/fastly"

"github.com/fastly/cli/pkg/cmd"
fsterr "github.com/fastly/cli/pkg/errors"
"github.com/fastly/cli/pkg/global"
"github.com/fastly/cli/pkg/manifest"
"github.com/fastly/cli/pkg/text"
"github.com/fastly/go-fastly/v8/fastly"
)

// NewCreateCommand returns a usable command registered under the parent.
Expand Down Expand Up @@ -103,7 +104,7 @@ func (c *CreateCommand) Exec(in io.Reader, out io.Writer) error {
return err
}

text.Success(out, "Created config store item %s in store %s", o.Key, o.StoreID)
text.Success(out, "Created key '%s' in Config Store '%s'", o.Key, o.StoreID)

return nil
}
7 changes: 4 additions & 3 deletions pkg/commands/configstoreentry/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package configstoreentry
import (
"io"

"github.com/fastly/go-fastly/v8/fastly"

"github.com/fastly/cli/pkg/cmd"
fsterr "github.com/fastly/cli/pkg/errors"
"github.com/fastly/cli/pkg/global"
"github.com/fastly/cli/pkg/manifest"
"github.com/fastly/cli/pkg/text"
"github.com/fastly/go-fastly/v8/fastly"
)

// NewDeleteCommand returns a usable command registered under the parent.
Expand Down Expand Up @@ -62,7 +63,7 @@ func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error {
if c.JSONOutput.Enabled {
o := struct {
StoreID string `json:"store_id"`
Key string `json:"item_key"`
Key string `json:"key"`
Deleted bool `json:"deleted"`
}{
c.input.StoreID,
Expand All @@ -73,7 +74,7 @@ func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error {
return err
}

text.Success(out, "Deleted config store item %s from store %s", c.input.Key, c.input.StoreID)
text.Success(out, "Deleted key '%s' from Config Store '%s'", c.input.Key, c.input.StoreID)

return nil
}
2 changes: 1 addition & 1 deletion pkg/commands/kvstore/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error {
return err
}

text.Success(out, "Created KV Store %s (name %s)", o.ID, o.Name)
text.Success(out, "Created KV Store '%s' (%s)", o.Name, o.ID)
return nil
}
2 changes: 1 addition & 1 deletion pkg/commands/kvstore/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error {
return err
}

text.Success(out, "Deleted KV Store %s", c.Input.ID)
text.Success(out, "Deleted KV Store '%s'", c.Input.ID)
return nil
}
4 changes: 2 additions & 2 deletions pkg/commands/kvstore/kvstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestCreateStoreCommand(t *testing.T) {
}, nil
},
},
WantOutput: fstfmt.Success("Created KV Store %s (name %s)", storeID, storeName),
WantOutput: fstfmt.Success("Created KV Store '%s' (%s)", storeName, storeID),
},
{
Args: testutil.Args(fmt.Sprintf("%s create --name %s --json", kvstore.RootName, storeName)),
Expand Down Expand Up @@ -118,7 +118,7 @@ func TestDeleteStoreCommand(t *testing.T) {
return nil
},
},
WantOutput: fstfmt.Success("Deleted KV Store %s\n", storeID),
WantOutput: fstfmt.Success("Deleted KV Store '%s'\n", storeID),
},
{
Args: testutil.Args(fmt.Sprintf("%s delete --store-id %s --json", kvstore.RootName, storeID)),
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/kvstoreentry/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (c *CreateCommand) Exec(in io.Reader, out io.Writer) error {
return err
}

text.Success(out, "Inserted key %s into KV Store %s", c.Input.Key, c.Input.ID)
text.Success(out, "Created key '%s' in KV Store '%s'", c.Input.Key, c.Input.ID)

return nil
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/commands/kvstoreentry/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error {
if c.JSONOutput.Enabled {
o := struct {
Key string `json:"key"`
ID string `json:"id"`
ID string `json:"store_id"`
Deleted bool `json:"deleted"`
}{
c.Input.Key,
Expand All @@ -67,6 +67,6 @@ func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error {
return err
}

text.Success(out, "Deleted key %s from KV Store %s", c.Input.Key, c.Input.ID)
text.Success(out, "Deleted key '%s' from KV Store '%s'", c.Input.Key, c.Input.ID)
return nil
}
6 changes: 3 additions & 3 deletions pkg/commands/kvstoreentry/kvstoreentry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestCreateCommand(t *testing.T) {
return nil
},
},
WantOutput: fstfmt.Success("Inserted key %s into KV Store %s", itemKey, storeID),
WantOutput: fstfmt.Success("Created key '%s' in KV Store '%s'", itemKey, storeID),
},
},
{
Expand Down Expand Up @@ -174,7 +174,7 @@ func TestDeleteCommand(t *testing.T) {
return nil
},
},
WantOutput: fstfmt.Success("Deleted key %s from KV Store %s", itemKey, storeID),
WantOutput: fstfmt.Success("Deleted key '%s' from KV Store '%s'", itemKey, storeID),
},
{
Args: testutil.Args(fmt.Sprintf("%s delete --store-id %s --key %s --json", kvstoreentry.RootName, storeID, itemKey)),
Expand All @@ -183,7 +183,7 @@ func TestDeleteCommand(t *testing.T) {
return nil
},
},
WantOutput: fstfmt.JSON(`{"key": "%s", "id": "%s", "deleted": true}`, itemKey, storeID),
WantOutput: fstfmt.JSON(`{"key": "%s", "store_id": "%s", "deleted": true}`, itemKey, storeID),
},
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/commands/secretstore/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package secretstore
import (
"io"

"github.com/fastly/go-fastly/v8/fastly"

"github.com/fastly/cli/pkg/cmd"
fsterr "github.com/fastly/cli/pkg/errors"
"github.com/fastly/cli/pkg/global"
"github.com/fastly/cli/pkg/manifest"
"github.com/fastly/cli/pkg/text"
"github.com/fastly/go-fastly/v8/fastly"
)

// NewCreateCommand returns a usable command registered under the parent.
Expand Down Expand Up @@ -56,7 +57,7 @@ func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error {
return err
}

text.Success(out, "Created secret store %s (name %s)", o.ID, o.Name)
text.Success(out, "Created Secret Store '%s' (%s)", o.Name, o.ID)

return nil
}
5 changes: 3 additions & 2 deletions pkg/commands/secretstore/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package secretstore
import (
"io"

"github.com/fastly/go-fastly/v8/fastly"

"github.com/fastly/cli/pkg/cmd"
fsterr "github.com/fastly/cli/pkg/errors"
"github.com/fastly/cli/pkg/global"
"github.com/fastly/cli/pkg/manifest"
"github.com/fastly/cli/pkg/text"
"github.com/fastly/go-fastly/v8/fastly"
)

// NewDeleteCommand returns a usable command registered under the parent.
Expand Down Expand Up @@ -64,7 +65,7 @@ func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error {
return err
}

text.Success(out, "Deleted secret store %s", c.Input.ID)
text.Success(out, "Deleted Secret Store '%s'", c.Input.ID)

return nil
}
Loading