From 6d825f2af92bc7e5f25dec98851739b85157de39 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 12 Apr 2024 01:15:37 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#1776) --- warp_connector/warpconnector.go | 2219 ++++++++++++++++--------------- zero_trust/tunnel.go | 1284 +++++++++--------- 2 files changed, 1754 insertions(+), 1749 deletions(-) diff --git a/warp_connector/warpconnector.go b/warp_connector/warpconnector.go index 6eb5ac72521..caf5464dfef 100644 --- a/warp_connector/warpconnector.go +++ b/warp_connector/warpconnector.go @@ -3,21 +3,21 @@ package warp_connector import ( - "context" - "fmt" - "net/http" - "net/url" - "reflect" - "time" - - "github.com/cloudflare/cloudflare-go/v2/internal/apijson" - "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" - "github.com/cloudflare/cloudflare-go/v2/internal/pagination" - "github.com/cloudflare/cloudflare-go/v2/internal/param" - "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" - "github.com/cloudflare/cloudflare-go/v2/option" - "github.com/tidwall/gjson" + "context" + "fmt" + "net/http" + "net/url" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-go/v2/internal/apijson" + "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" + "github.com/cloudflare/cloudflare-go/v2/internal/pagination" + "github.com/cloudflare/cloudflare-go/v2/internal/param" + "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" + "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // WARPConnectorService contains methods and other services that help with @@ -26,175 +26,175 @@ import ( // this service directly, and instead use the [NewWARPConnectorService] method // instead. type WARPConnectorService struct { -Options []option.RequestOption + Options []option.RequestOption } // NewWARPConnectorService generates a new service that applies the given options // to each request. These options are applied after the parent client's options (if // there is one), and before any request-specific options. func NewWARPConnectorService(opts ...option.RequestOption) (r *WARPConnectorService) { - r = &WARPConnectorService{} - r.Options = opts - return + r = &WARPConnectorService{} + r.Options = opts + return } // Creates a new Warp Connector Tunnel in an account. func (r *WARPConnectorService) New(ctx context.Context, params WARPConnectorNewParams, opts ...option.RequestOption) (res *WARPConnectorNewResponse, err error) { - opts = append(r.Options[:], opts...) - var env WARPConnectorNewResponseEnvelope - path := fmt.Sprintf("accounts/%s/warp_connector", params.AccountID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return + opts = append(r.Options[:], opts...) + var env WARPConnectorNewResponseEnvelope + path := fmt.Sprintf("accounts/%s/warp_connector", params.AccountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return } // Lists and filters Warp Connector Tunnels in an account. func (r *WARPConnectorService) List(ctx context.Context, params WARPConnectorListParams, opts ...option.RequestOption) (res *pagination.V4PagePaginationArray[WARPConnectorListResponse], err error) { - var raw *http.Response - opts = append(r.Options, opts...) - opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) - path := fmt.Sprintf("accounts/%s/warp_connector", params.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, params, &res, opts...) - if err != nil { - return nil, err - } - err = cfg.Execute() - if err != nil { - return nil, err - } - res.SetPageConfig(cfg, raw) - return res, nil + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/warp_connector", params.AccountID) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, params, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil } // Lists and filters Warp Connector Tunnels in an account. -func (r *WARPConnectorService) ListAutoPaging(ctx context.Context, params WARPConnectorListParams, opts ...option.RequestOption) (*pagination.V4PagePaginationArrayAutoPager[WARPConnectorListResponse]) { - return pagination.NewV4PagePaginationArrayAutoPager(r.List(ctx, params, opts...)) +func (r *WARPConnectorService) ListAutoPaging(ctx context.Context, params WARPConnectorListParams, opts ...option.RequestOption) *pagination.V4PagePaginationArrayAutoPager[WARPConnectorListResponse] { + return pagination.NewV4PagePaginationArrayAutoPager(r.List(ctx, params, opts...)) } // Deletes a Warp Connector Tunnel from an account. func (r *WARPConnectorService) Delete(ctx context.Context, tunnelID string, params WARPConnectorDeleteParams, opts ...option.RequestOption) (res *WARPConnectorDeleteResponse, err error) { - opts = append(r.Options[:], opts...) - var env WARPConnectorDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/warp_connector/%s", params.AccountID, tunnelID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return + opts = append(r.Options[:], opts...) + var env WARPConnectorDeleteResponseEnvelope + path := fmt.Sprintf("accounts/%s/warp_connector/%s", params.AccountID, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return } // Updates an existing Warp Connector Tunnel. func (r *WARPConnectorService) Edit(ctx context.Context, tunnelID string, params WARPConnectorEditParams, opts ...option.RequestOption) (res *WARPConnectorEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env WARPConnectorEditResponseEnvelope - path := fmt.Sprintf("accounts/%s/warp_connector/%s", params.AccountID, tunnelID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return + opts = append(r.Options[:], opts...) + var env WARPConnectorEditResponseEnvelope + path := fmt.Sprintf("accounts/%s/warp_connector/%s", params.AccountID, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return } // Fetches a single Warp Connector Tunnel. func (r *WARPConnectorService) Get(ctx context.Context, tunnelID string, query WARPConnectorGetParams, opts ...option.RequestOption) (res *WARPConnectorGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env WARPConnectorGetResponseEnvelope - path := fmt.Sprintf("accounts/%s/warp_connector/%s", query.AccountID, tunnelID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return + opts = append(r.Options[:], opts...) + var env WARPConnectorGetResponseEnvelope + path := fmt.Sprintf("accounts/%s/warp_connector/%s", query.AccountID, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return } // Gets the token used to associate warp device with a specific Warp Connector // tunnel. func (r *WARPConnectorService) Token(ctx context.Context, tunnelID string, query WARPConnectorTokenParams, opts ...option.RequestOption) (res *WARPConnectorTokenResponseUnion, err error) { - opts = append(r.Options[:], opts...) - var env WARPConnectorTokenResponseEnvelope - path := fmt.Sprintf("accounts/%s/warp_connector/%s/token", query.AccountID, tunnelID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return + opts = append(r.Options[:], opts...) + var env WARPConnectorTokenResponseEnvelope + path := fmt.Sprintf("accounts/%s/warp_connector/%s/token", query.AccountID, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return } // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. type WARPConnectorNewResponse struct { -// Cloudflare account ID -AccountTag string `json:"account_tag"` -Connections interface{} `json:"connections,required"` -// Timestamp of when the tunnel established at least one connection to Cloudflare's -// edge. If `null`, the tunnel is inactive. -ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` -// Timestamp of when the tunnel became inactive (no connections to Cloudflare's -// edge). If `null`, the tunnel is active. -ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` -// Timestamp of when the tunnel was created. -CreatedAt time.Time `json:"created_at" format:"date-time"` -// Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been -// deleted. -DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` -// UUID of the tunnel. -ID string `json:"id"` -Metadata interface{} `json:"metadata,required"` -// A user-friendly name for the tunnel. -Name string `json:"name"` -// If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. -// If `false`, the tunnel must be configured locally on the origin machine. -RemoteConfig bool `json:"remote_config"` -// The status of the tunnel. Valid values are `inactive` (tunnel has never been -// run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy -// state), `healthy` (tunnel is active and able to serve traffic), or `down` -// (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). -Status string `json:"status"` -// The type of tunnel. -TunType shared.WARPConnectorNewResponseTunType `json:"tun_type"` -JSON warpConnectorNewResponseJSON `json:"-"` -union WARPConnectorNewResponseUnion + // Cloudflare account ID + AccountTag string `json:"account_tag"` + Connections interface{} `json:"connections,required"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // UUID of the tunnel. + ID string `json:"id"` + Metadata interface{} `json:"metadata,required"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + // If `false`, the tunnel must be configured locally on the origin machine. + RemoteConfig bool `json:"remote_config"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType WARPConnectorNewResponseTunType `json:"tun_type"` + JSON warpConnectorNewResponseJSON `json:"-"` + union WARPConnectorNewResponseUnion } // warpConnectorNewResponseJSON contains the JSON metadata for the struct // [WARPConnectorNewResponse] type warpConnectorNewResponseJSON struct { -AccountTag apijson.Field -Connections apijson.Field -ConnsActiveAt apijson.Field -ConnsInactiveAt apijson.Field -CreatedAt apijson.Field -DeletedAt apijson.Field -ID apijson.Field -Metadata apijson.Field -Name apijson.Field -RemoteConfig apijson.Field -Status apijson.Field -TunType apijson.Field -raw string -ExtraFields map[string]apijson.Field -} - -func (r warpConnectorNewResponseJSON) RawJSON() (string) { - return r.raw + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + ID apijson.Field + Metadata apijson.Field + Name apijson.Field + RemoteConfig apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r warpConnectorNewResponseJSON) RawJSON() string { + return r.raw } func (r *WARPConnectorNewResponse) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) + err = apijson.UnmarshalRoot(data, &r.union) + if err != nil { + return err + } + return apijson.Port(r.union, &r) } -func (r WARPConnectorNewResponse) AsUnion() (WARPConnectorNewResponseUnion) { - return r.union +func (r WARPConnectorNewResponse) AsUnion() WARPConnectorNewResponseUnion { + return r.union } // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. @@ -202,238 +202,239 @@ func (r WARPConnectorNewResponse) AsUnion() (WARPConnectorNewResponseUnion) { // Union satisfied by [shared.CloudflareTunnel] or // [warp_connector.WARPConnectorNewResponseTunnelWARPConnectorTunnel]. type WARPConnectorNewResponseUnion interface { - ImplementsWARPConnectorWARPConnectorNewResponse() + ImplementsWARPConnectorWARPConnectorNewResponse() } func init() { - apijson.RegisterUnion( - reflect.TypeOf((*WARPConnectorNewResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(shared.CloudflareTunnel{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(WARPConnectorNewResponseTunnelWARPConnectorTunnel{}), - }, - ) + apijson.RegisterUnion( + reflect.TypeOf((*WARPConnectorNewResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(shared.CloudflareTunnel{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(WARPConnectorNewResponseTunnelWARPConnectorTunnel{}), + }, + ) } // A Warp Connector Tunnel that connects your origin to Cloudflare's edge. type WARPConnectorNewResponseTunnelWARPConnectorTunnel struct { -// UUID of the tunnel. -ID string `json:"id"` -// Cloudflare account ID -AccountTag string `json:"account_tag"` -// The Cloudflare Tunnel connections between your origin and Cloudflare's edge. -Connections []WARPConnectorNewResponseTunnelWARPConnectorTunnelConnection `json:"connections"` -// Timestamp of when the tunnel established at least one connection to Cloudflare's -// edge. If `null`, the tunnel is inactive. -ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` -// Timestamp of when the tunnel became inactive (no connections to Cloudflare's -// edge). If `null`, the tunnel is active. -ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` -// Timestamp of when the tunnel was created. -CreatedAt time.Time `json:"created_at" format:"date-time"` -// Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been -// deleted. -DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` -// Metadata associated with the tunnel. -Metadata interface{} `json:"metadata"` -// A user-friendly name for the tunnel. -Name string `json:"name"` -// The status of the tunnel. Valid values are `inactive` (tunnel has never been -// run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy -// state), `healthy` (tunnel is active and able to serve traffic), or `down` -// (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). -Status string `json:"status"` -// The type of tunnel. -TunType WARPConnectorNewResponseTunnelWARPConnectorTunnelTunType `json:"tun_type"` -JSON warpConnectorNewResponseTunnelWARPConnectorTunnelJSON `json:"-"` + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []WARPConnectorNewResponseTunnelWARPConnectorTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType WARPConnectorNewResponseTunnelWARPConnectorTunnelTunType `json:"tun_type"` + JSON warpConnectorNewResponseTunnelWARPConnectorTunnelJSON `json:"-"` } // warpConnectorNewResponseTunnelWARPConnectorTunnelJSON contains the JSON metadata // for the struct [WARPConnectorNewResponseTunnelWARPConnectorTunnel] type warpConnectorNewResponseTunnelWARPConnectorTunnelJSON struct { -ID apijson.Field -AccountTag apijson.Field -Connections apijson.Field -ConnsActiveAt apijson.Field -ConnsInactiveAt apijson.Field -CreatedAt apijson.Field -DeletedAt apijson.Field -Metadata apijson.Field -Name apijson.Field -Status apijson.Field -TunType apijson.Field -raw string -ExtraFields map[string]apijson.Field + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *WARPConnectorNewResponseTunnelWARPConnectorTunnel) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r warpConnectorNewResponseTunnelWARPConnectorTunnelJSON) RawJSON() (string) { - return r.raw +func (r warpConnectorNewResponseTunnelWARPConnectorTunnelJSON) RawJSON() string { + return r.raw } -func (r WARPConnectorNewResponseTunnelWARPConnectorTunnel) ImplementsWARPConnectorWARPConnectorNewResponse() {} +func (r WARPConnectorNewResponseTunnelWARPConnectorTunnel) ImplementsWARPConnectorWARPConnectorNewResponse() { +} type WARPConnectorNewResponseTunnelWARPConnectorTunnelConnection struct { -// UUID of the Cloudflare Tunnel connection. -ID string `json:"id"` -// UUID of the cloudflared instance. -ClientID interface{} `json:"client_id"` -// The cloudflared version used to establish this connection. -ClientVersion string `json:"client_version"` -// The Cloudflare data center used for this connection. -ColoName string `json:"colo_name"` -// Cloudflare continues to track connections for several minutes after they -// disconnect. This is an optimization to improve latency and reliability of -// reconnecting. If `true`, the connection has disconnected but is still being -// tracked. If `false`, the connection is actively serving traffic. -IsPendingReconnect bool `json:"is_pending_reconnect"` -// Timestamp of when the connection was established. -OpenedAt time.Time `json:"opened_at" format:"date-time"` -// The public IP address of the host running cloudflared. -OriginIP string `json:"origin_ip"` -// UUID of the Cloudflare Tunnel connection. -UUID string `json:"uuid"` -JSON warpConnectorNewResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + UUID string `json:"uuid"` + JSON warpConnectorNewResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` } // warpConnectorNewResponseTunnelWARPConnectorTunnelConnectionJSON contains the // JSON metadata for the struct // [WARPConnectorNewResponseTunnelWARPConnectorTunnelConnection] type warpConnectorNewResponseTunnelWARPConnectorTunnelConnectionJSON struct { -ID apijson.Field -ClientID apijson.Field -ClientVersion apijson.Field -ColoName apijson.Field -IsPendingReconnect apijson.Field -OpenedAt apijson.Field -OriginIP apijson.Field -UUID apijson.Field -raw string -ExtraFields map[string]apijson.Field + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + UUID apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *WARPConnectorNewResponseTunnelWARPConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r warpConnectorNewResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() (string) { - return r.raw +func (r warpConnectorNewResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() string { + return r.raw } // The type of tunnel. type WARPConnectorNewResponseTunnelWARPConnectorTunnelTunType string const ( - WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel WARPConnectorNewResponseTunnelWARPConnectorTunnelTunType = "cfd_tunnel" - WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeWARPConnector WARPConnectorNewResponseTunnelWARPConnectorTunnelTunType = "warp_connector" - WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeIPSec WARPConnectorNewResponseTunnelWARPConnectorTunnelTunType = "ip_sec" - WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeGRE WARPConnectorNewResponseTunnelWARPConnectorTunnelTunType = "gre" - WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeCNI WARPConnectorNewResponseTunnelWARPConnectorTunnelTunType = "cni" + WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel WARPConnectorNewResponseTunnelWARPConnectorTunnelTunType = "cfd_tunnel" + WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeWARPConnector WARPConnectorNewResponseTunnelWARPConnectorTunnelTunType = "warp_connector" + WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeIPSec WARPConnectorNewResponseTunnelWARPConnectorTunnelTunType = "ip_sec" + WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeGRE WARPConnectorNewResponseTunnelWARPConnectorTunnelTunType = "gre" + WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeCNI WARPConnectorNewResponseTunnelWARPConnectorTunnelTunType = "cni" ) -func (r WARPConnectorNewResponseTunnelWARPConnectorTunnelTunType) IsKnown() (bool) { - switch r { - case WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel, WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeWARPConnector, WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeIPSec, WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeGRE, WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeCNI: - return true - } - return false +func (r WARPConnectorNewResponseTunnelWARPConnectorTunnelTunType) IsKnown() bool { + switch r { + case WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel, WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeWARPConnector, WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeIPSec, WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeGRE, WARPConnectorNewResponseTunnelWARPConnectorTunnelTunTypeCNI: + return true + } + return false } // The type of tunnel. -type shared.WARPConnectorNewResponseTunType string +type WARPConnectorNewResponseTunType string const ( - shared.WARPConnectorNewResponseTunTypeCfdTunnel shared.WARPConnectorNewResponseTunType = "cfd_tunnel" - shared.WARPConnectorNewResponseTunTypeWARPConnector shared.WARPConnectorNewResponseTunType = "warp_connector" - shared.WARPConnectorNewResponseTunTypeIPSec shared.WARPConnectorNewResponseTunType = "ip_sec" - shared.WARPConnectorNewResponseTunTypeGRE shared.WARPConnectorNewResponseTunType = "gre" - shared.WARPConnectorNewResponseTunTypeCNI shared.WARPConnectorNewResponseTunType = "cni" + WARPConnectorNewResponseTunTypeCfdTunnel WARPConnectorNewResponseTunType = "cfd_tunnel" + WARPConnectorNewResponseTunTypeWARPConnector WARPConnectorNewResponseTunType = "warp_connector" + WARPConnectorNewResponseTunTypeIPSec WARPConnectorNewResponseTunType = "ip_sec" + WARPConnectorNewResponseTunTypeGRE WARPConnectorNewResponseTunType = "gre" + WARPConnectorNewResponseTunTypeCNI WARPConnectorNewResponseTunType = "cni" ) -func (r shared.WARPConnectorNewResponseTunType) IsKnown() (bool) { - switch r { - case shared.WARPConnectorNewResponseTunTypeCfdTunnel, shared.WARPConnectorNewResponseTunTypeWARPConnector, shared.WARPConnectorNewResponseTunTypeIPSec, shared.WARPConnectorNewResponseTunTypeGRE, shared.WARPConnectorNewResponseTunTypeCNI: - return true - } - return false +func (r WARPConnectorNewResponseTunType) IsKnown() bool { + switch r { + case WARPConnectorNewResponseTunTypeCfdTunnel, WARPConnectorNewResponseTunTypeWARPConnector, WARPConnectorNewResponseTunTypeIPSec, WARPConnectorNewResponseTunTypeGRE, WARPConnectorNewResponseTunTypeCNI: + return true + } + return false } // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. type WARPConnectorListResponse struct { -// Cloudflare account ID -AccountTag string `json:"account_tag"` -Connections interface{} `json:"connections,required"` -// Timestamp of when the tunnel established at least one connection to Cloudflare's -// edge. If `null`, the tunnel is inactive. -ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` -// Timestamp of when the tunnel became inactive (no connections to Cloudflare's -// edge). If `null`, the tunnel is active. -ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` -// Timestamp of when the tunnel was created. -CreatedAt time.Time `json:"created_at" format:"date-time"` -// Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been -// deleted. -DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` -// UUID of the tunnel. -ID string `json:"id"` -Metadata interface{} `json:"metadata,required"` -// A user-friendly name for the tunnel. -Name string `json:"name"` -// If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. -// If `false`, the tunnel must be configured locally on the origin machine. -RemoteConfig bool `json:"remote_config"` -// The status of the tunnel. Valid values are `inactive` (tunnel has never been -// run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy -// state), `healthy` (tunnel is active and able to serve traffic), or `down` -// (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). -Status string `json:"status"` -// The type of tunnel. -TunType shared.WARPConnectorListResponseTunType `json:"tun_type"` -JSON warpConnectorListResponseJSON `json:"-"` -union WARPConnectorListResponseUnion + // Cloudflare account ID + AccountTag string `json:"account_tag"` + Connections interface{} `json:"connections,required"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // UUID of the tunnel. + ID string `json:"id"` + Metadata interface{} `json:"metadata,required"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + // If `false`, the tunnel must be configured locally on the origin machine. + RemoteConfig bool `json:"remote_config"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType WARPConnectorListResponseTunType `json:"tun_type"` + JSON warpConnectorListResponseJSON `json:"-"` + union WARPConnectorListResponseUnion } // warpConnectorListResponseJSON contains the JSON metadata for the struct // [WARPConnectorListResponse] type warpConnectorListResponseJSON struct { -AccountTag apijson.Field -Connections apijson.Field -ConnsActiveAt apijson.Field -ConnsInactiveAt apijson.Field -CreatedAt apijson.Field -DeletedAt apijson.Field -ID apijson.Field -Metadata apijson.Field -Name apijson.Field -RemoteConfig apijson.Field -Status apijson.Field -TunType apijson.Field -raw string -ExtraFields map[string]apijson.Field -} - -func (r warpConnectorListResponseJSON) RawJSON() (string) { - return r.raw + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + ID apijson.Field + Metadata apijson.Field + Name apijson.Field + RemoteConfig apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r warpConnectorListResponseJSON) RawJSON() string { + return r.raw } func (r *WARPConnectorListResponse) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) + err = apijson.UnmarshalRoot(data, &r.union) + if err != nil { + return err + } + return apijson.Port(r.union, &r) } -func (r WARPConnectorListResponse) AsUnion() (WARPConnectorListResponseUnion) { - return r.union +func (r WARPConnectorListResponse) AsUnion() WARPConnectorListResponseUnion { + return r.union } // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. @@ -441,238 +442,239 @@ func (r WARPConnectorListResponse) AsUnion() (WARPConnectorListResponseUnion) { // Union satisfied by [shared.CloudflareTunnel] or // [warp_connector.WARPConnectorListResponseTunnelWARPConnectorTunnel]. type WARPConnectorListResponseUnion interface { - ImplementsWARPConnectorWARPConnectorListResponse() + ImplementsWARPConnectorWARPConnectorListResponse() } func init() { - apijson.RegisterUnion( - reflect.TypeOf((*WARPConnectorListResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(shared.CloudflareTunnel{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(WARPConnectorListResponseTunnelWARPConnectorTunnel{}), - }, - ) + apijson.RegisterUnion( + reflect.TypeOf((*WARPConnectorListResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(shared.CloudflareTunnel{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(WARPConnectorListResponseTunnelWARPConnectorTunnel{}), + }, + ) } // A Warp Connector Tunnel that connects your origin to Cloudflare's edge. type WARPConnectorListResponseTunnelWARPConnectorTunnel struct { -// UUID of the tunnel. -ID string `json:"id"` -// Cloudflare account ID -AccountTag string `json:"account_tag"` -// The Cloudflare Tunnel connections between your origin and Cloudflare's edge. -Connections []WARPConnectorListResponseTunnelWARPConnectorTunnelConnection `json:"connections"` -// Timestamp of when the tunnel established at least one connection to Cloudflare's -// edge. If `null`, the tunnel is inactive. -ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` -// Timestamp of when the tunnel became inactive (no connections to Cloudflare's -// edge). If `null`, the tunnel is active. -ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` -// Timestamp of when the tunnel was created. -CreatedAt time.Time `json:"created_at" format:"date-time"` -// Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been -// deleted. -DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` -// Metadata associated with the tunnel. -Metadata interface{} `json:"metadata"` -// A user-friendly name for the tunnel. -Name string `json:"name"` -// The status of the tunnel. Valid values are `inactive` (tunnel has never been -// run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy -// state), `healthy` (tunnel is active and able to serve traffic), or `down` -// (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). -Status string `json:"status"` -// The type of tunnel. -TunType WARPConnectorListResponseTunnelWARPConnectorTunnelTunType `json:"tun_type"` -JSON warpConnectorListResponseTunnelWARPConnectorTunnelJSON `json:"-"` + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []WARPConnectorListResponseTunnelWARPConnectorTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType WARPConnectorListResponseTunnelWARPConnectorTunnelTunType `json:"tun_type"` + JSON warpConnectorListResponseTunnelWARPConnectorTunnelJSON `json:"-"` } // warpConnectorListResponseTunnelWARPConnectorTunnelJSON contains the JSON // metadata for the struct [WARPConnectorListResponseTunnelWARPConnectorTunnel] type warpConnectorListResponseTunnelWARPConnectorTunnelJSON struct { -ID apijson.Field -AccountTag apijson.Field -Connections apijson.Field -ConnsActiveAt apijson.Field -ConnsInactiveAt apijson.Field -CreatedAt apijson.Field -DeletedAt apijson.Field -Metadata apijson.Field -Name apijson.Field -Status apijson.Field -TunType apijson.Field -raw string -ExtraFields map[string]apijson.Field + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *WARPConnectorListResponseTunnelWARPConnectorTunnel) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r warpConnectorListResponseTunnelWARPConnectorTunnelJSON) RawJSON() (string) { - return r.raw +func (r warpConnectorListResponseTunnelWARPConnectorTunnelJSON) RawJSON() string { + return r.raw } -func (r WARPConnectorListResponseTunnelWARPConnectorTunnel) ImplementsWARPConnectorWARPConnectorListResponse() {} +func (r WARPConnectorListResponseTunnelWARPConnectorTunnel) ImplementsWARPConnectorWARPConnectorListResponse() { +} type WARPConnectorListResponseTunnelWARPConnectorTunnelConnection struct { -// UUID of the Cloudflare Tunnel connection. -ID string `json:"id"` -// UUID of the cloudflared instance. -ClientID interface{} `json:"client_id"` -// The cloudflared version used to establish this connection. -ClientVersion string `json:"client_version"` -// The Cloudflare data center used for this connection. -ColoName string `json:"colo_name"` -// Cloudflare continues to track connections for several minutes after they -// disconnect. This is an optimization to improve latency and reliability of -// reconnecting. If `true`, the connection has disconnected but is still being -// tracked. If `false`, the connection is actively serving traffic. -IsPendingReconnect bool `json:"is_pending_reconnect"` -// Timestamp of when the connection was established. -OpenedAt time.Time `json:"opened_at" format:"date-time"` -// The public IP address of the host running cloudflared. -OriginIP string `json:"origin_ip"` -// UUID of the Cloudflare Tunnel connection. -UUID string `json:"uuid"` -JSON warpConnectorListResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + UUID string `json:"uuid"` + JSON warpConnectorListResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` } // warpConnectorListResponseTunnelWARPConnectorTunnelConnectionJSON contains the // JSON metadata for the struct // [WARPConnectorListResponseTunnelWARPConnectorTunnelConnection] type warpConnectorListResponseTunnelWARPConnectorTunnelConnectionJSON struct { -ID apijson.Field -ClientID apijson.Field -ClientVersion apijson.Field -ColoName apijson.Field -IsPendingReconnect apijson.Field -OpenedAt apijson.Field -OriginIP apijson.Field -UUID apijson.Field -raw string -ExtraFields map[string]apijson.Field + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + UUID apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *WARPConnectorListResponseTunnelWARPConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r warpConnectorListResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() (string) { - return r.raw +func (r warpConnectorListResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() string { + return r.raw } // The type of tunnel. type WARPConnectorListResponseTunnelWARPConnectorTunnelTunType string const ( - WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel WARPConnectorListResponseTunnelWARPConnectorTunnelTunType = "cfd_tunnel" - WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeWARPConnector WARPConnectorListResponseTunnelWARPConnectorTunnelTunType = "warp_connector" - WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeIPSec WARPConnectorListResponseTunnelWARPConnectorTunnelTunType = "ip_sec" - WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeGRE WARPConnectorListResponseTunnelWARPConnectorTunnelTunType = "gre" - WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeCNI WARPConnectorListResponseTunnelWARPConnectorTunnelTunType = "cni" + WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel WARPConnectorListResponseTunnelWARPConnectorTunnelTunType = "cfd_tunnel" + WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeWARPConnector WARPConnectorListResponseTunnelWARPConnectorTunnelTunType = "warp_connector" + WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeIPSec WARPConnectorListResponseTunnelWARPConnectorTunnelTunType = "ip_sec" + WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeGRE WARPConnectorListResponseTunnelWARPConnectorTunnelTunType = "gre" + WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeCNI WARPConnectorListResponseTunnelWARPConnectorTunnelTunType = "cni" ) -func (r WARPConnectorListResponseTunnelWARPConnectorTunnelTunType) IsKnown() (bool) { - switch r { - case WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel, WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeWARPConnector, WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeIPSec, WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeGRE, WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeCNI: - return true - } - return false +func (r WARPConnectorListResponseTunnelWARPConnectorTunnelTunType) IsKnown() bool { + switch r { + case WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel, WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeWARPConnector, WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeIPSec, WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeGRE, WARPConnectorListResponseTunnelWARPConnectorTunnelTunTypeCNI: + return true + } + return false } // The type of tunnel. -type shared.WARPConnectorListResponseTunType string +type WARPConnectorListResponseTunType string const ( - shared.WARPConnectorListResponseTunTypeCfdTunnel shared.WARPConnectorListResponseTunType = "cfd_tunnel" - shared.WARPConnectorListResponseTunTypeWARPConnector shared.WARPConnectorListResponseTunType = "warp_connector" - shared.WARPConnectorListResponseTunTypeIPSec shared.WARPConnectorListResponseTunType = "ip_sec" - shared.WARPConnectorListResponseTunTypeGRE shared.WARPConnectorListResponseTunType = "gre" - shared.WARPConnectorListResponseTunTypeCNI shared.WARPConnectorListResponseTunType = "cni" + WARPConnectorListResponseTunTypeCfdTunnel WARPConnectorListResponseTunType = "cfd_tunnel" + WARPConnectorListResponseTunTypeWARPConnector WARPConnectorListResponseTunType = "warp_connector" + WARPConnectorListResponseTunTypeIPSec WARPConnectorListResponseTunType = "ip_sec" + WARPConnectorListResponseTunTypeGRE WARPConnectorListResponseTunType = "gre" + WARPConnectorListResponseTunTypeCNI WARPConnectorListResponseTunType = "cni" ) -func (r shared.WARPConnectorListResponseTunType) IsKnown() (bool) { - switch r { - case shared.WARPConnectorListResponseTunTypeCfdTunnel, shared.WARPConnectorListResponseTunTypeWARPConnector, shared.WARPConnectorListResponseTunTypeIPSec, shared.WARPConnectorListResponseTunTypeGRE, shared.WARPConnectorListResponseTunTypeCNI: - return true - } - return false +func (r WARPConnectorListResponseTunType) IsKnown() bool { + switch r { + case WARPConnectorListResponseTunTypeCfdTunnel, WARPConnectorListResponseTunTypeWARPConnector, WARPConnectorListResponseTunTypeIPSec, WARPConnectorListResponseTunTypeGRE, WARPConnectorListResponseTunTypeCNI: + return true + } + return false } // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. type WARPConnectorDeleteResponse struct { -// Cloudflare account ID -AccountTag string `json:"account_tag"` -Connections interface{} `json:"connections,required"` -// Timestamp of when the tunnel established at least one connection to Cloudflare's -// edge. If `null`, the tunnel is inactive. -ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` -// Timestamp of when the tunnel became inactive (no connections to Cloudflare's -// edge). If `null`, the tunnel is active. -ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` -// Timestamp of when the tunnel was created. -CreatedAt time.Time `json:"created_at" format:"date-time"` -// Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been -// deleted. -DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` -// UUID of the tunnel. -ID string `json:"id"` -Metadata interface{} `json:"metadata,required"` -// A user-friendly name for the tunnel. -Name string `json:"name"` -// If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. -// If `false`, the tunnel must be configured locally on the origin machine. -RemoteConfig bool `json:"remote_config"` -// The status of the tunnel. Valid values are `inactive` (tunnel has never been -// run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy -// state), `healthy` (tunnel is active and able to serve traffic), or `down` -// (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). -Status string `json:"status"` -// The type of tunnel. -TunType shared.WARPConnectorDeleteResponseTunType `json:"tun_type"` -JSON warpConnectorDeleteResponseJSON `json:"-"` -union WARPConnectorDeleteResponseUnion + // Cloudflare account ID + AccountTag string `json:"account_tag"` + Connections interface{} `json:"connections,required"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // UUID of the tunnel. + ID string `json:"id"` + Metadata interface{} `json:"metadata,required"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + // If `false`, the tunnel must be configured locally on the origin machine. + RemoteConfig bool `json:"remote_config"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType WARPConnectorDeleteResponseTunType `json:"tun_type"` + JSON warpConnectorDeleteResponseJSON `json:"-"` + union WARPConnectorDeleteResponseUnion } // warpConnectorDeleteResponseJSON contains the JSON metadata for the struct // [WARPConnectorDeleteResponse] type warpConnectorDeleteResponseJSON struct { -AccountTag apijson.Field -Connections apijson.Field -ConnsActiveAt apijson.Field -ConnsInactiveAt apijson.Field -CreatedAt apijson.Field -DeletedAt apijson.Field -ID apijson.Field -Metadata apijson.Field -Name apijson.Field -RemoteConfig apijson.Field -Status apijson.Field -TunType apijson.Field -raw string -ExtraFields map[string]apijson.Field -} - -func (r warpConnectorDeleteResponseJSON) RawJSON() (string) { - return r.raw + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + ID apijson.Field + Metadata apijson.Field + Name apijson.Field + RemoteConfig apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r warpConnectorDeleteResponseJSON) RawJSON() string { + return r.raw } func (r *WARPConnectorDeleteResponse) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) + err = apijson.UnmarshalRoot(data, &r.union) + if err != nil { + return err + } + return apijson.Port(r.union, &r) } -func (r WARPConnectorDeleteResponse) AsUnion() (WARPConnectorDeleteResponseUnion) { - return r.union +func (r WARPConnectorDeleteResponse) AsUnion() WARPConnectorDeleteResponseUnion { + return r.union } // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. @@ -680,238 +682,239 @@ func (r WARPConnectorDeleteResponse) AsUnion() (WARPConnectorDeleteResponseUnion // Union satisfied by [shared.CloudflareTunnel] or // [warp_connector.WARPConnectorDeleteResponseTunnelWARPConnectorTunnel]. type WARPConnectorDeleteResponseUnion interface { - ImplementsWARPConnectorWARPConnectorDeleteResponse() + ImplementsWARPConnectorWARPConnectorDeleteResponse() } func init() { - apijson.RegisterUnion( - reflect.TypeOf((*WARPConnectorDeleteResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(shared.CloudflareTunnel{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(WARPConnectorDeleteResponseTunnelWARPConnectorTunnel{}), - }, - ) + apijson.RegisterUnion( + reflect.TypeOf((*WARPConnectorDeleteResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(shared.CloudflareTunnel{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(WARPConnectorDeleteResponseTunnelWARPConnectorTunnel{}), + }, + ) } // A Warp Connector Tunnel that connects your origin to Cloudflare's edge. type WARPConnectorDeleteResponseTunnelWARPConnectorTunnel struct { -// UUID of the tunnel. -ID string `json:"id"` -// Cloudflare account ID -AccountTag string `json:"account_tag"` -// The Cloudflare Tunnel connections between your origin and Cloudflare's edge. -Connections []WARPConnectorDeleteResponseTunnelWARPConnectorTunnelConnection `json:"connections"` -// Timestamp of when the tunnel established at least one connection to Cloudflare's -// edge. If `null`, the tunnel is inactive. -ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` -// Timestamp of when the tunnel became inactive (no connections to Cloudflare's -// edge). If `null`, the tunnel is active. -ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` -// Timestamp of when the tunnel was created. -CreatedAt time.Time `json:"created_at" format:"date-time"` -// Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been -// deleted. -DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` -// Metadata associated with the tunnel. -Metadata interface{} `json:"metadata"` -// A user-friendly name for the tunnel. -Name string `json:"name"` -// The status of the tunnel. Valid values are `inactive` (tunnel has never been -// run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy -// state), `healthy` (tunnel is active and able to serve traffic), or `down` -// (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). -Status string `json:"status"` -// The type of tunnel. -TunType WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunType `json:"tun_type"` -JSON warpConnectorDeleteResponseTunnelWARPConnectorTunnelJSON `json:"-"` + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []WARPConnectorDeleteResponseTunnelWARPConnectorTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunType `json:"tun_type"` + JSON warpConnectorDeleteResponseTunnelWARPConnectorTunnelJSON `json:"-"` } // warpConnectorDeleteResponseTunnelWARPConnectorTunnelJSON contains the JSON // metadata for the struct [WARPConnectorDeleteResponseTunnelWARPConnectorTunnel] type warpConnectorDeleteResponseTunnelWARPConnectorTunnelJSON struct { -ID apijson.Field -AccountTag apijson.Field -Connections apijson.Field -ConnsActiveAt apijson.Field -ConnsInactiveAt apijson.Field -CreatedAt apijson.Field -DeletedAt apijson.Field -Metadata apijson.Field -Name apijson.Field -Status apijson.Field -TunType apijson.Field -raw string -ExtraFields map[string]apijson.Field + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *WARPConnectorDeleteResponseTunnelWARPConnectorTunnel) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r warpConnectorDeleteResponseTunnelWARPConnectorTunnelJSON) RawJSON() (string) { - return r.raw +func (r warpConnectorDeleteResponseTunnelWARPConnectorTunnelJSON) RawJSON() string { + return r.raw } -func (r WARPConnectorDeleteResponseTunnelWARPConnectorTunnel) ImplementsWARPConnectorWARPConnectorDeleteResponse() {} +func (r WARPConnectorDeleteResponseTunnelWARPConnectorTunnel) ImplementsWARPConnectorWARPConnectorDeleteResponse() { +} type WARPConnectorDeleteResponseTunnelWARPConnectorTunnelConnection struct { -// UUID of the Cloudflare Tunnel connection. -ID string `json:"id"` -// UUID of the cloudflared instance. -ClientID interface{} `json:"client_id"` -// The cloudflared version used to establish this connection. -ClientVersion string `json:"client_version"` -// The Cloudflare data center used for this connection. -ColoName string `json:"colo_name"` -// Cloudflare continues to track connections for several minutes after they -// disconnect. This is an optimization to improve latency and reliability of -// reconnecting. If `true`, the connection has disconnected but is still being -// tracked. If `false`, the connection is actively serving traffic. -IsPendingReconnect bool `json:"is_pending_reconnect"` -// Timestamp of when the connection was established. -OpenedAt time.Time `json:"opened_at" format:"date-time"` -// The public IP address of the host running cloudflared. -OriginIP string `json:"origin_ip"` -// UUID of the Cloudflare Tunnel connection. -UUID string `json:"uuid"` -JSON warpConnectorDeleteResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + UUID string `json:"uuid"` + JSON warpConnectorDeleteResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` } // warpConnectorDeleteResponseTunnelWARPConnectorTunnelConnectionJSON contains the // JSON metadata for the struct // [WARPConnectorDeleteResponseTunnelWARPConnectorTunnelConnection] type warpConnectorDeleteResponseTunnelWARPConnectorTunnelConnectionJSON struct { -ID apijson.Field -ClientID apijson.Field -ClientVersion apijson.Field -ColoName apijson.Field -IsPendingReconnect apijson.Field -OpenedAt apijson.Field -OriginIP apijson.Field -UUID apijson.Field -raw string -ExtraFields map[string]apijson.Field + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + UUID apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *WARPConnectorDeleteResponseTunnelWARPConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r warpConnectorDeleteResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() (string) { - return r.raw +func (r warpConnectorDeleteResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() string { + return r.raw } // The type of tunnel. type WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunType string const ( - WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunType = "cfd_tunnel" - WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeWARPConnector WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunType = "warp_connector" - WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeIPSec WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunType = "ip_sec" - WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeGRE WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunType = "gre" - WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeCNI WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunType = "cni" + WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunType = "cfd_tunnel" + WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeWARPConnector WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunType = "warp_connector" + WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeIPSec WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunType = "ip_sec" + WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeGRE WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunType = "gre" + WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeCNI WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunType = "cni" ) -func (r WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunType) IsKnown() (bool) { - switch r { - case WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel, WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeWARPConnector, WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeIPSec, WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeGRE, WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeCNI: - return true - } - return false +func (r WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunType) IsKnown() bool { + switch r { + case WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel, WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeWARPConnector, WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeIPSec, WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeGRE, WARPConnectorDeleteResponseTunnelWARPConnectorTunnelTunTypeCNI: + return true + } + return false } // The type of tunnel. -type shared.WARPConnectorDeleteResponseTunType string +type WARPConnectorDeleteResponseTunType string const ( - shared.WARPConnectorDeleteResponseTunTypeCfdTunnel shared.WARPConnectorDeleteResponseTunType = "cfd_tunnel" - shared.WARPConnectorDeleteResponseTunTypeWARPConnector shared.WARPConnectorDeleteResponseTunType = "warp_connector" - shared.WARPConnectorDeleteResponseTunTypeIPSec shared.WARPConnectorDeleteResponseTunType = "ip_sec" - shared.WARPConnectorDeleteResponseTunTypeGRE shared.WARPConnectorDeleteResponseTunType = "gre" - shared.WARPConnectorDeleteResponseTunTypeCNI shared.WARPConnectorDeleteResponseTunType = "cni" + WARPConnectorDeleteResponseTunTypeCfdTunnel WARPConnectorDeleteResponseTunType = "cfd_tunnel" + WARPConnectorDeleteResponseTunTypeWARPConnector WARPConnectorDeleteResponseTunType = "warp_connector" + WARPConnectorDeleteResponseTunTypeIPSec WARPConnectorDeleteResponseTunType = "ip_sec" + WARPConnectorDeleteResponseTunTypeGRE WARPConnectorDeleteResponseTunType = "gre" + WARPConnectorDeleteResponseTunTypeCNI WARPConnectorDeleteResponseTunType = "cni" ) -func (r shared.WARPConnectorDeleteResponseTunType) IsKnown() (bool) { - switch r { - case shared.WARPConnectorDeleteResponseTunTypeCfdTunnel, shared.WARPConnectorDeleteResponseTunTypeWARPConnector, shared.WARPConnectorDeleteResponseTunTypeIPSec, shared.WARPConnectorDeleteResponseTunTypeGRE, shared.WARPConnectorDeleteResponseTunTypeCNI: - return true - } - return false +func (r WARPConnectorDeleteResponseTunType) IsKnown() bool { + switch r { + case WARPConnectorDeleteResponseTunTypeCfdTunnel, WARPConnectorDeleteResponseTunTypeWARPConnector, WARPConnectorDeleteResponseTunTypeIPSec, WARPConnectorDeleteResponseTunTypeGRE, WARPConnectorDeleteResponseTunTypeCNI: + return true + } + return false } // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. type WARPConnectorEditResponse struct { -// Cloudflare account ID -AccountTag string `json:"account_tag"` -Connections interface{} `json:"connections,required"` -// Timestamp of when the tunnel established at least one connection to Cloudflare's -// edge. If `null`, the tunnel is inactive. -ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` -// Timestamp of when the tunnel became inactive (no connections to Cloudflare's -// edge). If `null`, the tunnel is active. -ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` -// Timestamp of when the tunnel was created. -CreatedAt time.Time `json:"created_at" format:"date-time"` -// Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been -// deleted. -DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` -// UUID of the tunnel. -ID string `json:"id"` -Metadata interface{} `json:"metadata,required"` -// A user-friendly name for the tunnel. -Name string `json:"name"` -// If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. -// If `false`, the tunnel must be configured locally on the origin machine. -RemoteConfig bool `json:"remote_config"` -// The status of the tunnel. Valid values are `inactive` (tunnel has never been -// run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy -// state), `healthy` (tunnel is active and able to serve traffic), or `down` -// (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). -Status string `json:"status"` -// The type of tunnel. -TunType shared.WARPConnectorEditResponseTunType `json:"tun_type"` -JSON warpConnectorEditResponseJSON `json:"-"` -union WARPConnectorEditResponseUnion + // Cloudflare account ID + AccountTag string `json:"account_tag"` + Connections interface{} `json:"connections,required"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // UUID of the tunnel. + ID string `json:"id"` + Metadata interface{} `json:"metadata,required"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + // If `false`, the tunnel must be configured locally on the origin machine. + RemoteConfig bool `json:"remote_config"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType WARPConnectorEditResponseTunType `json:"tun_type"` + JSON warpConnectorEditResponseJSON `json:"-"` + union WARPConnectorEditResponseUnion } // warpConnectorEditResponseJSON contains the JSON metadata for the struct // [WARPConnectorEditResponse] type warpConnectorEditResponseJSON struct { -AccountTag apijson.Field -Connections apijson.Field -ConnsActiveAt apijson.Field -ConnsInactiveAt apijson.Field -CreatedAt apijson.Field -DeletedAt apijson.Field -ID apijson.Field -Metadata apijson.Field -Name apijson.Field -RemoteConfig apijson.Field -Status apijson.Field -TunType apijson.Field -raw string -ExtraFields map[string]apijson.Field -} - -func (r warpConnectorEditResponseJSON) RawJSON() (string) { - return r.raw + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + ID apijson.Field + Metadata apijson.Field + Name apijson.Field + RemoteConfig apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r warpConnectorEditResponseJSON) RawJSON() string { + return r.raw } func (r *WARPConnectorEditResponse) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) + err = apijson.UnmarshalRoot(data, &r.union) + if err != nil { + return err + } + return apijson.Port(r.union, &r) } -func (r WARPConnectorEditResponse) AsUnion() (WARPConnectorEditResponseUnion) { - return r.union +func (r WARPConnectorEditResponse) AsUnion() WARPConnectorEditResponseUnion { + return r.union } // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. @@ -919,238 +922,239 @@ func (r WARPConnectorEditResponse) AsUnion() (WARPConnectorEditResponseUnion) { // Union satisfied by [shared.CloudflareTunnel] or // [warp_connector.WARPConnectorEditResponseTunnelWARPConnectorTunnel]. type WARPConnectorEditResponseUnion interface { - ImplementsWARPConnectorWARPConnectorEditResponse() + ImplementsWARPConnectorWARPConnectorEditResponse() } func init() { - apijson.RegisterUnion( - reflect.TypeOf((*WARPConnectorEditResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(shared.CloudflareTunnel{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(WARPConnectorEditResponseTunnelWARPConnectorTunnel{}), - }, - ) + apijson.RegisterUnion( + reflect.TypeOf((*WARPConnectorEditResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(shared.CloudflareTunnel{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(WARPConnectorEditResponseTunnelWARPConnectorTunnel{}), + }, + ) } // A Warp Connector Tunnel that connects your origin to Cloudflare's edge. type WARPConnectorEditResponseTunnelWARPConnectorTunnel struct { -// UUID of the tunnel. -ID string `json:"id"` -// Cloudflare account ID -AccountTag string `json:"account_tag"` -// The Cloudflare Tunnel connections between your origin and Cloudflare's edge. -Connections []WARPConnectorEditResponseTunnelWARPConnectorTunnelConnection `json:"connections"` -// Timestamp of when the tunnel established at least one connection to Cloudflare's -// edge. If `null`, the tunnel is inactive. -ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` -// Timestamp of when the tunnel became inactive (no connections to Cloudflare's -// edge). If `null`, the tunnel is active. -ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` -// Timestamp of when the tunnel was created. -CreatedAt time.Time `json:"created_at" format:"date-time"` -// Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been -// deleted. -DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` -// Metadata associated with the tunnel. -Metadata interface{} `json:"metadata"` -// A user-friendly name for the tunnel. -Name string `json:"name"` -// The status of the tunnel. Valid values are `inactive` (tunnel has never been -// run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy -// state), `healthy` (tunnel is active and able to serve traffic), or `down` -// (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). -Status string `json:"status"` -// The type of tunnel. -TunType WARPConnectorEditResponseTunnelWARPConnectorTunnelTunType `json:"tun_type"` -JSON warpConnectorEditResponseTunnelWARPConnectorTunnelJSON `json:"-"` + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []WARPConnectorEditResponseTunnelWARPConnectorTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType WARPConnectorEditResponseTunnelWARPConnectorTunnelTunType `json:"tun_type"` + JSON warpConnectorEditResponseTunnelWARPConnectorTunnelJSON `json:"-"` } // warpConnectorEditResponseTunnelWARPConnectorTunnelJSON contains the JSON // metadata for the struct [WARPConnectorEditResponseTunnelWARPConnectorTunnel] type warpConnectorEditResponseTunnelWARPConnectorTunnelJSON struct { -ID apijson.Field -AccountTag apijson.Field -Connections apijson.Field -ConnsActiveAt apijson.Field -ConnsInactiveAt apijson.Field -CreatedAt apijson.Field -DeletedAt apijson.Field -Metadata apijson.Field -Name apijson.Field -Status apijson.Field -TunType apijson.Field -raw string -ExtraFields map[string]apijson.Field + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *WARPConnectorEditResponseTunnelWARPConnectorTunnel) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r warpConnectorEditResponseTunnelWARPConnectorTunnelJSON) RawJSON() (string) { - return r.raw +func (r warpConnectorEditResponseTunnelWARPConnectorTunnelJSON) RawJSON() string { + return r.raw } -func (r WARPConnectorEditResponseTunnelWARPConnectorTunnel) ImplementsWARPConnectorWARPConnectorEditResponse() {} +func (r WARPConnectorEditResponseTunnelWARPConnectorTunnel) ImplementsWARPConnectorWARPConnectorEditResponse() { +} type WARPConnectorEditResponseTunnelWARPConnectorTunnelConnection struct { -// UUID of the Cloudflare Tunnel connection. -ID string `json:"id"` -// UUID of the cloudflared instance. -ClientID interface{} `json:"client_id"` -// The cloudflared version used to establish this connection. -ClientVersion string `json:"client_version"` -// The Cloudflare data center used for this connection. -ColoName string `json:"colo_name"` -// Cloudflare continues to track connections for several minutes after they -// disconnect. This is an optimization to improve latency and reliability of -// reconnecting. If `true`, the connection has disconnected but is still being -// tracked. If `false`, the connection is actively serving traffic. -IsPendingReconnect bool `json:"is_pending_reconnect"` -// Timestamp of when the connection was established. -OpenedAt time.Time `json:"opened_at" format:"date-time"` -// The public IP address of the host running cloudflared. -OriginIP string `json:"origin_ip"` -// UUID of the Cloudflare Tunnel connection. -UUID string `json:"uuid"` -JSON warpConnectorEditResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + UUID string `json:"uuid"` + JSON warpConnectorEditResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` } // warpConnectorEditResponseTunnelWARPConnectorTunnelConnectionJSON contains the // JSON metadata for the struct // [WARPConnectorEditResponseTunnelWARPConnectorTunnelConnection] type warpConnectorEditResponseTunnelWARPConnectorTunnelConnectionJSON struct { -ID apijson.Field -ClientID apijson.Field -ClientVersion apijson.Field -ColoName apijson.Field -IsPendingReconnect apijson.Field -OpenedAt apijson.Field -OriginIP apijson.Field -UUID apijson.Field -raw string -ExtraFields map[string]apijson.Field + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + UUID apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *WARPConnectorEditResponseTunnelWARPConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r warpConnectorEditResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() (string) { - return r.raw +func (r warpConnectorEditResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() string { + return r.raw } // The type of tunnel. type WARPConnectorEditResponseTunnelWARPConnectorTunnelTunType string const ( - WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel WARPConnectorEditResponseTunnelWARPConnectorTunnelTunType = "cfd_tunnel" - WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeWARPConnector WARPConnectorEditResponseTunnelWARPConnectorTunnelTunType = "warp_connector" - WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeIPSec WARPConnectorEditResponseTunnelWARPConnectorTunnelTunType = "ip_sec" - WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeGRE WARPConnectorEditResponseTunnelWARPConnectorTunnelTunType = "gre" - WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeCNI WARPConnectorEditResponseTunnelWARPConnectorTunnelTunType = "cni" + WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel WARPConnectorEditResponseTunnelWARPConnectorTunnelTunType = "cfd_tunnel" + WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeWARPConnector WARPConnectorEditResponseTunnelWARPConnectorTunnelTunType = "warp_connector" + WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeIPSec WARPConnectorEditResponseTunnelWARPConnectorTunnelTunType = "ip_sec" + WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeGRE WARPConnectorEditResponseTunnelWARPConnectorTunnelTunType = "gre" + WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeCNI WARPConnectorEditResponseTunnelWARPConnectorTunnelTunType = "cni" ) -func (r WARPConnectorEditResponseTunnelWARPConnectorTunnelTunType) IsKnown() (bool) { - switch r { - case WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel, WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeWARPConnector, WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeIPSec, WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeGRE, WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeCNI: - return true - } - return false +func (r WARPConnectorEditResponseTunnelWARPConnectorTunnelTunType) IsKnown() bool { + switch r { + case WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel, WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeWARPConnector, WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeIPSec, WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeGRE, WARPConnectorEditResponseTunnelWARPConnectorTunnelTunTypeCNI: + return true + } + return false } // The type of tunnel. -type shared.WARPConnectorEditResponseTunType string +type WARPConnectorEditResponseTunType string const ( - shared.WARPConnectorEditResponseTunTypeCfdTunnel shared.WARPConnectorEditResponseTunType = "cfd_tunnel" - shared.WARPConnectorEditResponseTunTypeWARPConnector shared.WARPConnectorEditResponseTunType = "warp_connector" - shared.WARPConnectorEditResponseTunTypeIPSec shared.WARPConnectorEditResponseTunType = "ip_sec" - shared.WARPConnectorEditResponseTunTypeGRE shared.WARPConnectorEditResponseTunType = "gre" - shared.WARPConnectorEditResponseTunTypeCNI shared.WARPConnectorEditResponseTunType = "cni" + WARPConnectorEditResponseTunTypeCfdTunnel WARPConnectorEditResponseTunType = "cfd_tunnel" + WARPConnectorEditResponseTunTypeWARPConnector WARPConnectorEditResponseTunType = "warp_connector" + WARPConnectorEditResponseTunTypeIPSec WARPConnectorEditResponseTunType = "ip_sec" + WARPConnectorEditResponseTunTypeGRE WARPConnectorEditResponseTunType = "gre" + WARPConnectorEditResponseTunTypeCNI WARPConnectorEditResponseTunType = "cni" ) -func (r shared.WARPConnectorEditResponseTunType) IsKnown() (bool) { - switch r { - case shared.WARPConnectorEditResponseTunTypeCfdTunnel, shared.WARPConnectorEditResponseTunTypeWARPConnector, shared.WARPConnectorEditResponseTunTypeIPSec, shared.WARPConnectorEditResponseTunTypeGRE, shared.WARPConnectorEditResponseTunTypeCNI: - return true - } - return false +func (r WARPConnectorEditResponseTunType) IsKnown() bool { + switch r { + case WARPConnectorEditResponseTunTypeCfdTunnel, WARPConnectorEditResponseTunTypeWARPConnector, WARPConnectorEditResponseTunTypeIPSec, WARPConnectorEditResponseTunTypeGRE, WARPConnectorEditResponseTunTypeCNI: + return true + } + return false } // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. type WARPConnectorGetResponse struct { -// Cloudflare account ID -AccountTag string `json:"account_tag"` -Connections interface{} `json:"connections,required"` -// Timestamp of when the tunnel established at least one connection to Cloudflare's -// edge. If `null`, the tunnel is inactive. -ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` -// Timestamp of when the tunnel became inactive (no connections to Cloudflare's -// edge). If `null`, the tunnel is active. -ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` -// Timestamp of when the tunnel was created. -CreatedAt time.Time `json:"created_at" format:"date-time"` -// Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been -// deleted. -DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` -// UUID of the tunnel. -ID string `json:"id"` -Metadata interface{} `json:"metadata,required"` -// A user-friendly name for the tunnel. -Name string `json:"name"` -// If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. -// If `false`, the tunnel must be configured locally on the origin machine. -RemoteConfig bool `json:"remote_config"` -// The status of the tunnel. Valid values are `inactive` (tunnel has never been -// run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy -// state), `healthy` (tunnel is active and able to serve traffic), or `down` -// (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). -Status string `json:"status"` -// The type of tunnel. -TunType shared.WARPConnectorGetResponseTunType `json:"tun_type"` -JSON warpConnectorGetResponseJSON `json:"-"` -union WARPConnectorGetResponseUnion + // Cloudflare account ID + AccountTag string `json:"account_tag"` + Connections interface{} `json:"connections,required"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // UUID of the tunnel. + ID string `json:"id"` + Metadata interface{} `json:"metadata,required"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + // If `false`, the tunnel must be configured locally on the origin machine. + RemoteConfig bool `json:"remote_config"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType WARPConnectorGetResponseTunType `json:"tun_type"` + JSON warpConnectorGetResponseJSON `json:"-"` + union WARPConnectorGetResponseUnion } // warpConnectorGetResponseJSON contains the JSON metadata for the struct // [WARPConnectorGetResponse] type warpConnectorGetResponseJSON struct { -AccountTag apijson.Field -Connections apijson.Field -ConnsActiveAt apijson.Field -ConnsInactiveAt apijson.Field -CreatedAt apijson.Field -DeletedAt apijson.Field -ID apijson.Field -Metadata apijson.Field -Name apijson.Field -RemoteConfig apijson.Field -Status apijson.Field -TunType apijson.Field -raw string -ExtraFields map[string]apijson.Field -} - -func (r warpConnectorGetResponseJSON) RawJSON() (string) { - return r.raw + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + ID apijson.Field + Metadata apijson.Field + Name apijson.Field + RemoteConfig apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r warpConnectorGetResponseJSON) RawJSON() string { + return r.raw } func (r *WARPConnectorGetResponse) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) + err = apijson.UnmarshalRoot(data, &r.union) + if err != nil { + return err + } + return apijson.Port(r.union, &r) } -func (r WARPConnectorGetResponse) AsUnion() (WARPConnectorGetResponseUnion) { - return r.union +func (r WARPConnectorGetResponse) AsUnion() WARPConnectorGetResponseUnion { + return r.union } // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. @@ -1158,189 +1162,190 @@ func (r WARPConnectorGetResponse) AsUnion() (WARPConnectorGetResponseUnion) { // Union satisfied by [shared.CloudflareTunnel] or // [warp_connector.WARPConnectorGetResponseTunnelWARPConnectorTunnel]. type WARPConnectorGetResponseUnion interface { - ImplementsWARPConnectorWARPConnectorGetResponse() + ImplementsWARPConnectorWARPConnectorGetResponse() } func init() { - apijson.RegisterUnion( - reflect.TypeOf((*WARPConnectorGetResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(shared.CloudflareTunnel{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(WARPConnectorGetResponseTunnelWARPConnectorTunnel{}), - }, - ) + apijson.RegisterUnion( + reflect.TypeOf((*WARPConnectorGetResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(shared.CloudflareTunnel{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(WARPConnectorGetResponseTunnelWARPConnectorTunnel{}), + }, + ) } // A Warp Connector Tunnel that connects your origin to Cloudflare's edge. type WARPConnectorGetResponseTunnelWARPConnectorTunnel struct { -// UUID of the tunnel. -ID string `json:"id"` -// Cloudflare account ID -AccountTag string `json:"account_tag"` -// The Cloudflare Tunnel connections between your origin and Cloudflare's edge. -Connections []WARPConnectorGetResponseTunnelWARPConnectorTunnelConnection `json:"connections"` -// Timestamp of when the tunnel established at least one connection to Cloudflare's -// edge. If `null`, the tunnel is inactive. -ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` -// Timestamp of when the tunnel became inactive (no connections to Cloudflare's -// edge). If `null`, the tunnel is active. -ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` -// Timestamp of when the tunnel was created. -CreatedAt time.Time `json:"created_at" format:"date-time"` -// Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been -// deleted. -DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` -// Metadata associated with the tunnel. -Metadata interface{} `json:"metadata"` -// A user-friendly name for the tunnel. -Name string `json:"name"` -// The status of the tunnel. Valid values are `inactive` (tunnel has never been -// run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy -// state), `healthy` (tunnel is active and able to serve traffic), or `down` -// (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). -Status string `json:"status"` -// The type of tunnel. -TunType WARPConnectorGetResponseTunnelWARPConnectorTunnelTunType `json:"tun_type"` -JSON warpConnectorGetResponseTunnelWARPConnectorTunnelJSON `json:"-"` + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []WARPConnectorGetResponseTunnelWARPConnectorTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType WARPConnectorGetResponseTunnelWARPConnectorTunnelTunType `json:"tun_type"` + JSON warpConnectorGetResponseTunnelWARPConnectorTunnelJSON `json:"-"` } // warpConnectorGetResponseTunnelWARPConnectorTunnelJSON contains the JSON metadata // for the struct [WARPConnectorGetResponseTunnelWARPConnectorTunnel] type warpConnectorGetResponseTunnelWARPConnectorTunnelJSON struct { -ID apijson.Field -AccountTag apijson.Field -Connections apijson.Field -ConnsActiveAt apijson.Field -ConnsInactiveAt apijson.Field -CreatedAt apijson.Field -DeletedAt apijson.Field -Metadata apijson.Field -Name apijson.Field -Status apijson.Field -TunType apijson.Field -raw string -ExtraFields map[string]apijson.Field + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *WARPConnectorGetResponseTunnelWARPConnectorTunnel) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r warpConnectorGetResponseTunnelWARPConnectorTunnelJSON) RawJSON() (string) { - return r.raw +func (r warpConnectorGetResponseTunnelWARPConnectorTunnelJSON) RawJSON() string { + return r.raw } -func (r WARPConnectorGetResponseTunnelWARPConnectorTunnel) ImplementsWARPConnectorWARPConnectorGetResponse() {} +func (r WARPConnectorGetResponseTunnelWARPConnectorTunnel) ImplementsWARPConnectorWARPConnectorGetResponse() { +} type WARPConnectorGetResponseTunnelWARPConnectorTunnelConnection struct { -// UUID of the Cloudflare Tunnel connection. -ID string `json:"id"` -// UUID of the cloudflared instance. -ClientID interface{} `json:"client_id"` -// The cloudflared version used to establish this connection. -ClientVersion string `json:"client_version"` -// The Cloudflare data center used for this connection. -ColoName string `json:"colo_name"` -// Cloudflare continues to track connections for several minutes after they -// disconnect. This is an optimization to improve latency and reliability of -// reconnecting. If `true`, the connection has disconnected but is still being -// tracked. If `false`, the connection is actively serving traffic. -IsPendingReconnect bool `json:"is_pending_reconnect"` -// Timestamp of when the connection was established. -OpenedAt time.Time `json:"opened_at" format:"date-time"` -// The public IP address of the host running cloudflared. -OriginIP string `json:"origin_ip"` -// UUID of the Cloudflare Tunnel connection. -UUID string `json:"uuid"` -JSON warpConnectorGetResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + UUID string `json:"uuid"` + JSON warpConnectorGetResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` } // warpConnectorGetResponseTunnelWARPConnectorTunnelConnectionJSON contains the // JSON metadata for the struct // [WARPConnectorGetResponseTunnelWARPConnectorTunnelConnection] type warpConnectorGetResponseTunnelWARPConnectorTunnelConnectionJSON struct { -ID apijson.Field -ClientID apijson.Field -ClientVersion apijson.Field -ColoName apijson.Field -IsPendingReconnect apijson.Field -OpenedAt apijson.Field -OriginIP apijson.Field -UUID apijson.Field -raw string -ExtraFields map[string]apijson.Field + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + UUID apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *WARPConnectorGetResponseTunnelWARPConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r warpConnectorGetResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() (string) { - return r.raw +func (r warpConnectorGetResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() string { + return r.raw } // The type of tunnel. type WARPConnectorGetResponseTunnelWARPConnectorTunnelTunType string const ( - WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel WARPConnectorGetResponseTunnelWARPConnectorTunnelTunType = "cfd_tunnel" - WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeWARPConnector WARPConnectorGetResponseTunnelWARPConnectorTunnelTunType = "warp_connector" - WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeIPSec WARPConnectorGetResponseTunnelWARPConnectorTunnelTunType = "ip_sec" - WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeGRE WARPConnectorGetResponseTunnelWARPConnectorTunnelTunType = "gre" - WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeCNI WARPConnectorGetResponseTunnelWARPConnectorTunnelTunType = "cni" + WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel WARPConnectorGetResponseTunnelWARPConnectorTunnelTunType = "cfd_tunnel" + WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeWARPConnector WARPConnectorGetResponseTunnelWARPConnectorTunnelTunType = "warp_connector" + WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeIPSec WARPConnectorGetResponseTunnelWARPConnectorTunnelTunType = "ip_sec" + WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeGRE WARPConnectorGetResponseTunnelWARPConnectorTunnelTunType = "gre" + WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeCNI WARPConnectorGetResponseTunnelWARPConnectorTunnelTunType = "cni" ) -func (r WARPConnectorGetResponseTunnelWARPConnectorTunnelTunType) IsKnown() (bool) { - switch r { - case WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel, WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeWARPConnector, WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeIPSec, WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeGRE, WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeCNI: - return true - } - return false +func (r WARPConnectorGetResponseTunnelWARPConnectorTunnelTunType) IsKnown() bool { + switch r { + case WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel, WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeWARPConnector, WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeIPSec, WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeGRE, WARPConnectorGetResponseTunnelWARPConnectorTunnelTunTypeCNI: + return true + } + return false } // The type of tunnel. -type shared.WARPConnectorGetResponseTunType string +type WARPConnectorGetResponseTunType string const ( - shared.WARPConnectorGetResponseTunTypeCfdTunnel shared.WARPConnectorGetResponseTunType = "cfd_tunnel" - shared.WARPConnectorGetResponseTunTypeWARPConnector shared.WARPConnectorGetResponseTunType = "warp_connector" - shared.WARPConnectorGetResponseTunTypeIPSec shared.WARPConnectorGetResponseTunType = "ip_sec" - shared.WARPConnectorGetResponseTunTypeGRE shared.WARPConnectorGetResponseTunType = "gre" - shared.WARPConnectorGetResponseTunTypeCNI shared.WARPConnectorGetResponseTunType = "cni" + WARPConnectorGetResponseTunTypeCfdTunnel WARPConnectorGetResponseTunType = "cfd_tunnel" + WARPConnectorGetResponseTunTypeWARPConnector WARPConnectorGetResponseTunType = "warp_connector" + WARPConnectorGetResponseTunTypeIPSec WARPConnectorGetResponseTunType = "ip_sec" + WARPConnectorGetResponseTunTypeGRE WARPConnectorGetResponseTunType = "gre" + WARPConnectorGetResponseTunTypeCNI WARPConnectorGetResponseTunType = "cni" ) -func (r shared.WARPConnectorGetResponseTunType) IsKnown() (bool) { - switch r { - case shared.WARPConnectorGetResponseTunTypeCfdTunnel, shared.WARPConnectorGetResponseTunTypeWARPConnector, shared.WARPConnectorGetResponseTunTypeIPSec, shared.WARPConnectorGetResponseTunTypeGRE, shared.WARPConnectorGetResponseTunTypeCNI: - return true - } - return false +func (r WARPConnectorGetResponseTunType) IsKnown() bool { + switch r { + case WARPConnectorGetResponseTunTypeCfdTunnel, WARPConnectorGetResponseTunTypeWARPConnector, WARPConnectorGetResponseTunTypeIPSec, WARPConnectorGetResponseTunTypeGRE, WARPConnectorGetResponseTunTypeCNI: + return true + } + return false } // Union satisfied by [warp_connector.WARPConnectorTokenResponseUnknown], // [warp_connector.WARPConnectorTokenResponseArray] or [shared.UnionString]. type WARPConnectorTokenResponseUnion interface { - ImplementsWARPConnectorWARPConnectorTokenResponseUnion() + ImplementsWARPConnectorWARPConnectorTokenResponseUnion() } func init() { - apijson.RegisterUnion( - reflect.TypeOf((*WARPConnectorTokenResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(WARPConnectorTokenResponseArray{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) + apijson.RegisterUnion( + reflect.TypeOf((*WARPConnectorTokenResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(WARPConnectorTokenResponseArray{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) } type WARPConnectorTokenResponseArray []interface{} @@ -1348,297 +1353,297 @@ type WARPConnectorTokenResponseArray []interface{} func (r WARPConnectorTokenResponseArray) ImplementsWARPConnectorWARPConnectorTokenResponseUnion() {} type WARPConnectorNewParams struct { -// Cloudflare account ID -AccountID param.Field[string] `path:"account_id,required"` -// A user-friendly name for the tunnel. -Name param.Field[string] `json:"name,required"` + // Cloudflare account ID + AccountID param.Field[string] `path:"account_id,required"` + // A user-friendly name for the tunnel. + Name param.Field[string] `json:"name,required"` } func (r WARPConnectorNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r) } type WARPConnectorNewResponseEnvelope struct { -Errors []shared.ResponseInfo `json:"errors,required"` -Messages []shared.ResponseInfo `json:"messages,required"` -// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. -Result WARPConnectorNewResponse `json:"result,required"` -// Whether the API call was successful -Success WARPConnectorNewResponseEnvelopeSuccess `json:"success,required"` -JSON warpConnectorNewResponseEnvelopeJSON `json:"-"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. + Result WARPConnectorNewResponse `json:"result,required"` + // Whether the API call was successful + Success WARPConnectorNewResponseEnvelopeSuccess `json:"success,required"` + JSON warpConnectorNewResponseEnvelopeJSON `json:"-"` } // warpConnectorNewResponseEnvelopeJSON contains the JSON metadata for the struct // [WARPConnectorNewResponseEnvelope] type warpConnectorNewResponseEnvelopeJSON struct { -Errors apijson.Field -Messages apijson.Field -Result apijson.Field -Success apijson.Field -raw string -ExtraFields map[string]apijson.Field + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *WARPConnectorNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r warpConnectorNewResponseEnvelopeJSON) RawJSON() (string) { - return r.raw +func (r warpConnectorNewResponseEnvelopeJSON) RawJSON() string { + return r.raw } // Whether the API call was successful type WARPConnectorNewResponseEnvelopeSuccess bool const ( - WARPConnectorNewResponseEnvelopeSuccessTrue WARPConnectorNewResponseEnvelopeSuccess = true + WARPConnectorNewResponseEnvelopeSuccessTrue WARPConnectorNewResponseEnvelopeSuccess = true ) -func (r WARPConnectorNewResponseEnvelopeSuccess) IsKnown() (bool) { - switch r { - case WARPConnectorNewResponseEnvelopeSuccessTrue: - return true - } - return false +func (r WARPConnectorNewResponseEnvelopeSuccess) IsKnown() bool { + switch r { + case WARPConnectorNewResponseEnvelopeSuccessTrue: + return true + } + return false } type WARPConnectorListParams struct { -// Cloudflare account ID -AccountID param.Field[string] `path:"account_id,required"` -ExcludePrefix param.Field[string] `query:"exclude_prefix"` -// If provided, include only tunnels that were created (and not deleted) before -// this time. -ExistedAt param.Field[time.Time] `query:"existed_at" format:"date-time"` -IncludePrefix param.Field[string] `query:"include_prefix"` -// If `true`, only include deleted tunnels. If `false`, exclude deleted tunnels. If -// empty, all tunnels will be included. -IsDeleted param.Field[bool] `query:"is_deleted"` -// A user-friendly name for the tunnel. -Name param.Field[string] `query:"name"` -// Page number of paginated results. -Page param.Field[float64] `query:"page"` -// Number of results to display. -PerPage param.Field[float64] `query:"per_page"` -// UUID of the tunnel. -UUID param.Field[string] `query:"uuid"` -WasActiveAt param.Field[time.Time] `query:"was_active_at" format:"date-time"` -WasInactiveAt param.Field[time.Time] `query:"was_inactive_at" format:"date-time"` + // Cloudflare account ID + AccountID param.Field[string] `path:"account_id,required"` + ExcludePrefix param.Field[string] `query:"exclude_prefix"` + // If provided, include only tunnels that were created (and not deleted) before + // this time. + ExistedAt param.Field[time.Time] `query:"existed_at" format:"date-time"` + IncludePrefix param.Field[string] `query:"include_prefix"` + // If `true`, only include deleted tunnels. If `false`, exclude deleted tunnels. If + // empty, all tunnels will be included. + IsDeleted param.Field[bool] `query:"is_deleted"` + // A user-friendly name for the tunnel. + Name param.Field[string] `query:"name"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of results to display. + PerPage param.Field[float64] `query:"per_page"` + // UUID of the tunnel. + UUID param.Field[string] `query:"uuid"` + WasActiveAt param.Field[time.Time] `query:"was_active_at" format:"date-time"` + WasInactiveAt param.Field[time.Time] `query:"was_inactive_at" format:"date-time"` } // URLQuery serializes [WARPConnectorListParams]'s query parameters as // `url.Values`. func (r WARPConnectorListParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatRepeat, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatRepeat, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) } type WARPConnectorDeleteParams struct { -// Cloudflare account ID -AccountID param.Field[string] `path:"account_id,required"` -Body interface{} `json:"body,required"` + // Cloudflare account ID + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r WARPConnectorDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) + return apijson.MarshalRoot(r.Body) } type WARPConnectorDeleteResponseEnvelope struct { -Errors []shared.ResponseInfo `json:"errors,required"` -Messages []shared.ResponseInfo `json:"messages,required"` -// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. -Result WARPConnectorDeleteResponse `json:"result,required"` -// Whether the API call was successful -Success WARPConnectorDeleteResponseEnvelopeSuccess `json:"success,required"` -JSON warpConnectorDeleteResponseEnvelopeJSON `json:"-"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. + Result WARPConnectorDeleteResponse `json:"result,required"` + // Whether the API call was successful + Success WARPConnectorDeleteResponseEnvelopeSuccess `json:"success,required"` + JSON warpConnectorDeleteResponseEnvelopeJSON `json:"-"` } // warpConnectorDeleteResponseEnvelopeJSON contains the JSON metadata for the // struct [WARPConnectorDeleteResponseEnvelope] type warpConnectorDeleteResponseEnvelopeJSON struct { -Errors apijson.Field -Messages apijson.Field -Result apijson.Field -Success apijson.Field -raw string -ExtraFields map[string]apijson.Field + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *WARPConnectorDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r warpConnectorDeleteResponseEnvelopeJSON) RawJSON() (string) { - return r.raw +func (r warpConnectorDeleteResponseEnvelopeJSON) RawJSON() string { + return r.raw } // Whether the API call was successful type WARPConnectorDeleteResponseEnvelopeSuccess bool const ( - WARPConnectorDeleteResponseEnvelopeSuccessTrue WARPConnectorDeleteResponseEnvelopeSuccess = true + WARPConnectorDeleteResponseEnvelopeSuccessTrue WARPConnectorDeleteResponseEnvelopeSuccess = true ) -func (r WARPConnectorDeleteResponseEnvelopeSuccess) IsKnown() (bool) { - switch r { - case WARPConnectorDeleteResponseEnvelopeSuccessTrue: - return true - } - return false +func (r WARPConnectorDeleteResponseEnvelopeSuccess) IsKnown() bool { + switch r { + case WARPConnectorDeleteResponseEnvelopeSuccessTrue: + return true + } + return false } type WARPConnectorEditParams struct { -// Cloudflare account ID -AccountID param.Field[string] `path:"account_id,required"` -// A user-friendly name for the tunnel. -Name param.Field[string] `json:"name"` -// Sets the password required to run a locally-managed tunnel. Must be at least 32 -// bytes and encoded as a base64 string. -TunnelSecret param.Field[string] `json:"tunnel_secret"` + // Cloudflare account ID + AccountID param.Field[string] `path:"account_id,required"` + // A user-friendly name for the tunnel. + Name param.Field[string] `json:"name"` + // Sets the password required to run a locally-managed tunnel. Must be at least 32 + // bytes and encoded as a base64 string. + TunnelSecret param.Field[string] `json:"tunnel_secret"` } func (r WARPConnectorEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r) } type WARPConnectorEditResponseEnvelope struct { -Errors []shared.ResponseInfo `json:"errors,required"` -Messages []shared.ResponseInfo `json:"messages,required"` -// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. -Result WARPConnectorEditResponse `json:"result,required"` -// Whether the API call was successful -Success WARPConnectorEditResponseEnvelopeSuccess `json:"success,required"` -JSON warpConnectorEditResponseEnvelopeJSON `json:"-"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. + Result WARPConnectorEditResponse `json:"result,required"` + // Whether the API call was successful + Success WARPConnectorEditResponseEnvelopeSuccess `json:"success,required"` + JSON warpConnectorEditResponseEnvelopeJSON `json:"-"` } // warpConnectorEditResponseEnvelopeJSON contains the JSON metadata for the struct // [WARPConnectorEditResponseEnvelope] type warpConnectorEditResponseEnvelopeJSON struct { -Errors apijson.Field -Messages apijson.Field -Result apijson.Field -Success apijson.Field -raw string -ExtraFields map[string]apijson.Field + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *WARPConnectorEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r warpConnectorEditResponseEnvelopeJSON) RawJSON() (string) { - return r.raw +func (r warpConnectorEditResponseEnvelopeJSON) RawJSON() string { + return r.raw } // Whether the API call was successful type WARPConnectorEditResponseEnvelopeSuccess bool const ( - WARPConnectorEditResponseEnvelopeSuccessTrue WARPConnectorEditResponseEnvelopeSuccess = true + WARPConnectorEditResponseEnvelopeSuccessTrue WARPConnectorEditResponseEnvelopeSuccess = true ) -func (r WARPConnectorEditResponseEnvelopeSuccess) IsKnown() (bool) { - switch r { - case WARPConnectorEditResponseEnvelopeSuccessTrue: - return true - } - return false +func (r WARPConnectorEditResponseEnvelopeSuccess) IsKnown() bool { + switch r { + case WARPConnectorEditResponseEnvelopeSuccessTrue: + return true + } + return false } type WARPConnectorGetParams struct { -// Cloudflare account ID -AccountID param.Field[string] `path:"account_id,required"` + // Cloudflare account ID + AccountID param.Field[string] `path:"account_id,required"` } type WARPConnectorGetResponseEnvelope struct { -Errors []shared.ResponseInfo `json:"errors,required"` -Messages []shared.ResponseInfo `json:"messages,required"` -// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. -Result WARPConnectorGetResponse `json:"result,required"` -// Whether the API call was successful -Success WARPConnectorGetResponseEnvelopeSuccess `json:"success,required"` -JSON warpConnectorGetResponseEnvelopeJSON `json:"-"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. + Result WARPConnectorGetResponse `json:"result,required"` + // Whether the API call was successful + Success WARPConnectorGetResponseEnvelopeSuccess `json:"success,required"` + JSON warpConnectorGetResponseEnvelopeJSON `json:"-"` } // warpConnectorGetResponseEnvelopeJSON contains the JSON metadata for the struct // [WARPConnectorGetResponseEnvelope] type warpConnectorGetResponseEnvelopeJSON struct { -Errors apijson.Field -Messages apijson.Field -Result apijson.Field -Success apijson.Field -raw string -ExtraFields map[string]apijson.Field + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *WARPConnectorGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r warpConnectorGetResponseEnvelopeJSON) RawJSON() (string) { - return r.raw +func (r warpConnectorGetResponseEnvelopeJSON) RawJSON() string { + return r.raw } // Whether the API call was successful type WARPConnectorGetResponseEnvelopeSuccess bool const ( - WARPConnectorGetResponseEnvelopeSuccessTrue WARPConnectorGetResponseEnvelopeSuccess = true + WARPConnectorGetResponseEnvelopeSuccessTrue WARPConnectorGetResponseEnvelopeSuccess = true ) -func (r WARPConnectorGetResponseEnvelopeSuccess) IsKnown() (bool) { - switch r { - case WARPConnectorGetResponseEnvelopeSuccessTrue: - return true - } - return false +func (r WARPConnectorGetResponseEnvelopeSuccess) IsKnown() bool { + switch r { + case WARPConnectorGetResponseEnvelopeSuccessTrue: + return true + } + return false } type WARPConnectorTokenParams struct { -// Cloudflare account ID -AccountID param.Field[string] `path:"account_id,required"` + // Cloudflare account ID + AccountID param.Field[string] `path:"account_id,required"` } type WARPConnectorTokenResponseEnvelope struct { -Errors []shared.ResponseInfo `json:"errors,required"` -Messages []shared.ResponseInfo `json:"messages,required"` -Result WARPConnectorTokenResponseUnion `json:"result,required"` -// Whether the API call was successful -Success WARPConnectorTokenResponseEnvelopeSuccess `json:"success,required"` -JSON warpConnectorTokenResponseEnvelopeJSON `json:"-"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result WARPConnectorTokenResponseUnion `json:"result,required"` + // Whether the API call was successful + Success WARPConnectorTokenResponseEnvelopeSuccess `json:"success,required"` + JSON warpConnectorTokenResponseEnvelopeJSON `json:"-"` } // warpConnectorTokenResponseEnvelopeJSON contains the JSON metadata for the struct // [WARPConnectorTokenResponseEnvelope] type warpConnectorTokenResponseEnvelopeJSON struct { -Errors apijson.Field -Messages apijson.Field -Result apijson.Field -Success apijson.Field -raw string -ExtraFields map[string]apijson.Field + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *WARPConnectorTokenResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r warpConnectorTokenResponseEnvelopeJSON) RawJSON() (string) { - return r.raw +func (r warpConnectorTokenResponseEnvelopeJSON) RawJSON() string { + return r.raw } // Whether the API call was successful type WARPConnectorTokenResponseEnvelopeSuccess bool const ( - WARPConnectorTokenResponseEnvelopeSuccessTrue WARPConnectorTokenResponseEnvelopeSuccess = true + WARPConnectorTokenResponseEnvelopeSuccessTrue WARPConnectorTokenResponseEnvelopeSuccess = true ) -func (r WARPConnectorTokenResponseEnvelopeSuccess) IsKnown() (bool) { - switch r { - case WARPConnectorTokenResponseEnvelopeSuccessTrue: - return true - } - return false +func (r WARPConnectorTokenResponseEnvelopeSuccess) IsKnown() bool { + switch r { + case WARPConnectorTokenResponseEnvelopeSuccessTrue: + return true + } + return false } diff --git a/zero_trust/tunnel.go b/zero_trust/tunnel.go index 75136cdd9a0..bd6ddb667fa 100644 --- a/zero_trust/tunnel.go +++ b/zero_trust/tunnel.go @@ -3,21 +3,21 @@ package zero_trust import ( - "context" - "fmt" - "net/http" - "net/url" - "reflect" - "time" - - "github.com/cloudflare/cloudflare-go/v2/internal/apijson" - "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" - "github.com/cloudflare/cloudflare-go/v2/internal/pagination" - "github.com/cloudflare/cloudflare-go/v2/internal/param" - "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" - "github.com/cloudflare/cloudflare-go/v2/option" - "github.com/tidwall/gjson" + "context" + "fmt" + "net/http" + "net/url" + "reflect" + "time" + + "github.com/cloudflare/cloudflare-go/v2/internal/apijson" + "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" + "github.com/cloudflare/cloudflare-go/v2/internal/pagination" + "github.com/cloudflare/cloudflare-go/v2/internal/param" + "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" + "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/tidwall/gjson" ) // TunnelService contains methods and other services that help with interacting @@ -25,236 +25,236 @@ import ( // variables from the environment automatically. You should not instantiate this // service directly, and instead use the [NewTunnelService] method instead. type TunnelService struct { -Options []option.RequestOption -Configurations *TunnelConfigurationService -Connections *TunnelConnectionService -Token *TunnelTokenService -Connectors *TunnelConnectorService -Management *TunnelManagementService + Options []option.RequestOption + Configurations *TunnelConfigurationService + Connections *TunnelConnectionService + Token *TunnelTokenService + Connectors *TunnelConnectorService + Management *TunnelManagementService } // NewTunnelService generates a new service that applies the given options to each // request. These options are applied after the parent client's options (if there // is one), and before any request-specific options. func NewTunnelService(opts ...option.RequestOption) (r *TunnelService) { - r = &TunnelService{} - r.Options = opts - r.Configurations = NewTunnelConfigurationService(opts...) - r.Connections = NewTunnelConnectionService(opts...) - r.Token = NewTunnelTokenService(opts...) - r.Connectors = NewTunnelConnectorService(opts...) - r.Management = NewTunnelManagementService(opts...) - return + r = &TunnelService{} + r.Options = opts + r.Configurations = NewTunnelConfigurationService(opts...) + r.Connections = NewTunnelConnectionService(opts...) + r.Token = NewTunnelTokenService(opts...) + r.Connectors = NewTunnelConnectorService(opts...) + r.Management = NewTunnelManagementService(opts...) + return } // Creates a new Argo Tunnel in an account. func (r *TunnelService) New(ctx context.Context, params TunnelNewParams, opts ...option.RequestOption) (res *TunnelNewResponse, err error) { - opts = append(r.Options[:], opts...) - var env TunnelNewResponseEnvelope - path := fmt.Sprintf("accounts/%s/tunnels", params.AccountID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return + opts = append(r.Options[:], opts...) + var env TunnelNewResponseEnvelope + path := fmt.Sprintf("accounts/%s/tunnels", params.AccountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return } // Lists and filters all types of Tunnels in an account. func (r *TunnelService) List(ctx context.Context, params TunnelListParams, opts ...option.RequestOption) (res *pagination.V4PagePaginationArray[TunnelListResponse], err error) { - var raw *http.Response - opts = append(r.Options, opts...) - opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) - path := fmt.Sprintf("accounts/%s/tunnels", params.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, params, &res, opts...) - if err != nil { - return nil, err - } - err = cfg.Execute() - if err != nil { - return nil, err - } - res.SetPageConfig(cfg, raw) - return res, nil + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/tunnels", params.AccountID) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, params, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil } // Lists and filters all types of Tunnels in an account. -func (r *TunnelService) ListAutoPaging(ctx context.Context, params TunnelListParams, opts ...option.RequestOption) (*pagination.V4PagePaginationArrayAutoPager[TunnelListResponse]) { - return pagination.NewV4PagePaginationArrayAutoPager(r.List(ctx, params, opts...)) +func (r *TunnelService) ListAutoPaging(ctx context.Context, params TunnelListParams, opts ...option.RequestOption) *pagination.V4PagePaginationArrayAutoPager[TunnelListResponse] { + return pagination.NewV4PagePaginationArrayAutoPager(r.List(ctx, params, opts...)) } // Deletes an Argo Tunnel from an account. func (r *TunnelService) Delete(ctx context.Context, tunnelID string, params TunnelDeleteParams, opts ...option.RequestOption) (res *TunnelDeleteResponse, err error) { - opts = append(r.Options[:], opts...) - var env TunnelDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/tunnels/%s", params.AccountID, tunnelID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return + opts = append(r.Options[:], opts...) + var env TunnelDeleteResponseEnvelope + path := fmt.Sprintf("accounts/%s/tunnels/%s", params.AccountID, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return } // Updates an existing Cloudflare Tunnel. func (r *TunnelService) Edit(ctx context.Context, tunnelID string, params TunnelEditParams, opts ...option.RequestOption) (res *TunnelEditResponse, err error) { - opts = append(r.Options[:], opts...) - var env TunnelEditResponseEnvelope - path := fmt.Sprintf("accounts/%s/cfd_tunnel/%s", params.AccountID, tunnelID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return + opts = append(r.Options[:], opts...) + var env TunnelEditResponseEnvelope + path := fmt.Sprintf("accounts/%s/cfd_tunnel/%s", params.AccountID, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return } // Fetches a single Argo Tunnel. func (r *TunnelService) Get(ctx context.Context, tunnelID string, query TunnelGetParams, opts ...option.RequestOption) (res *TunnelGetResponse, err error) { - opts = append(r.Options[:], opts...) - var env TunnelGetResponseEnvelope - path := fmt.Sprintf("accounts/%s/tunnels/%s", query.AccountID, tunnelID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return + opts = append(r.Options[:], opts...) + var env TunnelGetResponseEnvelope + path := fmt.Sprintf("accounts/%s/tunnels/%s", query.AccountID, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return } type Connection struct { -// The Cloudflare data center used for this connection. -ColoName string `json:"colo_name"` -// Cloudflare continues to track connections for several minutes after they -// disconnect. This is an optimization to improve latency and reliability of -// reconnecting. If `true`, the connection has disconnected but is still being -// tracked. If `false`, the connection is actively serving traffic. -IsPendingReconnect bool `json:"is_pending_reconnect"` -// UUID of the Cloudflare Tunnel connection. -UUID string `json:"uuid"` -JSON connectionJSON `json:"-"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // UUID of the Cloudflare Tunnel connection. + UUID string `json:"uuid"` + JSON connectionJSON `json:"-"` } // connectionJSON contains the JSON metadata for the struct [Connection] type connectionJSON struct { -ColoName apijson.Field -IsPendingReconnect apijson.Field -UUID apijson.Field -raw string -ExtraFields map[string]apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + UUID apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *Connection) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r connectionJSON) RawJSON() (string) { - return r.raw +func (r connectionJSON) RawJSON() string { + return r.raw } type TunnelNewResponse struct { -// UUID of the tunnel. -ID string `json:"id,required"` -// The tunnel connections between your origin and Cloudflare's edge. -Connections []Connection `json:"connections,required"` -// Timestamp of when the tunnel was created. -CreatedAt time.Time `json:"created_at,required" format:"date-time"` -// A user-friendly name for the tunnel. -Name string `json:"name,required"` -// Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been -// deleted. -DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` -JSON tunnelNewResponseJSON `json:"-"` + // UUID of the tunnel. + ID string `json:"id,required"` + // The tunnel connections between your origin and Cloudflare's edge. + Connections []Connection `json:"connections,required"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + // A user-friendly name for the tunnel. + Name string `json:"name,required"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + JSON tunnelNewResponseJSON `json:"-"` } // tunnelNewResponseJSON contains the JSON metadata for the struct // [TunnelNewResponse] type tunnelNewResponseJSON struct { -ID apijson.Field -Connections apijson.Field -CreatedAt apijson.Field -Name apijson.Field -DeletedAt apijson.Field -raw string -ExtraFields map[string]apijson.Field + ID apijson.Field + Connections apijson.Field + CreatedAt apijson.Field + Name apijson.Field + DeletedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *TunnelNewResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r tunnelNewResponseJSON) RawJSON() (string) { - return r.raw +func (r tunnelNewResponseJSON) RawJSON() string { + return r.raw } // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. type TunnelListResponse struct { -// Cloudflare account ID -AccountTag string `json:"account_tag"` -Connections interface{} `json:"connections,required"` -// Timestamp of when the tunnel established at least one connection to Cloudflare's -// edge. If `null`, the tunnel is inactive. -ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` -// Timestamp of when the tunnel became inactive (no connections to Cloudflare's -// edge). If `null`, the tunnel is active. -ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` -// Timestamp of when the tunnel was created. -CreatedAt time.Time `json:"created_at" format:"date-time"` -// Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been -// deleted. -DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` -// UUID of the tunnel. -ID string `json:"id"` -Metadata interface{} `json:"metadata,required"` -// A user-friendly name for the tunnel. -Name string `json:"name"` -// If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. -// If `false`, the tunnel must be configured locally on the origin machine. -RemoteConfig bool `json:"remote_config"` -// The status of the tunnel. Valid values are `inactive` (tunnel has never been -// run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy -// state), `healthy` (tunnel is active and able to serve traffic), or `down` -// (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). -Status string `json:"status"` -// The type of tunnel. -TunType shared.TunnelListResponseTunType `json:"tun_type"` -JSON tunnelListResponseJSON `json:"-"` -union TunnelListResponseUnion + // Cloudflare account ID + AccountTag string `json:"account_tag"` + Connections interface{} `json:"connections,required"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // UUID of the tunnel. + ID string `json:"id"` + Metadata interface{} `json:"metadata,required"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + // If `false`, the tunnel must be configured locally on the origin machine. + RemoteConfig bool `json:"remote_config"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType TunnelListResponseTunType `json:"tun_type"` + JSON tunnelListResponseJSON `json:"-"` + union TunnelListResponseUnion } // tunnelListResponseJSON contains the JSON metadata for the struct // [TunnelListResponse] type tunnelListResponseJSON struct { -AccountTag apijson.Field -Connections apijson.Field -ConnsActiveAt apijson.Field -ConnsInactiveAt apijson.Field -CreatedAt apijson.Field -DeletedAt apijson.Field -ID apijson.Field -Metadata apijson.Field -Name apijson.Field -RemoteConfig apijson.Field -Status apijson.Field -TunType apijson.Field -raw string -ExtraFields map[string]apijson.Field -} - -func (r tunnelListResponseJSON) RawJSON() (string) { - return r.raw + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + ID apijson.Field + Metadata apijson.Field + Name apijson.Field + RemoteConfig apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r tunnelListResponseJSON) RawJSON() string { + return r.raw } func (r *TunnelListResponse) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) + err = apijson.UnmarshalRoot(data, &r.union) + if err != nil { + return err + } + return apijson.Port(r.union, &r) } -func (r TunnelListResponse) AsUnion() (TunnelListResponseUnion) { - return r.union +func (r TunnelListResponse) AsUnion() TunnelListResponseUnion { + return r.union } // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. @@ -262,272 +262,272 @@ func (r TunnelListResponse) AsUnion() (TunnelListResponseUnion) { // Union satisfied by [shared.CloudflareTunnel] or // [zero_trust.TunnelListResponseTunnelWARPConnectorTunnel]. type TunnelListResponseUnion interface { - ImplementsZeroTrustTunnelListResponse() + ImplementsZeroTrustTunnelListResponse() } func init() { - apijson.RegisterUnion( - reflect.TypeOf((*TunnelListResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(shared.CloudflareTunnel{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(TunnelListResponseTunnelWARPConnectorTunnel{}), - }, - ) + apijson.RegisterUnion( + reflect.TypeOf((*TunnelListResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(shared.CloudflareTunnel{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(TunnelListResponseTunnelWARPConnectorTunnel{}), + }, + ) } // A Warp Connector Tunnel that connects your origin to Cloudflare's edge. type TunnelListResponseTunnelWARPConnectorTunnel struct { -// UUID of the tunnel. -ID string `json:"id"` -// Cloudflare account ID -AccountTag string `json:"account_tag"` -// The Cloudflare Tunnel connections between your origin and Cloudflare's edge. -Connections []TunnelListResponseTunnelWARPConnectorTunnelConnection `json:"connections"` -// Timestamp of when the tunnel established at least one connection to Cloudflare's -// edge. If `null`, the tunnel is inactive. -ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` -// Timestamp of when the tunnel became inactive (no connections to Cloudflare's -// edge). If `null`, the tunnel is active. -ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` -// Timestamp of when the tunnel was created. -CreatedAt time.Time `json:"created_at" format:"date-time"` -// Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been -// deleted. -DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` -// Metadata associated with the tunnel. -Metadata interface{} `json:"metadata"` -// A user-friendly name for the tunnel. -Name string `json:"name"` -// The status of the tunnel. Valid values are `inactive` (tunnel has never been -// run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy -// state), `healthy` (tunnel is active and able to serve traffic), or `down` -// (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). -Status string `json:"status"` -// The type of tunnel. -TunType TunnelListResponseTunnelWARPConnectorTunnelTunType `json:"tun_type"` -JSON tunnelListResponseTunnelWARPConnectorTunnelJSON `json:"-"` + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []TunnelListResponseTunnelWARPConnectorTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType TunnelListResponseTunnelWARPConnectorTunnelTunType `json:"tun_type"` + JSON tunnelListResponseTunnelWARPConnectorTunnelJSON `json:"-"` } // tunnelListResponseTunnelWARPConnectorTunnelJSON contains the JSON metadata for // the struct [TunnelListResponseTunnelWARPConnectorTunnel] type tunnelListResponseTunnelWARPConnectorTunnelJSON struct { -ID apijson.Field -AccountTag apijson.Field -Connections apijson.Field -ConnsActiveAt apijson.Field -ConnsInactiveAt apijson.Field -CreatedAt apijson.Field -DeletedAt apijson.Field -Metadata apijson.Field -Name apijson.Field -Status apijson.Field -TunType apijson.Field -raw string -ExtraFields map[string]apijson.Field + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *TunnelListResponseTunnelWARPConnectorTunnel) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r tunnelListResponseTunnelWARPConnectorTunnelJSON) RawJSON() (string) { - return r.raw +func (r tunnelListResponseTunnelWARPConnectorTunnelJSON) RawJSON() string { + return r.raw } func (r TunnelListResponseTunnelWARPConnectorTunnel) ImplementsZeroTrustTunnelListResponse() {} type TunnelListResponseTunnelWARPConnectorTunnelConnection struct { -// UUID of the Cloudflare Tunnel connection. -ID string `json:"id"` -// UUID of the cloudflared instance. -ClientID interface{} `json:"client_id"` -// The cloudflared version used to establish this connection. -ClientVersion string `json:"client_version"` -// The Cloudflare data center used for this connection. -ColoName string `json:"colo_name"` -// Cloudflare continues to track connections for several minutes after they -// disconnect. This is an optimization to improve latency and reliability of -// reconnecting. If `true`, the connection has disconnected but is still being -// tracked. If `false`, the connection is actively serving traffic. -IsPendingReconnect bool `json:"is_pending_reconnect"` -// Timestamp of when the connection was established. -OpenedAt time.Time `json:"opened_at" format:"date-time"` -// The public IP address of the host running cloudflared. -OriginIP string `json:"origin_ip"` -// UUID of the Cloudflare Tunnel connection. -UUID string `json:"uuid"` -JSON tunnelListResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + UUID string `json:"uuid"` + JSON tunnelListResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` } // tunnelListResponseTunnelWARPConnectorTunnelConnectionJSON contains the JSON // metadata for the struct [TunnelListResponseTunnelWARPConnectorTunnelConnection] type tunnelListResponseTunnelWARPConnectorTunnelConnectionJSON struct { -ID apijson.Field -ClientID apijson.Field -ClientVersion apijson.Field -ColoName apijson.Field -IsPendingReconnect apijson.Field -OpenedAt apijson.Field -OriginIP apijson.Field -UUID apijson.Field -raw string -ExtraFields map[string]apijson.Field + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + UUID apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *TunnelListResponseTunnelWARPConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r tunnelListResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() (string) { - return r.raw +func (r tunnelListResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() string { + return r.raw } // The type of tunnel. type TunnelListResponseTunnelWARPConnectorTunnelTunType string const ( - TunnelListResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel TunnelListResponseTunnelWARPConnectorTunnelTunType = "cfd_tunnel" - TunnelListResponseTunnelWARPConnectorTunnelTunTypeWARPConnector TunnelListResponseTunnelWARPConnectorTunnelTunType = "warp_connector" - TunnelListResponseTunnelWARPConnectorTunnelTunTypeIPSec TunnelListResponseTunnelWARPConnectorTunnelTunType = "ip_sec" - TunnelListResponseTunnelWARPConnectorTunnelTunTypeGRE TunnelListResponseTunnelWARPConnectorTunnelTunType = "gre" - TunnelListResponseTunnelWARPConnectorTunnelTunTypeCNI TunnelListResponseTunnelWARPConnectorTunnelTunType = "cni" + TunnelListResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel TunnelListResponseTunnelWARPConnectorTunnelTunType = "cfd_tunnel" + TunnelListResponseTunnelWARPConnectorTunnelTunTypeWARPConnector TunnelListResponseTunnelWARPConnectorTunnelTunType = "warp_connector" + TunnelListResponseTunnelWARPConnectorTunnelTunTypeIPSec TunnelListResponseTunnelWARPConnectorTunnelTunType = "ip_sec" + TunnelListResponseTunnelWARPConnectorTunnelTunTypeGRE TunnelListResponseTunnelWARPConnectorTunnelTunType = "gre" + TunnelListResponseTunnelWARPConnectorTunnelTunTypeCNI TunnelListResponseTunnelWARPConnectorTunnelTunType = "cni" ) -func (r TunnelListResponseTunnelWARPConnectorTunnelTunType) IsKnown() (bool) { - switch r { - case TunnelListResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel, TunnelListResponseTunnelWARPConnectorTunnelTunTypeWARPConnector, TunnelListResponseTunnelWARPConnectorTunnelTunTypeIPSec, TunnelListResponseTunnelWARPConnectorTunnelTunTypeGRE, TunnelListResponseTunnelWARPConnectorTunnelTunTypeCNI: - return true - } - return false +func (r TunnelListResponseTunnelWARPConnectorTunnelTunType) IsKnown() bool { + switch r { + case TunnelListResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel, TunnelListResponseTunnelWARPConnectorTunnelTunTypeWARPConnector, TunnelListResponseTunnelWARPConnectorTunnelTunTypeIPSec, TunnelListResponseTunnelWARPConnectorTunnelTunTypeGRE, TunnelListResponseTunnelWARPConnectorTunnelTunTypeCNI: + return true + } + return false } // The type of tunnel. -type shared.TunnelListResponseTunType string +type TunnelListResponseTunType string const ( - shared.TunnelListResponseTunTypeCfdTunnel shared.TunnelListResponseTunType = "cfd_tunnel" - shared.TunnelListResponseTunTypeWARPConnector shared.TunnelListResponseTunType = "warp_connector" - shared.TunnelListResponseTunTypeIPSec shared.TunnelListResponseTunType = "ip_sec" - shared.TunnelListResponseTunTypeGRE shared.TunnelListResponseTunType = "gre" - shared.TunnelListResponseTunTypeCNI shared.TunnelListResponseTunType = "cni" + TunnelListResponseTunTypeCfdTunnel TunnelListResponseTunType = "cfd_tunnel" + TunnelListResponseTunTypeWARPConnector TunnelListResponseTunType = "warp_connector" + TunnelListResponseTunTypeIPSec TunnelListResponseTunType = "ip_sec" + TunnelListResponseTunTypeGRE TunnelListResponseTunType = "gre" + TunnelListResponseTunTypeCNI TunnelListResponseTunType = "cni" ) -func (r shared.TunnelListResponseTunType) IsKnown() (bool) { - switch r { - case shared.TunnelListResponseTunTypeCfdTunnel, shared.TunnelListResponseTunTypeWARPConnector, shared.TunnelListResponseTunTypeIPSec, shared.TunnelListResponseTunTypeGRE, shared.TunnelListResponseTunTypeCNI: - return true - } - return false +func (r TunnelListResponseTunType) IsKnown() bool { + switch r { + case TunnelListResponseTunTypeCfdTunnel, TunnelListResponseTunTypeWARPConnector, TunnelListResponseTunTypeIPSec, TunnelListResponseTunTypeGRE, TunnelListResponseTunTypeCNI: + return true + } + return false } type TunnelDeleteResponse struct { -// UUID of the tunnel. -ID string `json:"id,required"` -// The tunnel connections between your origin and Cloudflare's edge. -Connections []Connection `json:"connections,required"` -// Timestamp of when the tunnel was created. -CreatedAt time.Time `json:"created_at,required" format:"date-time"` -// A user-friendly name for the tunnel. -Name string `json:"name,required"` -// Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been -// deleted. -DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` -JSON tunnelDeleteResponseJSON `json:"-"` + // UUID of the tunnel. + ID string `json:"id,required"` + // The tunnel connections between your origin and Cloudflare's edge. + Connections []Connection `json:"connections,required"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + // A user-friendly name for the tunnel. + Name string `json:"name,required"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + JSON tunnelDeleteResponseJSON `json:"-"` } // tunnelDeleteResponseJSON contains the JSON metadata for the struct // [TunnelDeleteResponse] type tunnelDeleteResponseJSON struct { -ID apijson.Field -Connections apijson.Field -CreatedAt apijson.Field -Name apijson.Field -DeletedAt apijson.Field -raw string -ExtraFields map[string]apijson.Field + ID apijson.Field + Connections apijson.Field + CreatedAt apijson.Field + Name apijson.Field + DeletedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *TunnelDeleteResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r tunnelDeleteResponseJSON) RawJSON() (string) { - return r.raw +func (r tunnelDeleteResponseJSON) RawJSON() string { + return r.raw } // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. type TunnelEditResponse struct { -// Cloudflare account ID -AccountTag string `json:"account_tag"` -Connections interface{} `json:"connections,required"` -// Timestamp of when the tunnel established at least one connection to Cloudflare's -// edge. If `null`, the tunnel is inactive. -ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` -// Timestamp of when the tunnel became inactive (no connections to Cloudflare's -// edge). If `null`, the tunnel is active. -ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` -// Timestamp of when the tunnel was created. -CreatedAt time.Time `json:"created_at" format:"date-time"` -// Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been -// deleted. -DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` -// UUID of the tunnel. -ID string `json:"id"` -Metadata interface{} `json:"metadata,required"` -// A user-friendly name for the tunnel. -Name string `json:"name"` -// If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. -// If `false`, the tunnel must be configured locally on the origin machine. -RemoteConfig bool `json:"remote_config"` -// The status of the tunnel. Valid values are `inactive` (tunnel has never been -// run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy -// state), `healthy` (tunnel is active and able to serve traffic), or `down` -// (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). -Status string `json:"status"` -// The type of tunnel. -TunType shared.TunnelEditResponseTunType `json:"tun_type"` -JSON tunnelEditResponseJSON `json:"-"` -union TunnelEditResponseUnion + // Cloudflare account ID + AccountTag string `json:"account_tag"` + Connections interface{} `json:"connections,required"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // UUID of the tunnel. + ID string `json:"id"` + Metadata interface{} `json:"metadata,required"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // If `true`, the tunnel can be configured remotely from the Zero Trust dashboard. + // If `false`, the tunnel must be configured locally on the origin machine. + RemoteConfig bool `json:"remote_config"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType TunnelEditResponseTunType `json:"tun_type"` + JSON tunnelEditResponseJSON `json:"-"` + union TunnelEditResponseUnion } // tunnelEditResponseJSON contains the JSON metadata for the struct // [TunnelEditResponse] type tunnelEditResponseJSON struct { -AccountTag apijson.Field -Connections apijson.Field -ConnsActiveAt apijson.Field -ConnsInactiveAt apijson.Field -CreatedAt apijson.Field -DeletedAt apijson.Field -ID apijson.Field -Metadata apijson.Field -Name apijson.Field -RemoteConfig apijson.Field -Status apijson.Field -TunType apijson.Field -raw string -ExtraFields map[string]apijson.Field -} - -func (r tunnelEditResponseJSON) RawJSON() (string) { - return r.raw + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + ID apijson.Field + Metadata apijson.Field + Name apijson.Field + RemoteConfig apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r tunnelEditResponseJSON) RawJSON() string { + return r.raw } func (r *TunnelEditResponse) UnmarshalJSON(data []byte) (err error) { - err = apijson.UnmarshalRoot(data, &r.union) - if err != nil { - return err - } - return apijson.Port(r.union, &r) + err = apijson.UnmarshalRoot(data, &r.union) + if err != nil { + return err + } + return apijson.Port(r.union, &r) } -func (r TunnelEditResponse) AsUnion() (TunnelEditResponseUnion) { - return r.union +func (r TunnelEditResponse) AsUnion() TunnelEditResponseUnion { + return r.union } // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. @@ -535,449 +535,449 @@ func (r TunnelEditResponse) AsUnion() (TunnelEditResponseUnion) { // Union satisfied by [shared.CloudflareTunnel] or // [zero_trust.TunnelEditResponseTunnelWARPConnectorTunnel]. type TunnelEditResponseUnion interface { - ImplementsZeroTrustTunnelEditResponse() + ImplementsZeroTrustTunnelEditResponse() } func init() { - apijson.RegisterUnion( - reflect.TypeOf((*TunnelEditResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(shared.CloudflareTunnel{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(TunnelEditResponseTunnelWARPConnectorTunnel{}), - }, - ) + apijson.RegisterUnion( + reflect.TypeOf((*TunnelEditResponseUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(shared.CloudflareTunnel{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(TunnelEditResponseTunnelWARPConnectorTunnel{}), + }, + ) } // A Warp Connector Tunnel that connects your origin to Cloudflare's edge. type TunnelEditResponseTunnelWARPConnectorTunnel struct { -// UUID of the tunnel. -ID string `json:"id"` -// Cloudflare account ID -AccountTag string `json:"account_tag"` -// The Cloudflare Tunnel connections between your origin and Cloudflare's edge. -Connections []TunnelEditResponseTunnelWARPConnectorTunnelConnection `json:"connections"` -// Timestamp of when the tunnel established at least one connection to Cloudflare's -// edge. If `null`, the tunnel is inactive. -ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` -// Timestamp of when the tunnel became inactive (no connections to Cloudflare's -// edge). If `null`, the tunnel is active. -ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` -// Timestamp of when the tunnel was created. -CreatedAt time.Time `json:"created_at" format:"date-time"` -// Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been -// deleted. -DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` -// Metadata associated with the tunnel. -Metadata interface{} `json:"metadata"` -// A user-friendly name for the tunnel. -Name string `json:"name"` -// The status of the tunnel. Valid values are `inactive` (tunnel has never been -// run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy -// state), `healthy` (tunnel is active and able to serve traffic), or `down` -// (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). -Status string `json:"status"` -// The type of tunnel. -TunType TunnelEditResponseTunnelWARPConnectorTunnelTunType `json:"tun_type"` -JSON tunnelEditResponseTunnelWARPConnectorTunnelJSON `json:"-"` + // UUID of the tunnel. + ID string `json:"id"` + // Cloudflare account ID + AccountTag string `json:"account_tag"` + // The Cloudflare Tunnel connections between your origin and Cloudflare's edge. + Connections []TunnelEditResponseTunnelWARPConnectorTunnelConnection `json:"connections"` + // Timestamp of when the tunnel established at least one connection to Cloudflare's + // edge. If `null`, the tunnel is inactive. + ConnsActiveAt time.Time `json:"conns_active_at,nullable" format:"date-time"` + // Timestamp of when the tunnel became inactive (no connections to Cloudflare's + // edge). If `null`, the tunnel is active. + ConnsInactiveAt time.Time `json:"conns_inactive_at,nullable" format:"date-time"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at" format:"date-time"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + // Metadata associated with the tunnel. + Metadata interface{} `json:"metadata"` + // A user-friendly name for the tunnel. + Name string `json:"name"` + // The status of the tunnel. Valid values are `inactive` (tunnel has never been + // run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy + // state), `healthy` (tunnel is active and able to serve traffic), or `down` + // (tunnel can not serve traffic as it has no connections to the Cloudflare Edge). + Status string `json:"status"` + // The type of tunnel. + TunType TunnelEditResponseTunnelWARPConnectorTunnelTunType `json:"tun_type"` + JSON tunnelEditResponseTunnelWARPConnectorTunnelJSON `json:"-"` } // tunnelEditResponseTunnelWARPConnectorTunnelJSON contains the JSON metadata for // the struct [TunnelEditResponseTunnelWARPConnectorTunnel] type tunnelEditResponseTunnelWARPConnectorTunnelJSON struct { -ID apijson.Field -AccountTag apijson.Field -Connections apijson.Field -ConnsActiveAt apijson.Field -ConnsInactiveAt apijson.Field -CreatedAt apijson.Field -DeletedAt apijson.Field -Metadata apijson.Field -Name apijson.Field -Status apijson.Field -TunType apijson.Field -raw string -ExtraFields map[string]apijson.Field + ID apijson.Field + AccountTag apijson.Field + Connections apijson.Field + ConnsActiveAt apijson.Field + ConnsInactiveAt apijson.Field + CreatedAt apijson.Field + DeletedAt apijson.Field + Metadata apijson.Field + Name apijson.Field + Status apijson.Field + TunType apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *TunnelEditResponseTunnelWARPConnectorTunnel) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r tunnelEditResponseTunnelWARPConnectorTunnelJSON) RawJSON() (string) { - return r.raw +func (r tunnelEditResponseTunnelWARPConnectorTunnelJSON) RawJSON() string { + return r.raw } func (r TunnelEditResponseTunnelWARPConnectorTunnel) ImplementsZeroTrustTunnelEditResponse() {} type TunnelEditResponseTunnelWARPConnectorTunnelConnection struct { -// UUID of the Cloudflare Tunnel connection. -ID string `json:"id"` -// UUID of the cloudflared instance. -ClientID interface{} `json:"client_id"` -// The cloudflared version used to establish this connection. -ClientVersion string `json:"client_version"` -// The Cloudflare data center used for this connection. -ColoName string `json:"colo_name"` -// Cloudflare continues to track connections for several minutes after they -// disconnect. This is an optimization to improve latency and reliability of -// reconnecting. If `true`, the connection has disconnected but is still being -// tracked. If `false`, the connection is actively serving traffic. -IsPendingReconnect bool `json:"is_pending_reconnect"` -// Timestamp of when the connection was established. -OpenedAt time.Time `json:"opened_at" format:"date-time"` -// The public IP address of the host running cloudflared. -OriginIP string `json:"origin_ip"` -// UUID of the Cloudflare Tunnel connection. -UUID string `json:"uuid"` -JSON tunnelEditResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` + // UUID of the Cloudflare Tunnel connection. + ID string `json:"id"` + // UUID of the cloudflared instance. + ClientID interface{} `json:"client_id"` + // The cloudflared version used to establish this connection. + ClientVersion string `json:"client_version"` + // The Cloudflare data center used for this connection. + ColoName string `json:"colo_name"` + // Cloudflare continues to track connections for several minutes after they + // disconnect. This is an optimization to improve latency and reliability of + // reconnecting. If `true`, the connection has disconnected but is still being + // tracked. If `false`, the connection is actively serving traffic. + IsPendingReconnect bool `json:"is_pending_reconnect"` + // Timestamp of when the connection was established. + OpenedAt time.Time `json:"opened_at" format:"date-time"` + // The public IP address of the host running cloudflared. + OriginIP string `json:"origin_ip"` + // UUID of the Cloudflare Tunnel connection. + UUID string `json:"uuid"` + JSON tunnelEditResponseTunnelWARPConnectorTunnelConnectionJSON `json:"-"` } // tunnelEditResponseTunnelWARPConnectorTunnelConnectionJSON contains the JSON // metadata for the struct [TunnelEditResponseTunnelWARPConnectorTunnelConnection] type tunnelEditResponseTunnelWARPConnectorTunnelConnectionJSON struct { -ID apijson.Field -ClientID apijson.Field -ClientVersion apijson.Field -ColoName apijson.Field -IsPendingReconnect apijson.Field -OpenedAt apijson.Field -OriginIP apijson.Field -UUID apijson.Field -raw string -ExtraFields map[string]apijson.Field + ID apijson.Field + ClientID apijson.Field + ClientVersion apijson.Field + ColoName apijson.Field + IsPendingReconnect apijson.Field + OpenedAt apijson.Field + OriginIP apijson.Field + UUID apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *TunnelEditResponseTunnelWARPConnectorTunnelConnection) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r tunnelEditResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() (string) { - return r.raw +func (r tunnelEditResponseTunnelWARPConnectorTunnelConnectionJSON) RawJSON() string { + return r.raw } // The type of tunnel. type TunnelEditResponseTunnelWARPConnectorTunnelTunType string const ( - TunnelEditResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel TunnelEditResponseTunnelWARPConnectorTunnelTunType = "cfd_tunnel" - TunnelEditResponseTunnelWARPConnectorTunnelTunTypeWARPConnector TunnelEditResponseTunnelWARPConnectorTunnelTunType = "warp_connector" - TunnelEditResponseTunnelWARPConnectorTunnelTunTypeIPSec TunnelEditResponseTunnelWARPConnectorTunnelTunType = "ip_sec" - TunnelEditResponseTunnelWARPConnectorTunnelTunTypeGRE TunnelEditResponseTunnelWARPConnectorTunnelTunType = "gre" - TunnelEditResponseTunnelWARPConnectorTunnelTunTypeCNI TunnelEditResponseTunnelWARPConnectorTunnelTunType = "cni" + TunnelEditResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel TunnelEditResponseTunnelWARPConnectorTunnelTunType = "cfd_tunnel" + TunnelEditResponseTunnelWARPConnectorTunnelTunTypeWARPConnector TunnelEditResponseTunnelWARPConnectorTunnelTunType = "warp_connector" + TunnelEditResponseTunnelWARPConnectorTunnelTunTypeIPSec TunnelEditResponseTunnelWARPConnectorTunnelTunType = "ip_sec" + TunnelEditResponseTunnelWARPConnectorTunnelTunTypeGRE TunnelEditResponseTunnelWARPConnectorTunnelTunType = "gre" + TunnelEditResponseTunnelWARPConnectorTunnelTunTypeCNI TunnelEditResponseTunnelWARPConnectorTunnelTunType = "cni" ) -func (r TunnelEditResponseTunnelWARPConnectorTunnelTunType) IsKnown() (bool) { - switch r { - case TunnelEditResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel, TunnelEditResponseTunnelWARPConnectorTunnelTunTypeWARPConnector, TunnelEditResponseTunnelWARPConnectorTunnelTunTypeIPSec, TunnelEditResponseTunnelWARPConnectorTunnelTunTypeGRE, TunnelEditResponseTunnelWARPConnectorTunnelTunTypeCNI: - return true - } - return false +func (r TunnelEditResponseTunnelWARPConnectorTunnelTunType) IsKnown() bool { + switch r { + case TunnelEditResponseTunnelWARPConnectorTunnelTunTypeCfdTunnel, TunnelEditResponseTunnelWARPConnectorTunnelTunTypeWARPConnector, TunnelEditResponseTunnelWARPConnectorTunnelTunTypeIPSec, TunnelEditResponseTunnelWARPConnectorTunnelTunTypeGRE, TunnelEditResponseTunnelWARPConnectorTunnelTunTypeCNI: + return true + } + return false } // The type of tunnel. -type shared.TunnelEditResponseTunType string +type TunnelEditResponseTunType string const ( - shared.TunnelEditResponseTunTypeCfdTunnel shared.TunnelEditResponseTunType = "cfd_tunnel" - shared.TunnelEditResponseTunTypeWARPConnector shared.TunnelEditResponseTunType = "warp_connector" - shared.TunnelEditResponseTunTypeIPSec shared.TunnelEditResponseTunType = "ip_sec" - shared.TunnelEditResponseTunTypeGRE shared.TunnelEditResponseTunType = "gre" - shared.TunnelEditResponseTunTypeCNI shared.TunnelEditResponseTunType = "cni" + TunnelEditResponseTunTypeCfdTunnel TunnelEditResponseTunType = "cfd_tunnel" + TunnelEditResponseTunTypeWARPConnector TunnelEditResponseTunType = "warp_connector" + TunnelEditResponseTunTypeIPSec TunnelEditResponseTunType = "ip_sec" + TunnelEditResponseTunTypeGRE TunnelEditResponseTunType = "gre" + TunnelEditResponseTunTypeCNI TunnelEditResponseTunType = "cni" ) -func (r shared.TunnelEditResponseTunType) IsKnown() (bool) { - switch r { - case shared.TunnelEditResponseTunTypeCfdTunnel, shared.TunnelEditResponseTunTypeWARPConnector, shared.TunnelEditResponseTunTypeIPSec, shared.TunnelEditResponseTunTypeGRE, shared.TunnelEditResponseTunTypeCNI: - return true - } - return false +func (r TunnelEditResponseTunType) IsKnown() bool { + switch r { + case TunnelEditResponseTunTypeCfdTunnel, TunnelEditResponseTunTypeWARPConnector, TunnelEditResponseTunTypeIPSec, TunnelEditResponseTunTypeGRE, TunnelEditResponseTunTypeCNI: + return true + } + return false } type TunnelGetResponse struct { -// UUID of the tunnel. -ID string `json:"id,required"` -// The tunnel connections between your origin and Cloudflare's edge. -Connections []Connection `json:"connections,required"` -// Timestamp of when the tunnel was created. -CreatedAt time.Time `json:"created_at,required" format:"date-time"` -// A user-friendly name for the tunnel. -Name string `json:"name,required"` -// Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been -// deleted. -DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` -JSON tunnelGetResponseJSON `json:"-"` + // UUID of the tunnel. + ID string `json:"id,required"` + // The tunnel connections between your origin and Cloudflare's edge. + Connections []Connection `json:"connections,required"` + // Timestamp of when the tunnel was created. + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + // A user-friendly name for the tunnel. + Name string `json:"name,required"` + // Timestamp of when the tunnel was deleted. If `null`, the tunnel has not been + // deleted. + DeletedAt time.Time `json:"deleted_at,nullable" format:"date-time"` + JSON tunnelGetResponseJSON `json:"-"` } // tunnelGetResponseJSON contains the JSON metadata for the struct // [TunnelGetResponse] type tunnelGetResponseJSON struct { -ID apijson.Field -Connections apijson.Field -CreatedAt apijson.Field -Name apijson.Field -DeletedAt apijson.Field -raw string -ExtraFields map[string]apijson.Field + ID apijson.Field + Connections apijson.Field + CreatedAt apijson.Field + Name apijson.Field + DeletedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *TunnelGetResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r tunnelGetResponseJSON) RawJSON() (string) { - return r.raw +func (r tunnelGetResponseJSON) RawJSON() string { + return r.raw } type TunnelNewParams struct { -// Cloudflare account ID -AccountID param.Field[string] `path:"account_id,required"` -// A user-friendly name for the tunnel. -Name param.Field[string] `json:"name,required"` -// Sets the password required to run the tunnel. Must be at least 32 bytes and -// encoded as a base64 string. -TunnelSecret param.Field[interface{}] `json:"tunnel_secret,required"` + // Cloudflare account ID + AccountID param.Field[string] `path:"account_id,required"` + // A user-friendly name for the tunnel. + Name param.Field[string] `json:"name,required"` + // Sets the password required to run the tunnel. Must be at least 32 bytes and + // encoded as a base64 string. + TunnelSecret param.Field[interface{}] `json:"tunnel_secret,required"` } func (r TunnelNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r) } type TunnelNewResponseEnvelope struct { -Errors []shared.ResponseInfo `json:"errors,required"` -Messages []shared.ResponseInfo `json:"messages,required"` -Result TunnelNewResponse `json:"result,required"` -// Whether the API call was successful -Success TunnelNewResponseEnvelopeSuccess `json:"success,required"` -JSON tunnelNewResponseEnvelopeJSON `json:"-"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result TunnelNewResponse `json:"result,required"` + // Whether the API call was successful + Success TunnelNewResponseEnvelopeSuccess `json:"success,required"` + JSON tunnelNewResponseEnvelopeJSON `json:"-"` } // tunnelNewResponseEnvelopeJSON contains the JSON metadata for the struct // [TunnelNewResponseEnvelope] type tunnelNewResponseEnvelopeJSON struct { -Errors apijson.Field -Messages apijson.Field -Result apijson.Field -Success apijson.Field -raw string -ExtraFields map[string]apijson.Field + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *TunnelNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r tunnelNewResponseEnvelopeJSON) RawJSON() (string) { - return r.raw +func (r tunnelNewResponseEnvelopeJSON) RawJSON() string { + return r.raw } // Whether the API call was successful type TunnelNewResponseEnvelopeSuccess bool const ( - TunnelNewResponseEnvelopeSuccessTrue TunnelNewResponseEnvelopeSuccess = true + TunnelNewResponseEnvelopeSuccessTrue TunnelNewResponseEnvelopeSuccess = true ) -func (r TunnelNewResponseEnvelopeSuccess) IsKnown() (bool) { - switch r { - case TunnelNewResponseEnvelopeSuccessTrue: - return true - } - return false +func (r TunnelNewResponseEnvelopeSuccess) IsKnown() bool { + switch r { + case TunnelNewResponseEnvelopeSuccessTrue: + return true + } + return false } type TunnelListParams struct { -// Cloudflare account ID -AccountID param.Field[string] `path:"account_id,required"` -ExcludePrefix param.Field[string] `query:"exclude_prefix"` -// If provided, include only tunnels that were created (and not deleted) before -// this time. -ExistedAt param.Field[time.Time] `query:"existed_at" format:"date-time"` -IncludePrefix param.Field[string] `query:"include_prefix"` -// If `true`, only include deleted tunnels. If `false`, exclude deleted tunnels. If -// empty, all tunnels will be included. -IsDeleted param.Field[bool] `query:"is_deleted"` -// A user-friendly name for the tunnel. -Name param.Field[string] `query:"name"` -// Page number of paginated results. -Page param.Field[float64] `query:"page"` -// Number of results to display. -PerPage param.Field[float64] `query:"per_page"` -// The types of tunnels to filter separated by a comma. -TunTypes param.Field[string] `query:"tun_types"` -// UUID of the tunnel. -UUID param.Field[string] `query:"uuid"` -WasActiveAt param.Field[time.Time] `query:"was_active_at" format:"date-time"` -WasInactiveAt param.Field[time.Time] `query:"was_inactive_at" format:"date-time"` + // Cloudflare account ID + AccountID param.Field[string] `path:"account_id,required"` + ExcludePrefix param.Field[string] `query:"exclude_prefix"` + // If provided, include only tunnels that were created (and not deleted) before + // this time. + ExistedAt param.Field[time.Time] `query:"existed_at" format:"date-time"` + IncludePrefix param.Field[string] `query:"include_prefix"` + // If `true`, only include deleted tunnels. If `false`, exclude deleted tunnels. If + // empty, all tunnels will be included. + IsDeleted param.Field[bool] `query:"is_deleted"` + // A user-friendly name for the tunnel. + Name param.Field[string] `query:"name"` + // Page number of paginated results. + Page param.Field[float64] `query:"page"` + // Number of results to display. + PerPage param.Field[float64] `query:"per_page"` + // The types of tunnels to filter separated by a comma. + TunTypes param.Field[string] `query:"tun_types"` + // UUID of the tunnel. + UUID param.Field[string] `query:"uuid"` + WasActiveAt param.Field[time.Time] `query:"was_active_at" format:"date-time"` + WasInactiveAt param.Field[time.Time] `query:"was_inactive_at" format:"date-time"` } // URLQuery serializes [TunnelListParams]'s query parameters as `url.Values`. func (r TunnelListParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatRepeat, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatRepeat, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) } type TunnelDeleteParams struct { -// Cloudflare account ID -AccountID param.Field[string] `path:"account_id,required"` -Body interface{} `json:"body,required"` + // Cloudflare account ID + AccountID param.Field[string] `path:"account_id,required"` + Body interface{} `json:"body,required"` } func (r TunnelDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) + return apijson.MarshalRoot(r.Body) } type TunnelDeleteResponseEnvelope struct { -Errors []shared.ResponseInfo `json:"errors,required"` -Messages []shared.ResponseInfo `json:"messages,required"` -Result TunnelDeleteResponse `json:"result,required"` -// Whether the API call was successful -Success TunnelDeleteResponseEnvelopeSuccess `json:"success,required"` -JSON tunnelDeleteResponseEnvelopeJSON `json:"-"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result TunnelDeleteResponse `json:"result,required"` + // Whether the API call was successful + Success TunnelDeleteResponseEnvelopeSuccess `json:"success,required"` + JSON tunnelDeleteResponseEnvelopeJSON `json:"-"` } // tunnelDeleteResponseEnvelopeJSON contains the JSON metadata for the struct // [TunnelDeleteResponseEnvelope] type tunnelDeleteResponseEnvelopeJSON struct { -Errors apijson.Field -Messages apijson.Field -Result apijson.Field -Success apijson.Field -raw string -ExtraFields map[string]apijson.Field + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *TunnelDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r tunnelDeleteResponseEnvelopeJSON) RawJSON() (string) { - return r.raw +func (r tunnelDeleteResponseEnvelopeJSON) RawJSON() string { + return r.raw } // Whether the API call was successful type TunnelDeleteResponseEnvelopeSuccess bool const ( - TunnelDeleteResponseEnvelopeSuccessTrue TunnelDeleteResponseEnvelopeSuccess = true + TunnelDeleteResponseEnvelopeSuccessTrue TunnelDeleteResponseEnvelopeSuccess = true ) -func (r TunnelDeleteResponseEnvelopeSuccess) IsKnown() (bool) { - switch r { - case TunnelDeleteResponseEnvelopeSuccessTrue: - return true - } - return false +func (r TunnelDeleteResponseEnvelopeSuccess) IsKnown() bool { + switch r { + case TunnelDeleteResponseEnvelopeSuccessTrue: + return true + } + return false } type TunnelEditParams struct { -// Cloudflare account ID -AccountID param.Field[string] `path:"account_id,required"` -// A user-friendly name for the tunnel. -Name param.Field[string] `json:"name"` -// Sets the password required to run a locally-managed tunnel. Must be at least 32 -// bytes and encoded as a base64 string. -TunnelSecret param.Field[string] `json:"tunnel_secret"` + // Cloudflare account ID + AccountID param.Field[string] `path:"account_id,required"` + // A user-friendly name for the tunnel. + Name param.Field[string] `json:"name"` + // Sets the password required to run a locally-managed tunnel. Must be at least 32 + // bytes and encoded as a base64 string. + TunnelSecret param.Field[string] `json:"tunnel_secret"` } func (r TunnelEditParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + return apijson.MarshalRoot(r) } type TunnelEditResponseEnvelope struct { -Errors []shared.ResponseInfo `json:"errors,required"` -Messages []shared.ResponseInfo `json:"messages,required"` -// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. -Result TunnelEditResponse `json:"result,required"` -// Whether the API call was successful -Success TunnelEditResponseEnvelopeSuccess `json:"success,required"` -JSON tunnelEditResponseEnvelopeJSON `json:"-"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. + Result TunnelEditResponse `json:"result,required"` + // Whether the API call was successful + Success TunnelEditResponseEnvelopeSuccess `json:"success,required"` + JSON tunnelEditResponseEnvelopeJSON `json:"-"` } // tunnelEditResponseEnvelopeJSON contains the JSON metadata for the struct // [TunnelEditResponseEnvelope] type tunnelEditResponseEnvelopeJSON struct { -Errors apijson.Field -Messages apijson.Field -Result apijson.Field -Success apijson.Field -raw string -ExtraFields map[string]apijson.Field + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *TunnelEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r tunnelEditResponseEnvelopeJSON) RawJSON() (string) { - return r.raw +func (r tunnelEditResponseEnvelopeJSON) RawJSON() string { + return r.raw } // Whether the API call was successful type TunnelEditResponseEnvelopeSuccess bool const ( - TunnelEditResponseEnvelopeSuccessTrue TunnelEditResponseEnvelopeSuccess = true + TunnelEditResponseEnvelopeSuccessTrue TunnelEditResponseEnvelopeSuccess = true ) -func (r TunnelEditResponseEnvelopeSuccess) IsKnown() (bool) { - switch r { - case TunnelEditResponseEnvelopeSuccessTrue: - return true - } - return false +func (r TunnelEditResponseEnvelopeSuccess) IsKnown() bool { + switch r { + case TunnelEditResponseEnvelopeSuccessTrue: + return true + } + return false } type TunnelGetParams struct { -// Cloudflare account ID -AccountID param.Field[string] `path:"account_id,required"` + // Cloudflare account ID + AccountID param.Field[string] `path:"account_id,required"` } type TunnelGetResponseEnvelope struct { -Errors []shared.ResponseInfo `json:"errors,required"` -Messages []shared.ResponseInfo `json:"messages,required"` -Result TunnelGetResponse `json:"result,required"` -// Whether the API call was successful -Success TunnelGetResponseEnvelopeSuccess `json:"success,required"` -JSON tunnelGetResponseEnvelopeJSON `json:"-"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result TunnelGetResponse `json:"result,required"` + // Whether the API call was successful + Success TunnelGetResponseEnvelopeSuccess `json:"success,required"` + JSON tunnelGetResponseEnvelopeJSON `json:"-"` } // tunnelGetResponseEnvelopeJSON contains the JSON metadata for the struct // [TunnelGetResponseEnvelope] type tunnelGetResponseEnvelopeJSON struct { -Errors apijson.Field -Messages apijson.Field -Result apijson.Field -Success apijson.Field -raw string -ExtraFields map[string]apijson.Field + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *TunnelGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + return apijson.UnmarshalRoot(data, r) } -func (r tunnelGetResponseEnvelopeJSON) RawJSON() (string) { - return r.raw +func (r tunnelGetResponseEnvelopeJSON) RawJSON() string { + return r.raw } // Whether the API call was successful type TunnelGetResponseEnvelopeSuccess bool const ( - TunnelGetResponseEnvelopeSuccessTrue TunnelGetResponseEnvelopeSuccess = true + TunnelGetResponseEnvelopeSuccessTrue TunnelGetResponseEnvelopeSuccess = true ) -func (r TunnelGetResponseEnvelopeSuccess) IsKnown() (bool) { - switch r { - case TunnelGetResponseEnvelopeSuccessTrue: - return true - } - return false +func (r TunnelGetResponseEnvelopeSuccess) IsKnown() bool { + switch r { + case TunnelGetResponseEnvelopeSuccessTrue: + return true + } + return false }