recipe

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2023 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package recipe contains schema and helper functions for different input recipes. nolint: dupl

Package recipe contains schema and helper functions for different input recipes. Contains recipe schema for tmc-https-ingress, tmc-block-nodeport-service and tmc-block-resources recipe.

Package recipe contains schema and helper functions for different input recipes. nolint: dupl

Package recipe contains schema and helper functions for different input recipes. nolint: dupl

Index

Constants

View Source
const (
	TMCExternalIPSKey              = "tmc_external_ips"
	TMCRequireLabelsKey            = "tmc_require_labels"
	TMCBlockRolebindingSubjectsKey = "tmc_block_rolebinding_subjects"
	TMCBlockNodeportServiceKey     = "tmc_block_nodeport_service"
	TMCBlockResourcesKey           = "tmc_block_resources"
	TMCHTTPSIngressKey             = "tmc_https_ingress"
	AuditKey                       = "audit"
	TargetKubernetesResourcesKey   = "target_kubernetes_resources"
	ParametersKey                  = "parameters"
	APIGroupsKey                   = "api_groups"
	KindsKey                       = "kinds"
)

Variables

View Source
var TMCBlockNodeportService = &schema.Schema{
	Type:        schema.TypeList,
	Description: "The input schema for custom policy tmc_block_nodeport_service recipe version v1",
	Optional:    true,
	ForceNew:    true,
	MaxItems:    1,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			AuditKey: {
				Type:        schema.TypeBool,
				Description: "Audit (dry-run).",
				Optional:    true,
				Default:     false,
			},
			TargetKubernetesResourcesKey: targetKubernetesResources,
		},
	},
}
View Source
var TMCBlockResources = &schema.Schema{
	Type:        schema.TypeList,
	Description: "The input schema for custom policy tmc_block_resources recipe version v1",
	Optional:    true,
	ForceNew:    true,
	MaxItems:    1,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			AuditKey: {
				Type:        schema.TypeBool,
				Description: "Audit (dry-run).",
				Optional:    true,
				Default:     false,
			},
			TargetKubernetesResourcesKey: targetKubernetesResources,
		},
	},
}
View Source
var TMCBlockRolebindingSubjects = &schema.Schema{
	Type:        schema.TypeList,
	Description: "The input schema for custom policy tmc_block_rolebinding_subjects recipe version v1",
	Optional:    true,
	ForceNew:    true,
	MaxItems:    1,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			AuditKey: {
				Type:        schema.TypeBool,
				Description: "Audit (dry-run).",
				Optional:    true,
				Default:     false,
			},
			ParametersKey: {
				Type:        schema.TypeList,
				Description: "Parameters.",
				Required:    true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						disallowedSubjectsKey: {
							Type:        schema.TypeList,
							Description: "Disallowed Subjects.",
							Required:    true,
							MinItems:    1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									kindKey: {
										Type:         schema.TypeString,
										Description:  "The kind of subject to disallow, can be User/Group/ServiceAccount.",
										Required:     true,
										ValidateFunc: validation.StringInSlice([]string{"User", "Group", "ServiceAccount"}, false),
									},
									nameKey: {
										Type:        schema.TypeString,
										Description: "The name of the subject to disallow.",
										Required:    true,
									},
								},
							},
						},
					},
				},
			},
			TargetKubernetesResourcesKey: targetKubernetesResources,
		},
	},
}
View Source
var TMCExternalIps = &schema.Schema{
	Type:        schema.TypeList,
	Description: "The input schema for custom policy tmc_external_ips recipe version v1",
	Optional:    true,
	ForceNew:    true,
	MaxItems:    1,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			AuditKey: {
				Type:        schema.TypeBool,
				Description: "Audit (dry-run).",
				Optional:    true,
				Default:     false,
			},
			ParametersKey: {
				Type:        schema.TypeList,
				Description: "Parameters.",
				Required:    true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						allowedIPsKey: {
							Type:        schema.TypeList,
							Description: "Allowed IPs.",
							Required:    true,
							Elem:        &schema.Schema{Type: schema.TypeString},
						},
					},
				},
			},
			TargetKubernetesResourcesKey: targetKubernetesResources,
		},
	},
}
View Source
var TMCHTTPSIngress = &schema.Schema{
	Type:        schema.TypeList,
	Description: "The input schema for custom policy tmc_https_ingress recipe version v1",
	Optional:    true,
	ForceNew:    true,
	MaxItems:    1,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			AuditKey: {
				Type:        schema.TypeBool,
				Description: "Audit (dry-run).",
				Optional:    true,
				Default:     false,
			},
			TargetKubernetesResourcesKey: targetKubernetesResources,
		},
	},
}
View Source
var TMCRequireLabels = &schema.Schema{
	Type:        schema.TypeList,
	Description: "The input schema for custom policy tmc_require_labels recipe version v1",
	Optional:    true,
	ForceNew:    true,
	MaxItems:    1,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			AuditKey: {
				Type:        schema.TypeBool,
				Description: "Audit (dry-run).",
				Optional:    true,
				Default:     false,
			},
			ParametersKey: {
				Type:        schema.TypeList,
				Description: "Parameters.",
				Required:    true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						parametersLabelKey: {
							Type:        schema.TypeList,
							Description: "Labels.",
							Required:    true,
							MinItems:    1,
							Elem: &schema.Resource{
								Schema: map[string]*schema.Schema{
									labelKey: {
										Type:        schema.TypeString,
										Description: "The label key to enforce.",
										Required:    true,
									},
									labelValueKey: {
										Type:        schema.TypeString,
										Description: "Optional label value to enforce (if left empty, only key will be enforced).",
										Optional:    true,
									},
								},
							},
						},
					},
				},
			},
			TargetKubernetesResourcesKey: targetKubernetesResources,
		},
	},
}

Functions

func ConstructTMCBlockRolebindingSubjects

func ConstructTMCBlockRolebindingSubjects(data []interface{}) (roleBindingSubjects *policyrecipecustommodel.VmwareTanzuManageV1alpha1CommonPolicySpecCustomV1TMCBlockRoleBindingSubjects)

func ConstructTMCExternalIPS

func ConstructTMCExternalIPS(data []interface{}) (externalIPs *policyrecipecustommodel.VmwareTanzuManageV1alpha1CommonPolicySpecCustomV1TMCExternalIPS)

func ConstructTMCRequireLabels

func ConstructTMCRequireLabels(data []interface{}) (requireLabels *policyrecipecustommodel.VmwareTanzuManageV1alpha1CommonPolicySpecCustomV1TMCRequireLabels)

func FlattenTMCBlockRolebindingSubjects

func FlattenTMCBlockRolebindingSubjects(roleBindingSubjects *policyrecipecustommodel.VmwareTanzuManageV1alpha1CommonPolicySpecCustomV1TMCBlockRoleBindingSubjects) (data []interface{})

func FlattenTMCRequireLabels

func FlattenTMCRequireLabels(requireLabels *policyrecipecustommodel.VmwareTanzuManageV1alpha1CommonPolicySpecCustomV1TMCRequireLabels) (data []interface{})

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL