Skip to content

Commit

Permalink
add policy to tcp and tls edges
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdiramen committed Feb 5, 2024
1 parent 41f50da commit ab47e91
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/ingress/v1alpha1/tcpedge_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ type TCPEdgeSpec struct {

// IPRestriction is an IPRestriction to apply to this edge
IPRestriction *EndpointIPPolicy `json:"ipRestriction,omitempty"`

Policy *EndpointPolicy `json:"policy,omitempty"`
}

// TCPEdgeStatus defines the observed state of TCPEdge
Expand Down
2 changes: 2 additions & 0 deletions api/ingress/v1alpha1/tlsedge_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ type TLSEdgeSpec struct {
TLSTermination *EndpointTLSTermination `json:"tlsTermination,omitempty"`

MutualTLS *EndpointMutualTLS `json:"mutualTls,omitempty"`

Policy *EndpointPolicy `json:"policy,omitempty"`
}

// TLSEdgeStatus defines the observed state of TLSEdge
Expand Down
8 changes: 8 additions & 0 deletions internal/ngrokapi/edge_modules_tcp_clientset.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,26 @@ import (
"github.com/ngrok/ngrok-api-go/v5"
"github.com/ngrok/ngrok-api-go/v5/edge_modules/tcp_edge_backend"
"github.com/ngrok/ngrok-api-go/v5/edge_modules/tcp_edge_ip_restriction"
"github.com/ngrok/ngrok-api-go/v5/edge_modules/tcp_edge_policy"
)

type TCPEdgeModulesClientset interface {
Backend() *tcp_edge_backend.Client
IPRestriction() *tcp_edge_ip_restriction.Client
Policy() *tcp_edge_policy.Client
}

type defaultTCPEdgeModulesClientset struct {
backend *tcp_edge_backend.Client
ipRestriction *tcp_edge_ip_restriction.Client
policy *tcp_edge_policy.Client
}

func newTCPEdgeModulesClientset(config *ngrok.ClientConfig) *defaultTCPEdgeModulesClientset {
return &defaultTCPEdgeModulesClientset{
backend: tcp_edge_backend.NewClient(config),
ipRestriction: tcp_edge_ip_restriction.NewClient(config),
policy: tcp_edge_policy.NewClient(config),
}
}

Expand All @@ -30,3 +34,7 @@ func (c *defaultTCPEdgeModulesClientset) Backend() *tcp_edge_backend.Client {
func (c *defaultTCPEdgeModulesClientset) IPRestriction() *tcp_edge_ip_restriction.Client {
return c.ipRestriction
}

func (c *defaultTCPEdgeModulesClientset) Policy() *tcp_edge_policy.Client {
return c.policy
}
8 changes: 8 additions & 0 deletions internal/ngrokapi/edge_modules_tls_clientset.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/ngrok/ngrok-api-go/v5/edge_modules/tls_edge_backend"
"github.com/ngrok/ngrok-api-go/v5/edge_modules/tls_edge_ip_restriction"
"github.com/ngrok/ngrok-api-go/v5/edge_modules/tls_edge_mutual_tls"
"github.com/ngrok/ngrok-api-go/v5/edge_modules/tls_edge_policy"
"github.com/ngrok/ngrok-api-go/v5/edge_modules/tls_edge_tls_termination"
)

Expand All @@ -13,13 +14,15 @@ type TLSEdgeModulesClientset interface {
IPRestriction() *tls_edge_ip_restriction.Client
MutualTLS() *tls_edge_mutual_tls.Client
TLSTermination() *tls_edge_tls_termination.Client
Policy() *tls_edge_policy.Client
}

type defaultTLSEdgeModulesClientset struct {
backend *tls_edge_backend.Client
ipRestriction *tls_edge_ip_restriction.Client
mutualTLS *tls_edge_mutual_tls.Client
tlsTermination *tls_edge_tls_termination.Client
policy *tls_edge_policy.Client
}

func newTLSEdgeModulesClientset(config *ngrok.ClientConfig) *defaultTLSEdgeModulesClientset {
Expand All @@ -28,6 +31,7 @@ func newTLSEdgeModulesClientset(config *ngrok.ClientConfig) *defaultTLSEdgeModul
ipRestriction: tls_edge_ip_restriction.NewClient(config),
mutualTLS: tls_edge_mutual_tls.NewClient(config),
tlsTermination: tls_edge_tls_termination.NewClient(config),
policy: tls_edge_policy.NewClient(config),
}
}

Expand All @@ -46,3 +50,7 @@ func (c *defaultTLSEdgeModulesClientset) MutualTLS() *tls_edge_mutual_tls.Client
func (c *defaultTLSEdgeModulesClientset) TLSTermination() *tls_edge_tls_termination.Client {
return c.tlsTermination
}

func (c *defaultTLSEdgeModulesClientset) Policy() *tls_edge_policy.Client {
return c.policy
}

0 comments on commit ab47e91

Please sign in to comment.