Skip to content
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
4 changes: 2 additions & 2 deletions create/keyvaluestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ type keyValueStoreCmd struct {
Location string `placeholder:"nine-es34" help:"Location where the KeyValueStore instance is created."`
MemorySize string `help:"MemorySize configures KeyValueStore to use a specified amount of memory for the data set." placeholder:"1Gi"`
MaxMemoryPolicy storage.KeyValueStoreMaxMemoryPolicy `help:"MaxMemoryPolicy specifies the exact behavior KeyValueStore follows when the maxmemory limit is reached." placeholder:"allkeys-lru"`
AllowedCidrs []meta.IPv4CIDR `help:"AllowedCIDRs specify the allowed IP addresses, connecting to the instance." placeholder:"203.0.113.1/32"`
PublicNetworkingEnabled *bool `help:"Specifies if the service should be available without service connection." placeholder:"true"`
AllowedCidrs []meta.IPv4CIDR `help:"AllowedCIDRs specify the allowed IP addresses, connecting to the instance. These restrictions do not apply for service connections." placeholder:"203.0.113.1/32"`
PublicNetworkingEnabled *bool `help:"If public networking is \"false\", it is only possible to access the service by configuring a service connection." placeholder:"true"`
}

func (cmd *keyValueStoreCmd) Run(ctx context.Context, client *api.Client) error {
Expand Down
22 changes: 12 additions & 10 deletions create/opensearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import (

type openSearchCmd struct {
resourceCmd
Location string `help:"Location where the OpenSearch cluster is created." placeholder:"nine-es34"`
ClusterType storage.OpenSearchClusterType `help:"ClusterType specifies the type of OpenSearch cluster to create. Options: single, multi" placeholder:"single"`
MachineType string `help:"MachineType specifies the type of machine to use for the OpenSearch cluster." placeholder:"nine-search-s"`
AllowedCidrs []meta.IPv4CIDR `help:"AllowedCIDRs specify the allowed IP addresses, connecting to the cluster." placeholder:"203.0.113.1/32"`
BucketUsers []string `help:"BucketUsers specify the users who have read access to the OpenSearch snapshots bucket." placeholder:"user1,user2"`
Location string `help:"Location where the OpenSearch cluster is created." placeholder:"nine-es34"`
ClusterType storage.OpenSearchClusterType `help:"ClusterType specifies the type of OpenSearch cluster to create. Options: single, multi" placeholder:"single"`
MachineType string `help:"MachineType specifies the type of machine to use for the OpenSearch cluster." placeholder:"nine-search-s"`
AllowedCidrs []meta.IPv4CIDR `help:"AllowedCIDRs specify the allowed IP addresses, connecting to the cluster. These restrictions do not apply for service connections." placeholder:"203.0.113.1/32"`
BucketUsers []string `help:"BucketUsers specify the users who have read access to the OpenSearch snapshots bucket." placeholder:"user1,user2"`
PublicNetworkingEnabled *bool `help:"If public networking is \"false\", it is only possible to access the service by configuring a service connection." placeholder:"true"`
}

func (cmd *openSearchCmd) Run(ctx context.Context, client *api.Client) error {
Expand Down Expand Up @@ -66,11 +67,12 @@ func (cmd *openSearchCmd) newOpenSearch(namespace string) (*storage.OpenSearch,
},
},
ForProvider: storage.OpenSearchParameters{
Location: meta.LocationName(cmd.Location),
MachineType: infra.NewMachineType(cmd.MachineType),
ClusterType: cmd.ClusterType,
AllowedCIDRs: cmd.AllowedCidrs,
BucketUsers: LocalReferences(cmd.BucketUsers),
Location: meta.LocationName(cmd.Location),
MachineType: infra.NewMachineType(cmd.MachineType),
ClusterType: cmd.ClusterType,
AllowedCIDRs: cmd.AllowedCidrs,
BucketUsers: LocalReferences(cmd.BucketUsers),
PublicNetworkingEnabled: cmd.PublicNetworkingEnabled,
},
},
}
Expand Down
15 changes: 7 additions & 8 deletions update/keyvaluestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ type keyValueStoreCmd struct {
resourceCmd
MemorySize *string `help:"MemorySize configures KeyValueStore to use a specified amount of memory for the data set." placeholder:"1Gi"`
MaxMemoryPolicy *storage.KeyValueStoreMaxMemoryPolicy `help:"MaxMemoryPolicy specifies the exact behavior KeyValueStore follows when the maxmemory limit is reached." placeholder:"allkeys-lru"`
AllowedCidrs *[]meta.IPv4CIDR `help:"AllowedCIDRs specify the allowed IP addresses, connecting to the instance." placeholder:"203.0.113.1/32"`
PublicNetworkingEnabled *bool `help:"Specifies if the service should be available without service connection."`
AllowedCidrs *[]meta.IPv4CIDR `help:"AllowedCIDRs specify the allowed IP addresses, connecting to the instance. These restrictions do not apply for service connections." placeholder:"203.0.113.1/32"`
PublicNetworkingEnabled *bool `help:"If public networking is \"false\", it is only possible to access the service by configuring a service connection." placeholder:"true"`
}

