Skip to content

Commit

Permalink
feat(config-store): Add Config Store commands
Browse files Browse the repository at this point in the history
- https://developer.fastly.com/reference/api/services/resources/config-store/
- https://developer.fastly.com/reference/api/services/resources/config-store-item/

Related `go-fastly` change: fastly/go-fastly#398

```
USAGE
  fastly config-store <command> [<args> ...]

COMMANDS
  config-store
  create         Create a new config store
  delete         Delete a config store
  describe       Retrieve a single config store
  list           List config stores
  list-services  List config store's services
  update         Update a config store
```

```
USAGE
  fastly config-store-entry <command> [<args> ...]

COMMANDS
  config-store-entry
  create    Create a new config store item
  delete    Delete a config store item
  describe  Retrieve a single config store item
  list      List config store items
  update    Update a config store item
```
  • Loading branch information
awilliams-fastly committed Mar 15, 2023
1 parent 5b7155a commit f429d79
Show file tree
Hide file tree
Showing 28 changed files with 2,304 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -29,7 +29,7 @@ require (
)

require (
github.com/fastly/go-fastly/v7 v7.3.0
github.com/fastly/go-fastly/v7 v7.5.0
github.com/kennygrant/sanitize v1.2.4
github.com/mholt/archiver v3.1.1+incompatible
github.com/otiai10/copy v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -18,8 +18,8 @@ github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5/go.mod h1:qssHWj6
github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY=
github.com/dustinkirkland/golang-petname v0.0.0-20191129215211-8e5a1ed0cff0 h1:90Ly+6UfUypEF6vvvW5rQIv9opIL8CbmW9FT20LDQoY=
github.com/dustinkirkland/golang-petname v0.0.0-20191129215211-8e5a1ed0cff0/go.mod h1:V+Qd57rJe8gd4eiGzZyg4h54VLHmYVVw54iMnlAMrF8=
github.com/fastly/go-fastly/v7 v7.3.0 h1:QG8rjm95DC2YLv8B64sHy2XhOfjfTRpx5dT/6uo/j8E=
github.com/fastly/go-fastly/v7 v7.3.0/go.mod h1:K32VeBzD+RJikDMUSKPpYfno8YBMXmNWjgGAn6I/OU8=
github.com/fastly/go-fastly/v7 v7.5.0 h1:5keaPPC8YA3seDKx5n0JVLhvgs4WmNtHl043Pey+Ho8=
github.com/fastly/go-fastly/v7 v7.5.0/go.mod h1:/Z2GD7NuxV3vVMAyrtckg1WvZVnCuM2Z8ok/z70XTEQ=
github.com/fastly/kingpin v2.1.12-0.20191105091915-95d230a53780+incompatible h1:FhrXlfhgGCS+uc6YwyiFUt04alnjpoX7vgDKJxS6Qbk=
github.com/fastly/kingpin v2.1.12-0.20191105091915-95d230a53780+incompatible/go.mod h1:U8UynVoU1SQaqD2I4ZqgYd5lx3A1ipQYn4aSt2Y5h6c=
github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w=
Expand Down
14 changes: 14 additions & 0 deletions pkg/api/interface.go
Expand Up @@ -329,6 +329,20 @@ type Interface interface {
UpdateServiceAuthorization(i *fastly.UpdateServiceAuthorizationInput) (*fastly.ServiceAuthorization, error)
DeleteServiceAuthorization(i *fastly.DeleteServiceAuthorizationInput) error

CreateConfigStore(i *fastly.CreateConfigStoreInput) (*fastly.ConfigStore, error)
DeleteConfigStore(i *fastly.DeleteConfigStoreInput) error
GetConfigStore(i *fastly.GetConfigStoreInput) (*fastly.ConfigStore, error)
GetConfigStoreMetadata(i *fastly.GetConfigStoreMetadataInput) (*fastly.ConfigStoreMetadata, error)
ListConfigStores() ([]*fastly.ConfigStore, error)
ListConfigStoreServices(i *fastly.ListConfigStoreServicesInput) ([]*fastly.Service, error)
UpdateConfigStore(i *fastly.UpdateConfigStoreInput) (*fastly.ConfigStore, error)

CreateConfigStoreItem(i *fastly.CreateConfigStoreItemInput) (*fastly.ConfigStoreItem, error)
DeleteConfigStoreItem(i *fastly.DeleteConfigStoreItemInput) error
GetConfigStoreItem(i *fastly.GetConfigStoreItemInput) (*fastly.ConfigStoreItem, error)
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
Expand Down
28 changes: 28 additions & 0 deletions pkg/app/commands.go
Expand Up @@ -8,6 +8,8 @@ import (
"github.com/fastly/cli/pkg/commands/backend"
"github.com/fastly/cli/pkg/commands/compute"
"github.com/fastly/cli/pkg/commands/config"
"github.com/fastly/cli/pkg/commands/configstore"
"github.com/fastly/cli/pkg/commands/configstoreentry"
"github.com/fastly/cli/pkg/commands/dictionary"
"github.com/fastly/cli/pkg/commands/dictionaryentry"
"github.com/fastly/cli/pkg/commands/domain"
Expand Down Expand Up @@ -115,6 +117,19 @@ func defineCommands(
computeUpdate := compute.NewUpdateCommand(computeCmdRoot.CmdClause, g, m)
computeValidate := compute.NewValidateCommand(computeCmdRoot.CmdClause, g, m)
configCmdRoot := config.NewRootCommand(app, g)
configstoreCmdRoot := configstore.NewRootCommand(app, g)
configstoreCreate := configstore.NewCreateCommand(configstoreCmdRoot.CmdClause, g, m)
configstoreDelete := configstore.NewDeleteCommand(configstoreCmdRoot.CmdClause, g, m)
configstoreDescribe := configstore.NewDescribeCommand(configstoreCmdRoot.CmdClause, g, m)
configstoreList := configstore.NewListCommand(configstoreCmdRoot.CmdClause, g, m)
configstoreListServices := configstore.NewListServicesCommand(configstoreCmdRoot.CmdClause, g, m)
configstoreUpdate := configstore.NewUpdateCommand(configstoreCmdRoot.CmdClause, g, m)
configstoreentryCmdRoot := configstoreentry.NewRootCommand(app, g)
configstoreentryCreate := configstoreentry.NewCreateCommand(configstoreentryCmdRoot.CmdClause, g, m)
configstoreentryDelete := configstoreentry.NewDeleteCommand(configstoreentryCmdRoot.CmdClause, g, m)
configstoreentryDescribe := configstoreentry.NewDescribeCommand(configstoreentryCmdRoot.CmdClause, g, m)
configstoreentryList := configstoreentry.NewListCommand(configstoreentryCmdRoot.CmdClause, g, m)
configstoreentryUpdate := configstoreentry.NewUpdateCommand(configstoreentryCmdRoot.CmdClause, g, m)
dictionaryCmdRoot := dictionary.NewRootCommand(app, g)
dictionaryCreate := dictionary.NewCreateCommand(dictionaryCmdRoot.CmdClause, g, m)
dictionaryDelete := dictionary.NewDeleteCommand(dictionaryCmdRoot.CmdClause, g, m)
Expand Down Expand Up @@ -447,6 +462,19 @@ func defineCommands(
computeUpdate,
computeValidate,
configCmdRoot,
configstoreCmdRoot,
configstoreCreate,
configstoreDelete,
configstoreDescribe,
configstoreList,
configstoreListServices,
configstoreUpdate,
configstoreentryCmdRoot,
configstoreentryCreate,
configstoreentryDelete,
configstoreentryDescribe,
configstoreentryList,
configstoreentryUpdate,
dictionaryCmdRoot,
dictionaryCreate,
dictionaryDelete,
Expand Down
2 changes: 2 additions & 0 deletions pkg/app/run_test.go
Expand Up @@ -63,6 +63,8 @@ auth-token
backend
compute
config
config-store
config-store-entry
dictionary
dictionary-entry
domain
Expand Down

0 comments on commit f429d79

Please sign in to comment.