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 459e4ea commit caf4cae
Show file tree
Hide file tree
Showing 4 changed files with 353 additions and 207 deletions.
36 changes: 27 additions & 9 deletions magicgretunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,19 @@ 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.
// 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 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`.
// 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 string `json:"target"`
// The type of healthcheck to run, reply or request. The default value is `reply`.
Type MagicGreTunnelNewResponseGreTunnelsHealthCheckType `json:"type"`
Expand All @@ -206,7 +210,9 @@ 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.
// 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 MagicGreTunnelNewResponseGreTunnelsHealthCheckDirection string

const (
Expand Down Expand Up @@ -322,15 +328,19 @@ 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.
// 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 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`.
// 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 string `json:"target"`
// The type of healthcheck to run, reply or request. The default value is `reply`.
Type MagicGreTunnelListResponseGreTunnelsHealthCheckType `json:"type"`
Expand All @@ -356,7 +366,9 @@ 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.
// 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 MagicGreTunnelListResponseGreTunnelsHealthCheckDirection string

const (
Expand Down Expand Up @@ -524,15 +536,19 @@ 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.
// 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[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`.
// 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[MagicGreTunnelUpdateParamsHealthCheckType] `json:"type"`
Expand All @@ -545,7 +561,9 @@ 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.
// 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 MagicGreTunnelUpdateParamsHealthCheckDirection string

const (
Expand Down
118 changes: 116 additions & 2 deletions magicipsectunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@ 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"`
Description param.Field[string] `json:"description"`
HealthCheck param.Field[MagicIpsecTunnelNewParamsHealthCheck] `json:"health_check"`
// 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 @@ -458,6 +459,62 @@ 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 @@ -539,7 +596,8 @@ 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"`
Description param.Field[string] `json:"description"`
HealthCheck param.Field[MagicIpsecTunnelUpdateParamsHealthCheck] `json:"health_check"`
// 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 @@ -551,6 +609,62 @@ 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: 18 additions & 4 deletions magicipsectunnel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,15 @@ func TestMagicIpsecTunnelNewWithOptionalParams(t *testing.T) {
Name: cloudflare.F("IPsec_1"),
CustomerEndpoint: cloudflare.F("203.0.113.1"),
Description: cloudflare.F("Tunnel for ISP X"),
Psk: cloudflare.F("O3bwKSjnaoCxDoUxjcq4Rk8ZKkezQUiy"),
ReplayProtection: cloudflare.F(false),
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),
},
)
if err != nil {
Expand Down Expand Up @@ -77,8 +84,15 @@ func TestMagicIpsecTunnelUpdateWithOptionalParams(t *testing.T) {
Name: cloudflare.F("IPsec_1"),
CustomerEndpoint: cloudflare.F("203.0.113.1"),
Description: cloudflare.F("Tunnel for ISP X"),
Psk: cloudflare.F("O3bwKSjnaoCxDoUxjcq4Rk8ZKkezQUiy"),
ReplayProtection: cloudflare.F(false),
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),
},
)
if err != nil {
Expand Down
Loading

0 comments on commit caf4cae

Please sign in to comment.