Skip to content

Commit

Permalink
Merge pull request #3069 from shiftstack/liberal_slices
Browse files Browse the repository at this point in the history
Accept interfaces wherever possible
  • Loading branch information
EmilienM committed Jun 5, 2024
2 parents 3b144ad + d8924d4 commit 3bb883c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion openstack/containerinfra/v1/clusters/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (opts UpdateOpts) ToClustersUpdateMap() (map[string]any, error) {
}

// Update implements cluster updated request.
func Update(ctx context.Context, client *gophercloud.ServiceClient, id string, opts []UpdateOptsBuilder) (r UpdateResult) {
func Update[T UpdateOptsBuilder](ctx context.Context, client *gophercloud.ServiceClient, id string, opts []T) (r UpdateResult) {
var o []map[string]any
for _, opt := range opts {
b, err := opt.ToClustersUpdateMap()
Expand Down
2 changes: 1 addition & 1 deletion openstack/containerinfra/v1/clustertemplates/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (opts UpdateOpts) ToClusterTemplateUpdateMap() (map[string]any, error) {
}

// Update implements cluster updated request.
func Update(ctx context.Context, client *gophercloud.ServiceClient, id string, opts []UpdateOptsBuilder) (r UpdateResult) {
func Update[T UpdateOptsBuilder](ctx context.Context, client *gophercloud.ServiceClient, id string, opts []T) (r UpdateResult) {
var o []map[string]any
for _, opt := range opts {
b, err := opt.ToClusterTemplateUpdateMap()
Expand Down
2 changes: 1 addition & 1 deletion openstack/containerinfra/v1/nodegroups/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (opts UpdateOpts) ToResourceUpdateMap() (map[string]any, error) {
// one UpdateOpts can be passed at a time.
// Use the Extract method of the returned UpdateResult to extract the
// updated node group from the result.
func Update(ctx context.Context, client *gophercloud.ServiceClient, clusterID string, nodeGroupID string, opts []UpdateOptsBuilder) (r UpdateResult) {
func Update[T UpdateOptsBuilder](ctx context.Context, client *gophercloud.ServiceClient, clusterID string, nodeGroupID string, opts []T) (r UpdateResult) {
var o []map[string]any
for _, opt := range opts {
b, err := opt.ToResourceUpdateMap()
Expand Down
4 changes: 2 additions & 2 deletions openstack/loadbalancer/v2/pools/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ type CreateOpts struct {
//
// This is only possible to use when creating a fully populated
// Loadbalancer.
Monitor *monitors.CreateOpts `json:"healthmonitor,omitempty"`
Monitor monitors.CreateOptsBuilder `json:"healthmonitor,omitempty"`

// Tags is a set of resource tags. New in version 2.5
Tags []string `json:"tags,omitempty"`
Expand Down Expand Up @@ -476,7 +476,7 @@ func (opts BatchUpdateMemberOpts) ToBatchMemberUpdateMap() (map[string]any, erro
}

// BatchUpdateMembers updates the pool members in batch
func BatchUpdateMembers(ctx context.Context, c *gophercloud.ServiceClient, poolID string, opts []BatchUpdateMemberOpts) (r UpdateMembersResult) {
func BatchUpdateMembers[T BatchUpdateMemberOptsBuilder](ctx context.Context, c *gophercloud.ServiceClient, poolID string, opts []T) (r UpdateMembersResult) {
members := []map[string]any{}
for _, opt := range opts {
b, err := opt.ToBatchMemberUpdateMap()
Expand Down

0 comments on commit 3bb883c

Please sign in to comment.