Skip to content

Commit

Permalink
Add Delete method to Gateways
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Gealer committed Oct 14, 2022
1 parent e871152 commit 46baa33
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
8 changes: 8 additions & 0 deletions ignite.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ func (c ClientCategoryIgniteGateways) Get(ctx context.Context, id string, opts .
return &gw, nil
}

// Delete is used to delete a gateway by its ID.
func (c ClientCategoryIgniteGateways) Delete(ctx context.Context, id string, opts ...ClientOption) error {
return c.c.do(ctx, clientArgs{
method: "DELETE",
path: "/ignite/gateways/" + url.PathEscape(id),
}, opts)
}

// Create is used to create a deployment.
func (c ClientCategoryIgniteDeployments) Create(
ctx context.Context, deployment *types.DeploymentConfig, opts ...ClientOption,
Expand Down
15 changes: 15 additions & 0 deletions ignite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,21 @@ func TestClient_Ignite_Gateways_Get(t *testing.T) {
&types.Gateway{ID: "hello"})
}

func TestClient_Ignite_Gateways_Delete(t *testing.T) {
c := &mockClientDoer{
t: t,
wantMethod: "DELETE",
wantPath: "/ignite/gateways/test%20test",
wantIgnore404: false,
tokenType: "pat",
}
testApiSingleton(c,
&ClientCategoryIgniteGateways{c: c},
"Delete",
[]any{"test test"},
nil)
}

func TestClient_Ignite_Deployments_Create(t *testing.T) {
deploymentConfig := &types.DeploymentConfig{
DeploymentConfigPartial: types.DeploymentConfigPartial{
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hop

// Version is used to define a tagged version. This will be updated when a new version is released.
const Version = "1.5.0"
const Version = "1.6.0"

0 comments on commit 46baa33

Please sign in to comment.