-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7fb303f
commit d00bc71
Showing
138 changed files
with
19,634 additions
and
15,265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
internal/resources/core/v1/pod/container/lifecycle/handler/expand.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
35 changes: 35 additions & 0 deletions
35
internal/resources/core/v1/pod/container/lifecycle/handler/fields.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), | ||
}, | ||
}, | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
internal/resources/core/v1/pod/container/lifecycle/handler/flatten.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
89 changes: 89 additions & 0 deletions
89
vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/context.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/doc.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/environment_variables.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/keys.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/protocol.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.