Skip to content

Commit

Permalink
Custom expiration cli changes (#293)
Browse files Browse the repository at this point in the history
* Adding SDK changes for custom tunnel expiration

* adding related contracts

* updating contract to include seconds

---------

Co-authored-by: Utsa Santhosh <[email protected]>
  • Loading branch information
usanth and Utsa Santhosh authored Aug 24, 2023
1 parent 0f994c6 commit 1a549d5
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 14 deletions.
6 changes: 6 additions & 0 deletions cs/src/Contracts/Tunnel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,10 @@ public Tunnel()
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public DateTime? Expiration { get; set; }

/// <summary>
/// Gets or the custom amount of time the tunnel will be valid if it is not used or updated in seconds.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public uint? CustomExpiration { get; set; }
}
1 change: 1 addition & 0 deletions cs/src/Management/TunnelManagementClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,7 @@ private Tunnel ConvertTunnelForRequest(Tunnel tunnel)
Domain = tunnel.Domain,
Description = tunnel.Description,
Tags = tunnel.Tags,
CustomExpiration = tunnel.CustomExpiration,
Options = tunnel.Options,
AccessControl = tunnel.AccessControl == null ? null : new TunnelAccessControl(
tunnel.AccessControl.Where((ace) => !ace.IsInherited)),
Expand Down
32 changes: 18 additions & 14 deletions go/tunnels/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,44 @@ import (
// Data contract for tunnel objects managed through the tunnel service REST API.
type Tunnel struct {
// Gets or sets the ID of the cluster the tunnel was created in.
ClusterID string `json:"clusterId,omitempty"`
ClusterID string `json:"clusterId,omitempty"`

// Gets or sets the generated ID of the tunnel, unique within the cluster.
TunnelID string `json:"tunnelId,omitempty"`
TunnelID string `json:"tunnelId,omitempty"`

// Gets or sets the optional short name (alias) of the tunnel.
//
// The name must be globally unique within the parent domain, and must be a valid
// subdomain.
Name string `json:"name,omitempty"`
Name string `json:"name,omitempty"`

// Gets or sets the description of the tunnel.
Description string `json:"description,omitempty"`
Description string `json:"description,omitempty"`

// Gets or sets the tags of the tunnel.
Tags []string `json:"tags,omitempty"`
Tags []string `json:"tags,omitempty"`

// Gets or sets the optional parent domain of the tunnel, if it is not using the default
// parent domain.
Domain string `json:"domain,omitempty"`
Domain string `json:"domain,omitempty"`

// Gets or sets a dictionary mapping from scopes to tunnel access tokens.
AccessTokens map[TunnelAccessScope]string `json:"accessTokens,omitempty"`
AccessTokens map[TunnelAccessScope]string `json:"accessTokens,omitempty"`

// Gets or sets access control settings for the tunnel.
//
// See `TunnelAccessControl` documentation for details about the access control model.
AccessControl *TunnelAccessControl `json:"accessControl,omitempty"`
AccessControl *TunnelAccessControl `json:"accessControl,omitempty"`

// Gets or sets default options for the tunnel.
Options *TunnelOptions `json:"options,omitempty"`
Options *TunnelOptions `json:"options,omitempty"`

// Gets or sets current connection status of the tunnel.
Status *TunnelStatus `json:"status,omitempty"`
Status *TunnelStatus `json:"status,omitempty"`

// Gets or sets an array of endpoints where hosts are currently accepting client
// connections to the tunnel.
Endpoints []TunnelEndpoint `json:"endpoints,omitempty"`
Endpoints []TunnelEndpoint `json:"endpoints,omitempty"`

// Gets or sets a list of ports in the tunnel.
//
Expand All @@ -57,11 +57,15 @@ type Tunnel struct {
// creating a tunnel. It is omitted when listing (multiple) tunnels, or when updating
// tunnel properties. (For the latter, use APIs to create/update/delete individual ports
// instead.)
Ports []TunnelPort `json:"ports,omitempty"`
Ports []TunnelPort `json:"ports,omitempty"`

// Gets or sets the time in UTC of tunnel creation.
Created *time.Time `json:"created,omitempty"`
Created *time.Time `json:"created,omitempty"`

// Gets or the time the tunnel will be deleted if it is not used or updated.
Expiration *time.Time `json:"expiration,omitempty"`
Expiration *time.Time `json:"expiration,omitempty"`

// Gets or the custom amount of time the tunnel will be valid if it is not used or
// updated in seconds.
CustomExpiration uint32 `json:"customExpiration,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,11 @@ public class Tunnel {
*/
@Expose
public Date expiration;

/**
* Gets or the custom amount of time the tunnel will be valid if it is not used or
* updated in seconds.
*/
@Expose
public int customExpiration;
}
4 changes: 4 additions & 0 deletions rs/src/contracts/tunnel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,8 @@ pub struct Tunnel {

// Gets or the time the tunnel will be deleted if it is not used or updated.
pub expiration: Option<DateTime<Utc>>,

// Gets or the custom amount of time the tunnel will be valid if it is not used or
// updated in seconds.
pub custom_expiration: Option<u32>,
}
6 changes: 6 additions & 0 deletions ts/src/contracts/tunnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,10 @@ export interface Tunnel {
* Gets or the time the tunnel will be deleted if it is not used or updated.
*/
expiration?: Date;

/**
* Gets or the custom amount of time the tunnel will be valid if it is not used or
* updated in seconds.
*/
customExpiration?: number;
}

0 comments on commit 1a549d5

Please sign in to comment.