func (cmd *keyValueStoreCmd) Run(ctx context.Context, client *api.Client) error {
Expand All @@ -38,24 +38,23 @@ func (cmd *keyValueStoreCmd) Run(ctx context.Context, client *api.Client) error
}).Update(ctx)
}

func (cmd *keyValueStoreCmd) applyUpdates(keyValueStore *storage.KeyValueStore) error {
func (cmd *keyValueStoreCmd) applyUpdates(kvs *storage.KeyValueStore) error {
if cmd.MemorySize != nil {
q, err := kresource.ParseQuantity(*cmd.MemorySize)
if err != nil {
return fmt.Errorf("error parsing memory size %q: %w", *cmd.MemorySize, err)
}

keyValueStore.Spec.ForProvider.MemorySize = &storage.KeyValueStoreMemorySize{Quantity: q}
kvs.Spec.ForProvider.MemorySize = &storage.KeyValueStoreMemorySize{Quantity: q}
}
if cmd.MaxMemoryPolicy != nil {
keyValueStore.Spec.ForProvider.MaxMemoryPolicy = *cmd.MaxMemoryPolicy
kvs.Spec.ForProvider.MaxMemoryPolicy = *cmd.MaxMemoryPolicy
}
if cmd.AllowedCidrs != nil {
keyValueStore.Spec.ForProvider.AllowedCIDRs = *cmd.AllowedCidrs
kvs.Spec.ForProvider.AllowedCIDRs = *cmd.AllowedCidrs
}

if cmd.PublicNetworkingEnabled != nil {
keyValueStore.Spec.ForProvider.PublicNetworkingEnabled = cmd.PublicNetworkingEnabled
kvs.Spec.ForProvider.PublicNetworkingEnabled = cmd.PublicNetworkingEnabled
}

return nil
Expand Down
18 changes: 11 additions & 7 deletions update/opensearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import (

type openSearchCmd struct {
resourceCmd
MachineType *string `help:"MachineType configures OpenSearch to use a specified machine type." placeholder:"nine-search-m"`
AllowedCidrs *[]meta.IPv4CIDR `help:"AllowedCIDRs specify the allowed IP addresses, connecting to the cluster." placeholder:"203.0.113.1/32"`
BucketUsers *[]string `help:"BucketUsers specify the users who have read access to the OpenSearch snapshots bucket." placeholder:"user1,user2"`
MachineType *string `help:"MachineType configures OpenSearch to use a specified machine type." placeholder:"nine-search-m"`
AllowedCidrs *[]meta.IPv4CIDR `help:"AllowedCIDRs specify the allowed IP addresses, connecting to the cluster. These restrictions do not apply for service connections." placeholder:"203.0.113.1/32"`
BucketUsers *[]string `help:"BucketUsers specify the users who have read access to the OpenSearch snapshots bucket." placeholder:"user1,user2"`
PublicNetworkingEnabled *bool `help:"If public networking is \"false\", it is only possible to access the service by configuring a service connection." placeholder:"true"`
}

func (cmd *openSearchCmd) Run(ctx context.Context, client *api.Client) error {
Expand All @@ -42,15 +43,18 @@ func (cmd *openSearchCmd) Run(ctx context.Context, client *api.Client) error {
}).Update(ctx)
}

func (cmd *openSearchCmd) applyUpdates(openSearch *storage.OpenSearch) error {
func (cmd *openSearchCmd) applyUpdates(os *storage.OpenSearch) error {
if cmd.MachineType != nil {
openSearch.Spec.ForProvider.MachineType = infra.NewMachineType(*cmd.MachineType)
os.Spec.ForProvider.MachineType = infra.NewMachineType(*cmd.MachineType)
}
if cmd.AllowedCidrs != nil {
openSearch.Spec.ForProvider.AllowedCIDRs = *cmd.AllowedCidrs
os.Spec.ForProvider.AllowedCIDRs = *cmd.AllowedCidrs
}
if cmd.BucketUsers != nil {
openSearch.Spec.ForProvider.BucketUsers = create.LocalReferences(*cmd.BucketUsers)
os.Spec.ForProvider.BucketUsers = create.LocalReferences(*cmd.BucketUsers)
}
if cmd.PublicNetworkingEnabled != nil {
os.Spec.ForProvider.PublicNetworkingEnabled = cmd.PublicNetworkingEnabled
}

return nil
Expand Down