Skip to content

Commit

Permalink
Dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
nickschuch committed Mar 7, 2023
1 parent 7fb303f commit d00bc71
Show file tree
Hide file tree
Showing 138 changed files with 19,634 additions and 15,265 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ require (
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.14.3 // indirect
github.com/hashicorp/terraform-plugin-log v0.8.0 // indirect
github.com/hashicorp/terraform-registry-address v0.1.0 // indirect
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/imdario/mergo v0.3.9 // indirect
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ github.com/hashicorp/terraform-plugin-log v0.8.0 h1:pX2VQ/TGKu+UU1rCay0OlzosNKe4
github.com/hashicorp/terraform-plugin-log v0.8.0/go.mod h1:1myFrhVsBLeylQzYYEV17VVjtG8oYPRFdaZs7xdW2xs=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.25.0 h1:iNRjaJCatQS1rIbHs/vDvJ0GECsaGgxx780chA2Irpk=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.25.0/go.mod h1:XnVNLIS6bdMJbjSDujhX4Rlk24QpbGKbnrVFM4tZ7OU=
github.com/hashicorp/terraform-registry-address v0.1.0 h1:W6JkV9wbum+m516rCl5/NjKxCyTVaaUBbzYcMzBDO3U=
github.com/hashicorp/terraform-registry-address v0.1.0/go.mod h1:EnyO2jYO6j29DTHbJcm00E5nQTFeTtyZH3H5ycydQ5A=
github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg=
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0=
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg=
Expand Down Expand Up @@ -667,6 +669,7 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package handler

import (
corev1 "k8s.io/api/core/v1"

"github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/exec"
"github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/http"
"github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/tcp"
)

// Expand will return a structured object.
func Expand(in []interface{}) *corev1.ProbeHandler {
if len(in) == 0 {
return nil
}

handler := &corev1.ProbeHandler{}

raw := in[0].(map[string]interface{})

if httpval, ok := raw[FieldHTTP]; ok {
handler.HTTPGet = http.Expand(httpval.([]interface{}))
}

if tcpval, ok := raw[FieldTCP]; ok {
handler.TCPSocket = tcp.Expand(tcpval.([]interface{}))
}

if execval, ok := raw[FieldExec]; ok {
handler.Exec = exec.Expand(execval.([]interface{}))
}

return handler
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package handler

import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

"github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/exec"
"github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/http"
"github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/tcp"
)

const (
// FieldHTTP which is used to identify the HTTP field.
FieldHTTP = "http"
// FieldTCP which is used to identify the TCP field.
FieldTCP = "tcp"
// FieldExec which is used to identify the Exec field.
FieldExec = "exec"
)

// Fields returns the fields for this package.
func Fields() *schema.Schema {
return &schema.Schema{
Description: "Event to occur during a containers lifecycle.",
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
FieldHTTP: http.Fields(),
FieldTCP: tcp.Fields(),
FieldExec: exec.Fields(),
},
},
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package handler

import (
corev1 "k8s.io/api/core/v1"

"github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/exec"
"github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/http"
"github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/tcp"
)

// Flatten structured object into unstructured.
func Flatten(in *corev1.ProbeHandler) []interface{} {
out := make([]interface{}, 1)

row := map[string]interface{}{}

if in.HTTPGet != nil {
row[FieldHTTP] = http.Flatten(in.HTTPGet)
}

if in.TCPSocket != nil {
row[FieldTCP] = tcp.Flatten(in.TCPSocket)
}

if in.Exec != nil {
row[FieldExec] = exec.Flatten(in.Exec)
}

out[0] = row

return out
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d00bc71

Please sign in to comment.