Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breaking(objectstore): rename object-store command to kv-store #904

Merged
merged 6 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
16 changes: 8 additions & 8 deletions pkg/api/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,14 +343,14 @@ type Interface interface {
ListConfigStoreItems(i *fastly.ListConfigStoreItemsInput) ([]*fastly.ConfigStoreItem, error)
UpdateConfigStoreItem(i *fastly.UpdateConfigStoreItemInput) (*fastly.ConfigStoreItem, error)

CreateObjectStore(i *fastly.CreateObjectStoreInput) (*fastly.ObjectStore, error)
ListObjectStores(i *fastly.ListObjectStoresInput) (*fastly.ListObjectStoresResponse, error)
DeleteObjectStore(i *fastly.DeleteObjectStoreInput) error
GetObjectStore(i *fastly.GetObjectStoreInput) (*fastly.ObjectStore, error)
ListObjectStoreKeys(i *fastly.ListObjectStoreKeysInput) (*fastly.ListObjectStoreKeysResponse, error)
GetObjectStoreKey(i *fastly.GetObjectStoreKeyInput) (string, error)
DeleteObjectStoreKey(i *fastly.DeleteObjectStoreKeyInput) error
InsertObjectStoreKey(i *fastly.InsertObjectStoreKeyInput) error
CreateKVStore(i *fastly.CreateKVStoreInput) (*fastly.KVStore, error)
ListKVStores(i *fastly.ListKVStoresInput) (*fastly.ListKVStoresResponse, error)
DeleteKVStore(i *fastly.DeleteKVStoreInput) error
GetKVStore(i *fastly.GetKVStoreInput) (*fastly.KVStore, error)
ListKVStoreKeys(i *fastly.ListKVStoreKeysInput) (*fastly.ListKVStoreKeysResponse, error)
GetKVStoreKey(i *fastly.GetKVStoreKeyInput) (string, error)
DeleteKVStoreKey(i *fastly.DeleteKVStoreKeyInput) error
InsertKVStoreKey(i *fastly.InsertKVStoreKeyInput) error

CreateSecretStore(i *fastly.CreateSecretStoreInput) (*fastly.SecretStore, error)
GetSecretStore(i *fastly.GetSecretStoreInput) (*fastly.SecretStore, error)
Expand Down
39 changes: 19 additions & 20 deletions pkg/app/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/fastly/cli/pkg/commands/domain"
"github.com/fastly/cli/pkg/commands/healthcheck"
"github.com/fastly/cli/pkg/commands/ip"
kvstore "github.com/fastly/cli/pkg/commands/kvstore"
dennismartensson marked this conversation as resolved.
Show resolved Hide resolved
"github.com/fastly/cli/pkg/commands/logging"
"github.com/fastly/cli/pkg/commands/logging/azureblob"
"github.com/fastly/cli/pkg/commands/logging/bigquery"
Expand Down Expand Up @@ -42,8 +43,6 @@ import (
"github.com/fastly/cli/pkg/commands/logging/sumologic"
"github.com/fastly/cli/pkg/commands/logging/syslog"
"github.com/fastly/cli/pkg/commands/logtail"
"github.com/fastly/cli/pkg/commands/objectstore"
"github.com/fastly/cli/pkg/commands/objectstoreentry"
"github.com/fastly/cli/pkg/commands/pop"
"github.com/fastly/cli/pkg/commands/profile"
"github.com/fastly/cli/pkg/commands/purge"
Expand Down Expand Up @@ -309,16 +308,16 @@ func defineCommands(
loggingSyslogDescribe := syslog.NewDescribeCommand(loggingSyslogCmdRoot.CmdClause, g, m)
loggingSyslogList := syslog.NewListCommand(loggingSyslogCmdRoot.CmdClause, g, m)
loggingSyslogUpdate := syslog.NewUpdateCommand(loggingSyslogCmdRoot.CmdClause, g, m)
objectstoreCmdRoot := objectstore.NewRootCommand(app, g)
objectstoreCreate := objectstore.NewCreateCommand(objectstoreCmdRoot.CmdClause, g, m)
objectstoreDelete := objectstore.NewDeleteCommand(objectstoreCmdRoot.CmdClause, g, m)
objectstoreDescribe := objectstore.NewDescribeCommand(objectstoreCmdRoot.CmdClause, g, m)
objectstoreList := objectstore.NewListCommand(objectstoreCmdRoot.CmdClause, g, m)
objectstoreentryCmdRoot := objectstoreentry.NewRootCommand(app, g)
objectstoreentryCreate := objectstoreentry.NewCreateCommand(objectstoreentryCmdRoot.CmdClause, g, m)
objectstoreentryDelete := objectstoreentry.NewDeleteCommand(objectstoreentryCmdRoot.CmdClause, g, m)
objectstoreentryDescribe := objectstoreentry.NewDescribeCommand(objectstoreentryCmdRoot.CmdClause, g, m)
objectstoreentryList := objectstoreentry.NewListCommand(objectstoreentryCmdRoot.CmdClause, g, m)
kvstoreCmdRoot := kvstore.NewRootCommand(app, g)
kvstoreCreate := kvstore.NewCreateCommand(kvstoreCmdRoot.CmdClause, g, m)
kvstoreDelete := kvstore.NewDeleteCommand(kvstoreCmdRoot.CmdClause, g, m)
kvstoreDescribe := kvstore.NewDescribeCommand(kvstoreCmdRoot.CmdClause, g, m)
kvstoreList := kvstore.NewListCommand(kvstoreCmdRoot.CmdClause, g, m)
kvstoreentryCmdRoot := kvstoreentry.NewRootCommand(app, g)
kvstoreentryCreate := kvstoreentry.NewCreateCommand(kvstoreentryCmdRoot.CmdClause, g, m)
kvstoreentryDelete := kvstoreentry.NewDeleteCommand(kvstoreentryCmdRoot.CmdClause, g, m)
kvstoreentryDescribe := kvstoreentry.NewDescribeCommand(kvstoreentryCmdRoot.CmdClause, g, m)
kvstoreentryList := kvstoreentry.NewListCommand(kvstoreentryCmdRoot.CmdClause, g, m)
Integralist marked this conversation as resolved.
Show resolved Hide resolved
popCmdRoot := pop.NewRootCommand(app, g)
profileCmdRoot := profile.NewRootCommand(app, g)
profileCreate := profile.NewCreateCommand(profileCmdRoot.CmdClause, profile.APIClientFactory(opts.APIClient), g)
Expand Down Expand Up @@ -660,14 +659,14 @@ func defineCommands(
loggingSyslogDescribe,
loggingSyslogList,
loggingSyslogUpdate,
objectstoreCreate,
objectstoreDelete,
objectstoreDescribe,
objectstoreList,
objectstoreentryCreate,
objectstoreentryDelete,
objectstoreentryDescribe,
objectstoreentryList,
kvstoreCreate,
kvstoreDelete,
kvstoreDescribe,
kvstoreList,
kvstoreentryCreate,
kvstoreentryDelete,
kvstoreentryDescribe,
kvstoreentryList,
Integralist marked this conversation as resolved.
Show resolved Hide resolved
popCmdRoot,
profileCmdRoot,
profileCreate,
Expand Down
4 changes: 2 additions & 2 deletions pkg/app/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ healthcheck
ip-list
log-tail
logging
object-store
object-store-entry
kv-store
kv-store-entry
Integralist marked this conversation as resolved.
Show resolved Hide resolved
pops
profile
purge
Expand Down
6 changes: 3 additions & 3 deletions pkg/commands/compute/compute_mocks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ func createDictionaryItemOK(i *fastly.CreateDictionaryItemInput) (*fastly.Dictio
}, nil
}

func createObjectStoreOK(i *fastly.CreateObjectStoreInput) (*fastly.ObjectStore, error) {
return &fastly.ObjectStore{
func createKVStoreOK(i *fastly.CreateKVStoreInput) (*fastly.KVStore, error) {
return &fastly.KVStore{
ID: "example-store",
Name: i.Name,
}, nil
}

func createObjectStoreItemOK(i *fastly.InsertObjectStoreKeyInput) error {
func createKVStoreItemOK(i *fastly.InsertKVStoreKeyInput) error {
return nil
}

Expand Down
32 changes: 16 additions & 16 deletions pkg/commands/compute/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ func (c *DeployCommand) Exec(in io.Reader, out io.Writer) (err error) {
return nil
}

domains, backends, dictionaries, loggers, objectStores, err := constructSetupObjects(
domains, backends, dictionaries, loggers, kvStores, err := constructSetupKVs(
newService, serviceID, serviceVersion.Number, c, in, out,
)
if err != nil {
return err
}

if err := processSetupConfig(
newService, domains, backends, dictionaries, loggers, objectStores,
newService, domains, backends, dictionaries, loggers, kvStores,
serviceID, serviceVersion.Number, c,
); err != nil {
return err
Expand All @@ -148,7 +148,7 @@ func (c *DeployCommand) Exec(in io.Reader, out io.Writer) (err error) {
}(c.Globals.ErrLog)

if err := processSetupCreation(
newService, domains, backends, dictionaries, objectStores, spinner, c,
newService, domains, backends, dictionaries, kvStores, spinner, c,
serviceID, serviceVersion.Number,
); err != nil {
return err
Expand Down Expand Up @@ -839,7 +839,7 @@ func pkgUpload(spinner text.Spinner, client api.Interface, serviceID string, ver
return spinner.Stop()
}

func constructSetupObjects(
func constructSetupKVs(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if this should have been left as constructSetupObjects? Since setup.Backends, for example, aren't key-value stores. Working through merge conflicts in #769 and noticed this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@awilliams-fastly correct! I'm actually fixing this at the moment 🙂

newService bool,
serviceID string,
serviceVersion int,
Expand All @@ -851,7 +851,7 @@ func constructSetupObjects(
*setup.Backends,
*setup.Dictionaries,
*setup.Loggers,
*setup.ObjectStores,
*setup.KVStores,
error,
) {
var err error
Expand Down Expand Up @@ -892,7 +892,7 @@ func constructSetupObjects(
backends *setup.Backends
dictionaries *setup.Dictionaries
loggers *setup.Loggers
objectStores *setup.ObjectStores
kvStores *setup.KVStores
)

if newService {
Expand Down Expand Up @@ -923,19 +923,19 @@ func constructSetupObjects(
Stdout: out,
}

objectStores = &setup.ObjectStores{
kvStores = &setup.KVStores{
APIClient: c.Globals.APIClient,
AcceptDefaults: c.Globals.Flags.AcceptDefaults,
NonInteractive: c.Globals.Flags.NonInteractive,
ServiceID: serviceID,
ServiceVersion: serviceVersion,
Setup: c.Manifest.File.Setup.ObjectStores,
Setup: c.Manifest.File.Setup.KVStores,
Stdin: in,
Stdout: out,
}
}

return domains, backends, dictionaries, loggers, objectStores, nil
return domains, backends, dictionaries, loggers, kvStores, nil
}

func processSetupConfig(
Expand All @@ -944,7 +944,7 @@ func processSetupConfig(
backends *setup.Backends,
dictionaries *setup.Dictionaries,
loggers *setup.Loggers,
objectStores *setup.ObjectStores,
kvStores *setup.KVStores,
serviceID string,
serviceVersion int,
c *DeployCommand,
Expand Down Expand Up @@ -989,11 +989,11 @@ func processSetupConfig(
_ = loggers.Configure()
}

if objectStores.Predefined() {
err = objectStores.Configure()
if kvStores.Predefined() {
err = kvStores.Configure()
if err != nil {
errLogService(c.Globals.ErrLog, err, serviceID, serviceVersion)
return fmt.Errorf("error configuring service object stores: %w", err)
return fmt.Errorf("error configuring service kv stores: %w", err)
}
}
}
Expand All @@ -1006,7 +1006,7 @@ func processSetupCreation(
domains *setup.Domains,
backends *setup.Backends,
dictionaries *setup.Dictionaries,
objectStores *setup.ObjectStores,
kvStores *setup.KVStores,
spinner text.Spinner,
c *DeployCommand,
serviceID string,
Expand All @@ -1032,7 +1032,7 @@ func processSetupCreation(
if newService {
backends.Spinner = spinner
dictionaries.Spinner = spinner
objectStores.Spinner = spinner
kvStores.Spinner = spinner

if err := backends.Create(); err != nil {
c.Globals.ErrLog.AddWithContext(err, map[string]any{
Expand All @@ -1056,7 +1056,7 @@ func processSetupCreation(
return err
}

if err := objectStores.Create(); err != nil {
if err := kvStores.Create(); err != nil {
c.Globals.ErrLog.AddWithContext(err, map[string]any{
"Accept defaults": c.Globals.Flags.AcceptDefaults,
"Auto-yes": c.Globals.Flags.AutoYes,
Expand Down
Loading