27 lines
690 B
Go
27 lines
690 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"
|
||
|
)
|
||
|
|
||
|
func (c *Client) DeleteLayer(ctx context.Context, proxyName store.ProxyName, layerName store.LayerName, funcs ...OptionFunc) (store.LayerName, error) {
|
||
|
response := withResponse[admin.DeleteLayerResponse]()
|
||
|
|
||
|
path := fmt.Sprintf("/api/v1/proxies/%s/layers/%s", proxyName, layerName)
|
||
|
|
||
|
if err := c.apiDelete(ctx, path, nil, &response, funcs...); err != nil {
|
||
|
return "", errors.WithStack(err)
|
||
|
}
|
||
|
|
||
|
if response.Error != nil {
|
||
|
return "", errors.WithStack(response.Error)
|
||
|
}
|
||
|
|
||
|
return response.Data.LayerName, nil
|
||
|
}
|