Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add forceCreate and forceUpdate query params #335

Merged
merged 5 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions cs/src/Management/TunnelManagementClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ public async Task<Tunnel> CreateTunnelAsync(
tunnel,
ManageAccessTokenScope,
path: null,
query: GetApiQuery(),
query: GetApiQuery() + "&forceCreate=true",
options,
ConvertTunnelForRequest(tunnel),
cancellation,
Expand Down Expand Up @@ -973,7 +973,7 @@ public async Task<Tunnel> UpdateTunnelAsync(
tunnel,
ManageAccessTokenScope,
path: null,
query: GetApiQuery(),
query: GetApiQuery() + "&forceUpdate=true",
options,
ConvertTunnelForRequest(tunnel),
cancellation);
Expand Down Expand Up @@ -1117,7 +1117,7 @@ public async Task<TunnelPort> CreateTunnelPortAsync(
tunnel,
ManagePortsAccessTokenScopes,
path,
query: GetApiQuery(),
query: GetApiQuery() + "&forceCreate=true",
options,
ConvertTunnelPortForRequest(tunnel, tunnelPort),
cancellation))!;
Expand Down Expand Up @@ -1159,7 +1159,7 @@ public async Task<TunnelPort> UpdateTunnelPortAsync(
tunnel,
ManagePortsAccessTokenScopes,
path,
query: GetApiQuery(),
query: GetApiQuery() + "&forceUpdate=true",
options,
ConvertTunnelPortForRequest(tunnel, tunnelPort),
cancellation))!;
Expand Down
8 changes: 4 additions & 4 deletions go/tunnels/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (m *Manager) CreateTunnel(ctx context.Context, tunnel *Tunnel, options *Tun
if tunnel.TunnelID == "" {
tunnel.TunnelID = generateTunnelId()
}
url, err := m.buildTunnelSpecificUri(tunnel, "", options, "", true)
url, err := m.buildTunnelSpecificUri(tunnel, "", options, "forceCreate=true", true)
if err != nil {
return nil, fmt.Errorf("error creating request url: %w", err)
}
Expand Down Expand Up @@ -221,7 +221,7 @@ func (m *Manager) UpdateTunnel(ctx context.Context, tunnel *Tunnel, updateFields
return nil, fmt.Errorf("tunnel must be provided")
}

url, err := m.buildTunnelSpecificUri(tunnel, "", options, "", false)
url, err := m.buildTunnelSpecificUri(tunnel, "", options, "forceUpdate=true", false)
if err != nil {
return nil, fmt.Errorf("error creating request url: %w", err)
}
Expand Down Expand Up @@ -384,7 +384,7 @@ func (m *Manager) CreateTunnelPort(
ctx context.Context, tunnel *Tunnel, port *TunnelPort, options *TunnelRequestOptions,
) (tp *TunnelPort, err error) {
path := fmt.Sprintf("%s/%d", portsApiSubPath, port.PortNumber)
url, err := m.buildTunnelSpecificUri(tunnel, path, options, "", false)
url, err := m.buildTunnelSpecificUri(tunnel, path, options, "forceCreate=true", false)
if err != nil {
return nil, fmt.Errorf("error creating tunnel url: %w", err)
}
Expand Down Expand Up @@ -427,7 +427,7 @@ func (m *Manager) UpdateTunnelPort(
return nil, fmt.Errorf("cluster ids do not match")
}
path := fmt.Sprintf("%s/%d", portsApiSubPath, port.PortNumber)
url, err := m.buildTunnelSpecificUri(tunnel, path, options, "", false)
url, err := m.buildTunnelSpecificUri(tunnel, path, options, "forceUpdate=true", false)
if err != nil {
return nil, fmt.Errorf("error creating tunnel url: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion go/tunnels/tunnels.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/rodaine/table"
)

const PackageVersion = "0.1.1"
const PackageVersion = "0.1.2"

func (tunnel *Tunnel) requestObject() (*Tunnel, error) {
convertedTunnel := &Tunnel{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ public CompletableFuture<Tunnel> createTunnelAsync(Tunnel tunnel, TunnelRequestO
if (generatedId) {
tunnel.tunnelId = IdGeneration.generateTunnelId();
}
var uri = buildUri(tunnel, options, true);
var uri = buildUri(tunnel, options, null, "forceCreate=true", true);
final Type responseType = new TypeToken<Tunnel>() {
}.getType();
for (int i = 0; i <= 3; i++){
Expand Down Expand Up @@ -444,7 +444,7 @@ private Tunnel convertTunnelForRequest(Tunnel tunnel) {

@Override
public CompletableFuture<Tunnel> updateTunnelAsync(Tunnel tunnel, TunnelRequestOptions options) {
var uri = buildUri(tunnel, options, true);
var uri = buildUri(tunnel, options, null, "forceUpdate=true", true);
final Type responseType = new TypeToken<Tunnel>() {
}.getType();
return requestAsync(
Expand Down Expand Up @@ -607,7 +607,9 @@ public CompletableFuture<TunnelPort> createTunnelPortAsync(
var uri = buildUri(
tunnel,
options,
path);
path,
"forceCreate=true",
false);
final Type responseType = new TypeToken<TunnelPort>() {
}.getType();
CompletableFuture<TunnelPort> result = requestAsync(
Expand Down Expand Up @@ -689,7 +691,9 @@ public CompletableFuture<TunnelPort> updateTunnelPortAsync(
var uri = buildUri(
tunnel,
options,
path);
path,
"forceUpdate=true",
false);

final Type responseType = new TypeToken<TunnelPort>() {
}.getType();
Expand Down
12 changes: 7 additions & 5 deletions ts/src/management/tunnelManagementHttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export class TunnelManagementHttpClient implements TunnelManagementClient {
tunnel,
manageAccessTokenScope,
undefined,
undefined,
"forceCreate=true",
options,
this.convertTunnelForRequest(tunnel),
undefined,
Expand All @@ -283,9 +283,11 @@ export class TunnelManagementHttpClient implements TunnelManagementClient {
tunnel,
manageAccessTokenScope,
undefined,
undefined,
"forceCreate=true",
options,
this.convertTunnelForRequest(tunnel),
undefined,
true,
))!;
preserveAccessTokens(tunnel, result2);
parseTunnelDates(result2);
Expand All @@ -298,7 +300,7 @@ export class TunnelManagementHttpClient implements TunnelManagementClient {
tunnel,
manageAccessTokenScope,
undefined,
undefined,
"forceUpdate=true",
options,
this.convertTunnelForRequest(tunnel),
))!;
Expand Down Expand Up @@ -439,7 +441,7 @@ export class TunnelManagementHttpClient implements TunnelManagementClient {
tunnel,
managePortsAccessTokenScopes,
path,
undefined,
"forceCreate=true",
options,
tunnelPort,
))!;
Expand Down Expand Up @@ -473,7 +475,7 @@ export class TunnelManagementHttpClient implements TunnelManagementClient {
tunnel,
managePortsAccessTokenScopes,
path,
undefined,
"forceUpdate=true",
options,
tunnelPort,
))!;
Expand Down
Loading