29 lines
751 B
Go
29 lines
751 B
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"forge.cadoles.com/cadoles/bouncer/internal/admin"
|
|
"forge.cadoles.com/cadoles/bouncer/internal/store"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
type UpdateLayerOptions = admin.UpdateLayerRequest
|
|
|
|
func (c *Client) UpdateLayer(ctx context.Context, proxyName store.ProxyName, layerName store.LayerName, opts *UpdateLayerOptions, funcs ...OptionFunc) (*store.Layer, error) {
|
|
response := withResponse[admin.UpdateLayerResponse]()
|
|
|
|
path := fmt.Sprintf("/api/v1/proxies/%s/layers/%s", proxyName, layerName)
|
|
|
|
if err := c.apiPut(ctx, path, opts, &response); err != nil {
|
|
return nil, errors.WithStack(err)
|
|
}
|
|
|
|
if response.Error != nil {
|
|
return nil, errors.WithStack(response.Error)
|
|
}
|
|
|
|
return response.Data.Layer, nil
|
|
}
|