Skip to content

Commit

Permalink
feat: OpenAPI spec update via Stainless API
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Feb 21, 2024
1 parent f39027b commit 459e4ea
Show file tree
Hide file tree
Showing 4 changed files with 207 additions and 353 deletions.
36 changes: 9 additions & 27 deletions magicgretunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,19 +172,15 @@ type MagicGreTunnelNewResponseGreTunnelsHealthCheck struct {
// The direction of the flow of the healthcheck. Either unidirectional, where the
// probe comes to you via the tunnel and the result comes back to Cloudflare via
// the open Internet, or bidirectional where both the probe and result come and go
// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field
// in health_check is ignored as the interface_address is used to send traffic into
// the tunnel.
// via the tunnel.
Direction MagicGreTunnelNewResponseGreTunnelsHealthCheckDirection `json:"direction"`
// Determines whether to run healthchecks for a tunnel.
Enabled bool `json:"enabled"`
// How frequent the health check is run. The default value is `mid`.
Rate MagicGreTunnelNewResponseGreTunnelsHealthCheckRate `json:"rate"`
// The destination address in a request type health check. After the healthcheck is
// decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded
// to this address. This field defaults to `customer_gre_endpoint address`. This
// field is ignored for bidirectional healthchecks as the interface_address (not
// assigned to the Cloudflare side of the tunnel) is used as the target.
// to this address. This field defaults to `customer_gre_endpoint address`.
Target string `json:"target"`
// The type of healthcheck to run, reply or request. The default value is `reply`.
Type MagicGreTunnelNewResponseGreTunnelsHealthCheckType `json:"type"`
Expand All @@ -210,9 +206,7 @@ func (r *MagicGreTunnelNewResponseGreTunnelsHealthCheck) UnmarshalJSON(data []by
// The direction of the flow of the healthcheck. Either unidirectional, where the
// probe comes to you via the tunnel and the result comes back to Cloudflare via
// the open Internet, or bidirectional where both the probe and result come and go
// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field
// in health_check is ignored as the interface_address is used to send traffic into
// the tunnel.
// via the tunnel.
type MagicGreTunnelNewResponseGreTunnelsHealthCheckDirection string

const (
Expand Down Expand Up @@ -328,19 +322,15 @@ type MagicGreTunnelListResponseGreTunnelsHealthCheck struct {
// The direction of the flow of the healthcheck. Either unidirectional, where the
// probe comes to you via the tunnel and the result comes back to Cloudflare via
// the open Internet, or bidirectional where both the probe and result come and go
// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field
// in health_check is ignored as the interface_address is used to send traffic into
// the tunnel.
// via the tunnel.
Direction MagicGreTunnelListResponseGreTunnelsHealthCheckDirection `json:"direction"`
// Determines whether to run healthchecks for a tunnel.
Enabled bool `json:"enabled"`
// How frequent the health check is run. The default value is `mid`.
Rate MagicGreTunnelListResponseGreTunnelsHealthCheckRate `json:"rate"`
// The destination address in a request type health check. After the healthcheck is
// decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded
// to this address. This field defaults to `customer_gre_endpoint address`. This
// field is ignored for bidirectional healthchecks as the interface_address (not
// assigned to the Cloudflare side of the tunnel) is used as the target.
// to this address. This field defaults to `customer_gre_endpoint address`.
Target string `json:"target"`
// The type of healthcheck to run, reply or request. The default value is `reply`.
Type MagicGreTunnelListResponseGreTunnelsHealthCheckType `json:"type"`
Expand All @@ -366,9 +356,7 @@ func (r *MagicGreTunnelListResponseGreTunnelsHealthCheck) UnmarshalJSON(data []b
// The direction of the flow of the healthcheck. Either unidirectional, where the
// probe comes to you via the tunnel and the result comes back to Cloudflare via
// the open Internet, or bidirectional where both the probe and result come and go
// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field
// in health_check is ignored as the interface_address is used to send traffic into
// the tunnel.
// via the tunnel.
type MagicGreTunnelListResponseGreTunnelsHealthCheckDirection string

const (
Expand Down Expand Up @@ -536,19 +524,15 @@ type MagicGreTunnelUpdateParamsHealthCheck struct {
// The direction of the flow of the healthcheck. Either unidirectional, where the
// probe comes to you via the tunnel and the result comes back to Cloudflare via
// the open Internet, or bidirectional where both the probe and result come and go
// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field
// in health_check is ignored as the interface_address is used to send traffic into
// the tunnel.
// via the tunnel.
Direction param.Field[MagicGreTunnelUpdateParamsHealthCheckDirection] `json:"direction"`
// Determines whether to run healthchecks for a tunnel.
Enabled param.Field[bool] `json:"enabled"`
// How frequent the health check is run. The default value is `mid`.
Rate param.Field[MagicGreTunnelUpdateParamsHealthCheckRate] `json:"rate"`
// The destination address in a request type health check. After the healthcheck is
// decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded
// to this address. This field defaults to `customer_gre_endpoint address`. This
// field is ignored for bidirectional healthchecks as the interface_address (not
// assigned to the Cloudflare side of the tunnel) is used as the target.
// to this address. This field defaults to `customer_gre_endpoint address`.
Target param.Field[string] `json:"target"`
// The type of healthcheck to run, reply or request. The default value is `reply`.
Type param.Field[MagicGreTunnelUpdateParamsHealthCheckType] `json:"type"`
Expand All @@ -561,9 +545,7 @@ func (r MagicGreTunnelUpdateParamsHealthCheck) MarshalJSON() (data []byte, err e
// The direction of the flow of the healthcheck. Either unidirectional, where the
// probe comes to you via the tunnel and the result comes back to Cloudflare via
// the open Internet, or bidirectional where both the probe and result come and go
// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field
// in health_check is ignored as the interface_address is used to send traffic into
// the tunnel.
// via the tunnel.
type MagicGreTunnelUpdateParamsHealthCheckDirection string

const (
Expand Down
118 changes: 2 additions & 116 deletions magicipsectunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,7 @@ type MagicIpsecTunnelNewParams struct {
// The IP address assigned to the customer side of the IPsec tunnel.
CustomerEndpoint param.Field[string] `json:"customer_endpoint"`
// An optional description forthe IPsec tunnel.
Description param.Field[string] `json:"description"`
HealthCheck param.Field[MagicIpsecTunnelNewParamsHealthCheck] `json:"health_check"`
Description param.Field[string] `json:"description"`
// A randomly generated or provided string for use in the IPsec tunnel.
Psk param.Field[string] `json:"psk"`
// If `true`, then IPsec replay protection will be supported in the
Expand All @@ -459,62 +458,6 @@ func (r MagicIpsecTunnelNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

type MagicIpsecTunnelNewParamsHealthCheck struct {
// The direction of the flow of the healthcheck. Either unidirectional, where the
// probe comes to you via the tunnel and the result comes back to Cloudflare via
// the open Internet, or bidirectional where both the probe and result come and go
// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field
// in health_check is ignored as the interface_address is used to send traffic into
// the tunnel.
Direction param.Field[MagicIpsecTunnelNewParamsHealthCheckDirection] `json:"direction"`
// Determines whether to run healthchecks for a tunnel.
Enabled param.Field[bool] `json:"enabled"`
// How frequent the health check is run. The default value is `mid`.
Rate param.Field[MagicIpsecTunnelNewParamsHealthCheckRate] `json:"rate"`
// The destination address in a request type health check. After the healthcheck is
// decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded
// to this address. This field defaults to `customer_gre_endpoint address`. This
// field is ignored for bidirectional healthchecks as the interface_address (not
// assigned to the Cloudflare side of the tunnel) is used as the target.
Target param.Field[string] `json:"target"`
// The type of healthcheck to run, reply or request. The default value is `reply`.
Type param.Field[MagicIpsecTunnelNewParamsHealthCheckType] `json:"type"`
}

func (r MagicIpsecTunnelNewParamsHealthCheck) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

// The direction of the flow of the healthcheck. Either unidirectional, where the
// probe comes to you via the tunnel and the result comes back to Cloudflare via
// the open Internet, or bidirectional where both the probe and result come and go
// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field
// in health_check is ignored as the interface_address is used to send traffic into
// the tunnel.
type MagicIpsecTunnelNewParamsHealthCheckDirection string

const (
MagicIpsecTunnelNewParamsHealthCheckDirectionUnidirectional MagicIpsecTunnelNewParamsHealthCheckDirection = "unidirectional"
MagicIpsecTunnelNewParamsHealthCheckDirectionBidirectional MagicIpsecTunnelNewParamsHealthCheckDirection = "bidirectional"
)

// How frequent the health check is run. The default value is `mid`.
type MagicIpsecTunnelNewParamsHealthCheckRate string

const (
MagicIpsecTunnelNewParamsHealthCheckRateLow MagicIpsecTunnelNewParamsHealthCheckRate = "low"
MagicIpsecTunnelNewParamsHealthCheckRateMid MagicIpsecTunnelNewParamsHealthCheckRate = "mid"
MagicIpsecTunnelNewParamsHealthCheckRateHigh MagicIpsecTunnelNewParamsHealthCheckRate = "high"
)

// The type of healthcheck to run, reply or request. The default value is `reply`.
type MagicIpsecTunnelNewParamsHealthCheckType string

const (
MagicIpsecTunnelNewParamsHealthCheckTypeReply MagicIpsecTunnelNewParamsHealthCheckType = "reply"
MagicIpsecTunnelNewParamsHealthCheckTypeRequest MagicIpsecTunnelNewParamsHealthCheckType = "request"
)

type MagicIpsecTunnelNewResponseEnvelope struct {
Errors []MagicIpsecTunnelNewResponseEnvelopeErrors `json:"errors,required"`
Messages []MagicIpsecTunnelNewResponseEnvelopeMessages `json:"messages,required"`
Expand Down Expand Up @@ -596,8 +539,7 @@ type MagicIpsecTunnelUpdateParams struct {
// The IP address assigned to the customer side of the IPsec tunnel.
CustomerEndpoint param.Field[string] `json:"customer_endpoint"`
// An optional description forthe IPsec tunnel.
Description param.Field[string] `json:"description"`
HealthCheck param.Field[MagicIpsecTunnelUpdateParamsHealthCheck] `json:"health_check"`
Description param.Field[string] `json:"description"`
// A randomly generated or provided string for use in the IPsec tunnel.
Psk param.Field[string] `json:"psk"`
// If `true`, then IPsec replay protection will be supported in the
Expand All @@ -609,62 +551,6 @@ func (r MagicIpsecTunnelUpdateParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

type MagicIpsecTunnelUpdateParamsHealthCheck struct {
// The direction of the flow of the healthcheck. Either unidirectional, where the
// probe comes to you via the tunnel and the result comes back to Cloudflare via
// the open Internet, or bidirectional where both the probe and result come and go
// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field
// in health_check is ignored as the interface_address is used to send traffic into
// the tunnel.
Direction param.Field[MagicIpsecTunnelUpdateParamsHealthCheckDirection] `json:"direction"`
// Determines whether to run healthchecks for a tunnel.
Enabled param.Field[bool] `json:"enabled"`
// How frequent the health check is run. The default value is `mid`.
Rate param.Field[MagicIpsecTunnelUpdateParamsHealthCheckRate] `json:"rate"`
// The destination address in a request type health check. After the healthcheck is
// decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded
// to this address. This field defaults to `customer_gre_endpoint address`. This
// field is ignored for bidirectional healthchecks as the interface_address (not
// assigned to the Cloudflare side of the tunnel) is used as the target.
Target param.Field[string] `json:"target"`
// The type of healthcheck to run, reply or request. The default value is `reply`.
Type param.Field[MagicIpsecTunnelUpdateParamsHealthCheckType] `json:"type"`
}

func (r MagicIpsecTunnelUpdateParamsHealthCheck) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

// The direction of the flow of the healthcheck. Either unidirectional, where the
// probe comes to you via the tunnel and the result comes back to Cloudflare via
// the open Internet, or bidirectional where both the probe and result come and go
// via the tunnel. Note in the case of bidirecitonal healthchecks, the target field
// in health_check is ignored as the interface_address is used to send traffic into
// the tunnel.
type MagicIpsecTunnelUpdateParamsHealthCheckDirection string

const (
MagicIpsecTunnelUpdateParamsHealthCheckDirectionUnidirectional MagicIpsecTunnelUpdateParamsHealthCheckDirection = "unidirectional"
MagicIpsecTunnelUpdateParamsHealthCheckDirectionBidirectional MagicIpsecTunnelUpdateParamsHealthCheckDirection = "bidirectional"
)

// How frequent the health check is run. The default value is `mid`.
type MagicIpsecTunnelUpdateParamsHealthCheckRate string

const (
MagicIpsecTunnelUpdateParamsHealthCheckRateLow MagicIpsecTunnelUpdateParamsHealthCheckRate = "low"
MagicIpsecTunnelUpdateParamsHealthCheckRateMid MagicIpsecTunnelUpdateParamsHealthCheckRate = "mid"
MagicIpsecTunnelUpdateParamsHealthCheckRateHigh MagicIpsecTunnelUpdateParamsHealthCheckRate = "high"
)

// The type of healthcheck to run, reply or request. The default value is `reply`.
type MagicIpsecTunnelUpdateParamsHealthCheckType string

const (
MagicIpsecTunnelUpdateParamsHealthCheckTypeReply MagicIpsecTunnelUpdateParamsHealthCheckType = "reply"
MagicIpsecTunnelUpdateParamsHealthCheckTypeRequest MagicIpsecTunnelUpdateParamsHealthCheckType = "request"
)

type MagicIpsecTunnelUpdateResponseEnvelope struct {
Errors []MagicIpsecTunnelUpdateResponseEnvelopeErrors `json:"errors,required"`
Messages []MagicIpsecTunnelUpdateResponseEnvelopeMessages `json:"messages,required"`
Expand Down
22 changes: 4 additions & 18 deletions magicipsectunnel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,8 @@ func TestMagicIpsecTunnelNewWithOptionalParams(t *testing.T) {
Name: cloudflare.F("IPsec_1"),
CustomerEndpoint: cloudflare.F("203.0.113.1"),
Description: cloudflare.F("Tunnel for ISP X"),
HealthCheck: cloudflare.F(cloudflare.MagicIpsecTunnelNewParamsHealthCheck{
Direction: cloudflare.F(cloudflare.MagicIpsecTunnelNewParamsHealthCheckDirectionBidirectional),
Enabled: cloudflare.F(true),
Rate: cloudflare.F(cloudflare.MagicIpsecTunnelNewParamsHealthCheckRateLow),
Target: cloudflare.F("203.0.113.1"),
Type: cloudflare.F(cloudflare.MagicIpsecTunnelNewParamsHealthCheckTypeRequest),
}),
Psk: cloudflare.F("O3bwKSjnaoCxDoUxjcq4Rk8ZKkezQUiy"),
ReplayProtection: cloudflare.F(false),
Psk: cloudflare.F("O3bwKSjnaoCxDoUxjcq4Rk8ZKkezQUiy"),
ReplayProtection: cloudflare.F(false),
},
)
if err != nil {
Expand Down Expand Up @@ -84,15 +77,8 @@ func TestMagicIpsecTunnelUpdateWithOptionalParams(t *testing.T) {
Name: cloudflare.F("IPsec_1"),
CustomerEndpoint: cloudflare.F("203.0.113.1"),
Description: cloudflare.F("Tunnel for ISP X"),
HealthCheck: cloudflare.F(cloudflare.MagicIpsecTunnelUpdateParamsHealthCheck{
Direction: cloudflare.F(cloudflare.MagicIpsecTunnelUpdateParamsHealthCheckDirectionBidirectional),
Enabled: cloudflare.F(true),
Rate: cloudflare.F(cloudflare.MagicIpsecTunnelUpdateParamsHealthCheckRateLow),
Target: cloudflare.F("203.0.113.1"),
Type: cloudflare.F(cloudflare.MagicIpsecTunnelUpdateParamsHealthCheckTypeRequest),
}),
Psk: cloudflare.F("O3bwKSjnaoCxDoUxjcq4Rk8ZKkezQUiy"),
ReplayProtection: cloudflare.F(false),
Psk: cloudflare.F("O3bwKSjnaoCxDoUxjcq4Rk8ZKkezQUiy"),
ReplayProtection: cloudflare.F(false),
},
)
if err != nil {
Expand Down
Loading

0 comments on commit 459e4ea

Please sign in to comment.