Merge pull request #67 from ngrok/pr/generated-63735be901

Update generated files
This commit is contained in:
Mo
2025-08-05 15:21:10 -05:00
committed by GitHub
5 changed files with 705 additions and 2 deletions
+4
View File
@@ -1,4 +1,8 @@
<!-- Code generated for API Clients. DO NOT EDIT. -->
## v7.4.0
* Add support for `vaults`
* Add support for `secrets`
## v7.3.0
* Add `version` to KubernetesOperatorDeploymentUpdate.
+2 -2
View File
@@ -21,11 +21,11 @@ The best place to get support using this library is through the [ngrok Slack Com
## Documentation
A quickstart guide and a full API reference are included in the [ngrok go API documentation on pkg.go.dev](https://pkg.go.dev/github.com/ngrok/ngrok-api-go/v6)
A quickstart guide and a full API reference are included in the [ngrok go API documentation on pkg.go.dev](https://pkg.go.dev/github.com/ngrok/ngrok-api-go/v7)
## Quickstart
Please consult the [documentation](https://pkg.go.dev/github.com/ngrok/ngrok-api-go/v6) for additional examples.
Please consult the [documentation](https://pkg.go.dev/github.com/ngrok/ngrok-api-go/v7) for additional examples.
### Create an IP Policy that allows traffic from some subnets
+256
View File
@@ -5910,6 +5910,140 @@ func (x *ReservedDomainCertJob) GoString() string {
return b.String()
}
type SecretCreate struct {
// Name of secret
Name string `json:"name,omitempty"`
// Value of secret
Value string `json:"value,omitempty"`
// Arbitrary user-defined metadata for this Secret
Metadata string `json:"metadata,omitempty"`
// description of Secret
Description string `json:"description,omitempty"`
// unique identifier of the referenced vault
VaultID string `json:"vault_id,omitempty"`
}
func (x *SecretCreate) String() string {
return x.GoString()
}
func (x *SecretCreate) GoString() string {
var b bytes.Buffer
fmt.Fprintf(&b, "SecretCreate {\n")
tw := tabwriter.NewWriter(&b, 0, 4, 0, ' ', 0)
fmt.Fprintf(tw, "\tName\t%v\n", x.Name)
fmt.Fprintf(tw, "\tValue\t%v\n", x.Value)
fmt.Fprintf(tw, "\tMetadata\t%v\n", x.Metadata)
fmt.Fprintf(tw, "\tDescription\t%v\n", x.Description)
fmt.Fprintf(tw, "\tVaultID\t%v\n", x.VaultID)
tw.Flush()
fmt.Fprintf(&b, "}\n")
return b.String()
}
type SecretUpdate struct {
// identifier for Secret
ID string `json:"id,omitempty"`
// Name of secret
Name *string `json:"name,omitempty"`
// Value of secret
Value *string `json:"value,omitempty"`
// Arbitrary user-defined metadata for this Secret
Metadata *string `json:"metadata,omitempty"`
// description of Secret
Description *string `json:"description,omitempty"`
}
func (x *SecretUpdate) String() string {
return fmt.Sprintf("SecretUpdate{ID: %v}", x.ID)
}
func (x *SecretUpdate) GoString() string {
var b bytes.Buffer
fmt.Fprintf(&b, "SecretUpdate {\n")
tw := tabwriter.NewWriter(&b, 0, 4, 0, ' ', 0)
fmt.Fprintf(tw, "\tID\t%v\n", x.ID)
fmt.Fprintf(tw, "\tName\t%v\n", x.Name)
fmt.Fprintf(tw, "\tValue\t%v\n", x.Value)
fmt.Fprintf(tw, "\tMetadata\t%v\n", x.Metadata)
fmt.Fprintf(tw, "\tDescription\t%v\n", x.Description)
tw.Flush()
fmt.Fprintf(&b, "}\n")
return b.String()
}
type Secret struct {
// identifier for Secret
ID string `json:"id,omitempty"`
// URI of this Secret API resource
URI string `json:"uri,omitempty"`
// Timestamp when the Secret was created (RFC 3339 format)
CreatedAt string `json:"created_at,omitempty"`
// Timestamp when the Secret was last updated (RFC 3339 format)
UpdatedAt string `json:"updated_at,omitempty"`
// Name of secret
Name string `json:"name,omitempty"`
// description of Secret
Description string `json:"description,omitempty"`
// Arbitrary user-defined metadata for this Secret
Metadata string `json:"metadata,omitempty"`
// Reference to who created this Secret
CreatedBy Ref `json:"created_by,omitempty"`
// Reference to who created this Secret
LastUpdatedBy Ref `json:"last_updated_by,omitempty"`
// Reference to the vault the secret is stored in
Vault Ref `json:"vault,omitempty"`
}
func (x *Secret) String() string {
return fmt.Sprintf("Secret{ID: %v}", x.ID)
}
func (x *Secret) GoString() string {
var b bytes.Buffer
fmt.Fprintf(&b, "Secret {\n")
tw := tabwriter.NewWriter(&b, 0, 4, 0, ' ', 0)
fmt.Fprintf(tw, "\tID\t%v\n", x.ID)
fmt.Fprintf(tw, "\tURI\t%v\n", x.URI)
fmt.Fprintf(tw, "\tCreatedAt\t%v\n", x.CreatedAt)
fmt.Fprintf(tw, "\tUpdatedAt\t%v\n", x.UpdatedAt)
fmt.Fprintf(tw, "\tName\t%v\n", x.Name)
fmt.Fprintf(tw, "\tDescription\t%v\n", x.Description)
fmt.Fprintf(tw, "\tMetadata\t%v\n", x.Metadata)
fmt.Fprintf(tw, "\tCreatedBy\t%v\n", x.CreatedBy)
fmt.Fprintf(tw, "\tLastUpdatedBy\t%v\n", x.LastUpdatedBy)
fmt.Fprintf(tw, "\tVault\t%v\n", x.Vault)
tw.Flush()
fmt.Fprintf(&b, "}\n")
return b.String()
}
type SecretList struct {
// The list of Secrets for this account
Secrets []Secret `json:"secrets,omitempty"`
URI string `json:"uri,omitempty"`
// URI of the next page of results, or null if there is no next page
NextPageURI *string `json:"next_page_uri,omitempty"`
}
func (x *SecretList) String() string {
return x.GoString()
}
func (x *SecretList) GoString() string {
var b bytes.Buffer
fmt.Fprintf(&b, "SecretList {\n")
tw := tabwriter.NewWriter(&b, 0, 4, 0, ' ', 0)
fmt.Fprintf(tw, "\tSecrets\t%v\n", x.Secrets)
fmt.Fprintf(tw, "\tURI\t%v\n", x.URI)
fmt.Fprintf(tw, "\tNextPageURI\t%v\n", x.NextPageURI)
tw.Flush()
fmt.Fprintf(&b, "}\n")
return b.String()
}
type SSHCertificateAuthorityCreate struct {
// human-readable description of this SSH Certificate Authority. optional, max 255
// bytes.
@@ -6828,3 +6962,125 @@ func (x *TunnelList) GoString() string {
fmt.Fprintf(&b, "}\n")
return b.String()
}
type VaultCreate struct {
// Name of vault
Name string `json:"name,omitempty"`
// Arbitrary user-defined metadata for this Vault
Metadata string `json:"metadata,omitempty"`
// description of Vault
Description string `json:"description,omitempty"`
}
func (x *VaultCreate) String() string {
return x.GoString()
}
func (x *VaultCreate) GoString() string {
var b bytes.Buffer
fmt.Fprintf(&b, "VaultCreate {\n")
tw := tabwriter.NewWriter(&b, 0, 4, 0, ' ', 0)
fmt.Fprintf(tw, "\tName\t%v\n", x.Name)
fmt.Fprintf(tw, "\tMetadata\t%v\n", x.Metadata)
fmt.Fprintf(tw, "\tDescription\t%v\n", x.Description)
tw.Flush()
fmt.Fprintf(&b, "}\n")
return b.String()
}
type VaultUpdate struct {
// identifier for Vault
ID string `json:"id,omitempty"`
// Name of vault
Name *string `json:"name,omitempty"`
// Arbitrary user-defined metadata for this Vault
Metadata *string `json:"metadata,omitempty"`
// description of Vault
Description *string `json:"description,omitempty"`
}
func (x *VaultUpdate) String() string {
return fmt.Sprintf("VaultUpdate{ID: %v}", x.ID)
}
func (x *VaultUpdate) GoString() string {
var b bytes.Buffer
fmt.Fprintf(&b, "VaultUpdate {\n")
tw := tabwriter.NewWriter(&b, 0, 4, 0, ' ', 0)
fmt.Fprintf(tw, "\tID\t%v\n", x.ID)
fmt.Fprintf(tw, "\tName\t%v\n", x.Name)
fmt.Fprintf(tw, "\tMetadata\t%v\n", x.Metadata)
fmt.Fprintf(tw, "\tDescription\t%v\n", x.Description)
tw.Flush()
fmt.Fprintf(&b, "}\n")
return b.String()
}
type Vault struct {
// identifier for Vault
ID string `json:"id,omitempty"`
// URI of this Vault API resource
URI string `json:"uri,omitempty"`
// Timestamp when the Vault was created (RFC 3339 format)
CreatedAt string `json:"created_at,omitempty"`
// Timestamp when the Vault was last updated (RFC 3339 format)
UpdatedAt string `json:"updated_at,omitempty"`
// Name of vault
Name string `json:"name,omitempty"`
// description of Vault
Description string `json:"description,omitempty"`
// Arbitrary user-defined metadata for this Vault
Metadata string `json:"metadata,omitempty"`
// Reference to who created this Vault
CreatedBy string `json:"created_by,omitempty"`
// Reference to who created this Vault
LastUpdatedBy string `json:"last_updated_by,omitempty"`
}
func (x *Vault) String() string {
return fmt.Sprintf("Vault{ID: %v}", x.ID)
}
func (x *Vault) GoString() string {
var b bytes.Buffer
fmt.Fprintf(&b, "Vault {\n")
tw := tabwriter.NewWriter(&b, 0, 4, 0, ' ', 0)
fmt.Fprintf(tw, "\tID\t%v\n", x.ID)
fmt.Fprintf(tw, "\tURI\t%v\n", x.URI)
fmt.Fprintf(tw, "\tCreatedAt\t%v\n", x.CreatedAt)
fmt.Fprintf(tw, "\tUpdatedAt\t%v\n", x.UpdatedAt)
fmt.Fprintf(tw, "\tName\t%v\n", x.Name)
fmt.Fprintf(tw, "\tDescription\t%v\n", x.Description)
fmt.Fprintf(tw, "\tMetadata\t%v\n", x.Metadata)
fmt.Fprintf(tw, "\tCreatedBy\t%v\n", x.CreatedBy)
fmt.Fprintf(tw, "\tLastUpdatedBy\t%v\n", x.LastUpdatedBy)
tw.Flush()
fmt.Fprintf(&b, "}\n")
return b.String()
}
type VaultList struct {
// The list of Vaults for this account
Vaults []Vault `json:"vaults,omitempty"`
URI string `json:"uri,omitempty"`
// URI of the next page of results, or null if there is no next page
NextPageURI *string `json:"next_page_uri,omitempty"`
}
func (x *VaultList) String() string {
return x.GoString()
}
func (x *VaultList) GoString() string {
var b bytes.Buffer
fmt.Fprintf(&b, "VaultList {\n")
tw := tabwriter.NewWriter(&b, 0, 4, 0, ' ', 0)
fmt.Fprintf(tw, "\tVaults\t%v\n", x.Vaults)
fmt.Fprintf(tw, "\tURI\t%v\n", x.URI)
fmt.Fprintf(tw, "\tNextPageURI\t%v\n", x.NextPageURI)
tw.Flush()
fmt.Fprintf(&b, "}\n")
return b.String()
}
+220
View File
@@ -0,0 +1,220 @@
// Code generated for API Clients. DO NOT EDIT.
package secrets
import (
"bytes"
"context"
"net/url"
"text/template"
"github.com/ngrok/ngrok-api-go/v7"
"github.com/ngrok/ngrok-api-go/v7/internal/api"
)
// Secrets is an api service for securely storing and managing sensitive data such
// as secrets, credentials, and tokens.
type Client struct {
apiClient *api.Client
}
func NewClient(cfg *ngrok.ClientConfig) *Client {
return &Client{apiClient: api.NewClient(cfg)}
}
// Create a new Secret
//
// https://ngrok.com/docs/api#api-secrets-create
func (c *Client) Create(ctx context.Context, arg *ngrok.SecretCreate) (*ngrok.Secret, error) {
var res ngrok.Secret
var path bytes.Buffer
if err := template.Must(template.New("create_path").Parse("/vault_secrets")).Execute(&path, arg); err != nil {
panic(err)
}
var (
apiURL = &url.URL{Path: path.String()}
bodyArg interface{}
)
apiURL.Path = path.String()
bodyArg = arg
if err := c.apiClient.Do(ctx, "POST", apiURL, bodyArg, &res); err != nil {
return nil, err
}
return &res, nil
}
// Update an existing Secret by ID
//
// https://ngrok.com/docs/api#api-secrets-update
func (c *Client) Update(ctx context.Context, arg *ngrok.SecretUpdate) (*ngrok.Secret, error) {
if arg == nil {
arg = new(ngrok.SecretUpdate)
}
var res ngrok.Secret
var path bytes.Buffer
if err := template.Must(template.New("update_path").Parse("/vault_secrets/{{ .ID }}")).Execute(&path, arg); err != nil {
panic(err)
}
arg.ID = ""
var (
apiURL = &url.URL{Path: path.String()}
bodyArg interface{}
)
apiURL.Path = path.String()
bodyArg = arg
if err := c.apiClient.Do(ctx, "PATCH", apiURL, bodyArg, &res); err != nil {
return nil, err
}
return &res, nil
}
// Delete a Secret
//
// https://ngrok.com/docs/api#api-secrets-delete
func (c *Client) Delete(ctx context.Context, id string) error {
arg := &ngrok.Item{ID: id}
var path bytes.Buffer
if err := template.Must(template.New("delete_path").Parse("/vault_secrets/{{ .ID }}")).Execute(&path, arg); err != nil {
panic(err)
}
arg.ID = ""
var (
apiURL = &url.URL{Path: path.String()}
bodyArg interface{}
)
apiURL.Path = path.String()
if err := c.apiClient.Do(ctx, "DELETE", apiURL, bodyArg, nil); err != nil {
return err
}
return nil
}
// Get a Secret by ID
//
// https://ngrok.com/docs/api#api-secrets-get
func (c *Client) Get(ctx context.Context, id string) (*ngrok.Secret, error) {
arg := &ngrok.Item{ID: id}
var res ngrok.Secret
var path bytes.Buffer
if err := template.Must(template.New("get_path").Parse("/vault_secrets/{{ .ID }}")).Execute(&path, arg); err != nil {
panic(err)
}
arg.ID = ""
var (
apiURL = &url.URL{Path: path.String()}
bodyArg interface{}
)
apiURL.Path = path.String()
if err := c.apiClient.Do(ctx, "GET", apiURL, bodyArg, &res); err != nil {
return nil, err
}
return &res, nil
}
// List all Secrets owned by account
//
// https://ngrok.com/docs/api#api-secrets-list
func (c *Client) List(paging *ngrok.Paging) ngrok.Iter[*ngrok.Secret] {
if paging == nil {
paging = new(ngrok.Paging)
}
var path bytes.Buffer
if err := template.Must(template.New("list_path").Parse("/vault_secrets")).Execute(&path, paging); err != nil {
panic(err)
}
var apiURL = &url.URL{Path: path.String()}
queryVals := make(url.Values)
if paging.BeforeID != nil {
queryVals.Set("before_id", *paging.BeforeID)
}
if paging.Limit != nil {
queryVals.Set("limit", *paging.Limit)
}
apiURL.RawQuery = queryVals.Encode()
return &iterSecret{
client: c,
n: -1,
nextPage: apiURL,
}
}
// iter allows the caller to iterate through a list of values while
// automatically fetching new pages worth of values from the API.
type iterSecret struct {
client *Client
n int
items []ngrok.Secret
err error
nextPage *url.URL
}
// Next returns true if there is another value available in the iterator. If it
// returs true it also advances the iterator to that next available item.
func (it *iterSecret) Next(ctx context.Context) bool {
// no more if there is an error
if it.err != nil {
return false
}
// advance the iterator
it.n += 1
// is there an available item?
if it.n < len(it.items) {
return true
}
// no more items, do we have a next page?
if it.nextPage == nil {
return false
}
// fetch the next page
var resp ngrok.SecretList
err := it.client.apiClient.Do(ctx, "GET", it.nextPage, nil, &resp)
if err != nil {
it.err = err
return false
}
// parse the next page URI as soon as we get it and store it
// so we can use it on the next fetch
if resp.NextPageURI != nil {
it.nextPage, it.err = url.Parse(*resp.NextPageURI)
if it.err != nil {
return false
}
} else {
it.nextPage = nil
}
// page with zero items means there are no more
if len(resp.Secrets) == 0 {
return false
}
it.n = -1
it.items = resp.Secrets
return it.Next(ctx)
}
// Item() returns the Secret currently
// pointed to by the iterator.
func (it *iterSecret) Item() *ngrok.Secret {
return &it.items[it.n]
}
// If Next() returned false because an error was encountered while fetching the
// next value Err() will return that error. A caller should always check Err()
// after Next() returns false.
func (it *iterSecret) Err() error {
return it.err
}
+223
View File
@@ -0,0 +1,223 @@
// Code generated for API Clients. DO NOT EDIT.
package vaults
import (
"bytes"
"context"
"net/url"
"text/template"
"github.com/ngrok/ngrok-api-go/v7"
"github.com/ngrok/ngrok-api-go/v7/internal/api"
)
// Vaults is an api service for securely storing and managing sensitive data such
// as secrets, credentials, and tokens.
type Client struct {
apiClient *api.Client
}
func NewClient(cfg *ngrok.ClientConfig) *Client {
return &Client{apiClient: api.NewClient(cfg)}
}
// Create a new Vault
//
// https://ngrok.com/docs/api#api-vaults-create
func (c *Client) Create(ctx context.Context, arg *ngrok.VaultCreate) (*ngrok.Vault, error) {
if arg == nil {
arg = new(ngrok.VaultCreate)
}
var res ngrok.Vault
var path bytes.Buffer
if err := template.Must(template.New("create_path").Parse("/vaults")).Execute(&path, arg); err != nil {
panic(err)
}
var (
apiURL = &url.URL{Path: path.String()}
bodyArg interface{}
)
apiURL.Path = path.String()
bodyArg = arg
if err := c.apiClient.Do(ctx, "POST", apiURL, bodyArg, &res); err != nil {
return nil, err
}
return &res, nil
}
// Update an existing Vault by ID
//
// https://ngrok.com/docs/api#api-vaults-update
func (c *Client) Update(ctx context.Context, arg *ngrok.VaultUpdate) (*ngrok.Vault, error) {
if arg == nil {
arg = new(ngrok.VaultUpdate)
}
var res ngrok.Vault
var path bytes.Buffer
if err := template.Must(template.New("update_path").Parse("/vaults/{{ .ID }}")).Execute(&path, arg); err != nil {
panic(err)
}
arg.ID = ""
var (
apiURL = &url.URL{Path: path.String()}
bodyArg interface{}
)
apiURL.Path = path.String()
bodyArg = arg
if err := c.apiClient.Do(ctx, "PATCH", apiURL, bodyArg, &res); err != nil {
return nil, err
}
return &res, nil
}
// Delete a Vault
//
// https://ngrok.com/docs/api#api-vaults-delete
func (c *Client) Delete(ctx context.Context, id string) error {
arg := &ngrok.Item{ID: id}
var path bytes.Buffer
if err := template.Must(template.New("delete_path").Parse("/vaults/{{ .ID }}")).Execute(&path, arg); err != nil {
panic(err)
}
arg.ID = ""
var (
apiURL = &url.URL{Path: path.String()}
bodyArg interface{}
)
apiURL.Path = path.String()
if err := c.apiClient.Do(ctx, "DELETE", apiURL, bodyArg, nil); err != nil {
return err
}
return nil
}
// Get a Vault by ID
//
// https://ngrok.com/docs/api#api-vaults-get
func (c *Client) Get(ctx context.Context, id string) (*ngrok.Vault, error) {
arg := &ngrok.Item{ID: id}
var res ngrok.Vault
var path bytes.Buffer
if err := template.Must(template.New("get_path").Parse("/vaults/{{ .ID }}")).Execute(&path, arg); err != nil {
panic(err)
}
arg.ID = ""
var (
apiURL = &url.URL{Path: path.String()}
bodyArg interface{}
)
apiURL.Path = path.String()
if err := c.apiClient.Do(ctx, "GET", apiURL, bodyArg, &res); err != nil {
return nil, err
}
return &res, nil
}
// List all Vaults owned by account
//
// https://ngrok.com/docs/api#api-vaults-list
func (c *Client) List(paging *ngrok.Paging) ngrok.Iter[*ngrok.Vault] {
if paging == nil {
paging = new(ngrok.Paging)
}
var path bytes.Buffer
if err := template.Must(template.New("list_path").Parse("/vaults")).Execute(&path, paging); err != nil {
panic(err)
}
var apiURL = &url.URL{Path: path.String()}
queryVals := make(url.Values)
if paging.BeforeID != nil {
queryVals.Set("before_id", *paging.BeforeID)
}
if paging.Limit != nil {
queryVals.Set("limit", *paging.Limit)
}
apiURL.RawQuery = queryVals.Encode()
return &iterVault{
client: c,
n: -1,
nextPage: apiURL,
}
}
// iter allows the caller to iterate through a list of values while
// automatically fetching new pages worth of values from the API.
type iterVault struct {
client *Client
n int
items []ngrok.Vault
err error
nextPage *url.URL
}
// Next returns true if there is another value available in the iterator. If it
// returs true it also advances the iterator to that next available item.
func (it *iterVault) Next(ctx context.Context) bool {
// no more if there is an error
if it.err != nil {
return false
}
// advance the iterator
it.n += 1
// is there an available item?
if it.n < len(it.items) {
return true
}
// no more items, do we have a next page?
if it.nextPage == nil {
return false
}
// fetch the next page
var resp ngrok.VaultList
err := it.client.apiClient.Do(ctx, "GET", it.nextPage, nil, &resp)
if err != nil {
it.err = err
return false
}
// parse the next page URI as soon as we get it and store it
// so we can use it on the next fetch
if resp.NextPageURI != nil {
it.nextPage, it.err = url.Parse(*resp.NextPageURI)
if it.err != nil {
return false
}
} else {
it.nextPage = nil
}
// page with zero items means there are no more
if len(resp.Vaults) == 0 {
return false
}
it.n = -1
it.items = resp.Vaults
return it.Next(ctx)
}
// Item() returns the Vault currently
// pointed to by the iterator.
func (it *iterVault) Item() *ngrok.Vault {
return &it.items[it.n]
}
// If Next() returned false because an error was encountered while fetching the
// next value Err() will return that error. A caller should always check Err()
// after Next() returns false.
func (it *iterVault) Err() error {
return it.err
}