scope

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package scope contains schema and helper functions for different policy scopes. nolint: dupl

Package scope contains schema and helper functions for different policy scopes. nolint: dupl

Package scope contains schema and helper functions for different policy scopes. nolint: dupl

Index

Constants

View Source
const (
	ManagementClusterNameKey = "management_cluster_name"
	ProvisionerNameKey       = "provisioner_name"
	ClusterNameKey           = "name"
	AttachedValue            = "attached"
	ClusterGroupNameKey      = "cluster_group"
	WorkspaceNameKey         = "workspace"
	OrganizationIDKey        = "organization"
	ScopeKey                 = "scope"
	ClusterKey               = "cluster"
	ClusterGroupKey          = "cluster_group"
	WorkspaceKey             = "workspace"
	OrganizationKey          = "organization"
)

Variables

View Source
var ClusterGroupPolicyFullname = &schema.Schema{
	Type:        schema.TypeList,
	Description: "The schema for cluster group policy full name",
	Optional:    true,
	ForceNew:    true,
	MaxItems:    1,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			ClusterGroupNameKey: {
				Type:        schema.TypeString,
				Description: "Name of this cluster group",
				Required:    true,
				ForceNew:    true,
			},
		},
	},
}
View Source
var ClusterPolicyFullname = &schema.Schema{
	Type:        schema.TypeList,
	Description: "The schema for cluster policy full name",
	Optional:    true,
	ForceNew:    true,
	MaxItems:    1,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			ManagementClusterNameKey: {
				Type:        schema.TypeString,
				Description: "Name of the management cluster",
				Default:     AttachedValue,
				Optional:    true,
				ForceNew:    true,
			},
			ProvisionerNameKey: {
				Type:        schema.TypeString,
				Description: "Provisioner of the cluster",
				Default:     AttachedValue,
				Optional:    true,
				ForceNew:    true,
			},
			ClusterNameKey: {
				Type:        schema.TypeString,
				Description: "Name of this cluster",
				Required:    true,
				ForceNew:    true,
			},
		},
	},
}
View Source
var OrganizationPolicyFullname = &schema.Schema{
	Type:        schema.TypeList,
	Description: "The schema for organization policy full name",
	Optional:    true,
	ForceNew:    true,
	MaxItems:    1,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			OrganizationIDKey: {
				Type:        schema.TypeString,
				Description: "ID of this organization",
				Required:    true,
				ForceNew:    true,
			},
		},
	},
}
View Source
var (
	ScopeSchema = &schema.Schema{
		Type:        schema.TypeList,
		Description: "Scope for the custom, security, image, network and namespace quota policy, having one of the valid scopes for custom, security and namespace quota policy: cluster, cluster_group or organization and valid scopes for image and network policy: workspace or organization.",
		Required:    true,
		ForceNew:    true,
		MaxItems:    1,
		MinItems:    1,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				ClusterKey:      ClusterPolicyFullname,
				ClusterGroupKey: ClusterGroupPolicyFullname,
				WorkspaceKey:    WorkspacePolicyFullname,
				OrganizationKey: OrganizationPolicyFullname,
			},
		},
	}
)
View Source
var WorkspacePolicyFullname = &schema.Schema{
	Type:        schema.TypeList,
	Description: "The schema for workspace policy full name",
	Optional:    true,
	ForceNew:    true,
	MaxItems:    1,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			WorkspaceNameKey: {
				Type:        schema.TypeString,
				Description: "Name of this workspace",
				Required:    true,
				ForceNew:    true,
			},
		},
	},
}

Functions

func ConstructClusterGroupPolicyFullname

func ConstructClusterGroupPolicyFullname(data []interface{}, name string) (fullname *policyclustergroupmodel.VmwareTanzuManageV1alpha1ClustergroupPolicyFullName)

func ConstructClusterPolicyFullname

func ConstructClusterPolicyFullname(data []interface{}, name string) (fullname *policyclustermodel.VmwareTanzuManageV1alpha1ClusterPolicyFullName)

func ConstructOrganizationPolicyFullname

func ConstructOrganizationPolicyFullname(data []interface{}, name string) (fullname *policyorganizationmodel.VmwareTanzuManageV1alpha1OrganizationPolicyFullName)

func ConstructWorkspacePolicyFullname

func ConstructWorkspacePolicyFullname(data []interface{}, name string) (fullname *policyworkspacemodel.VmwareTanzuManageV1alpha1WorkspacePolicyFullName)

func FlattenClusterGroupPolicyFullname

func FlattenClusterGroupPolicyFullname(fullname *policyclustergroupmodel.VmwareTanzuManageV1alpha1ClustergroupPolicyFullName) (data []interface{})

func FlattenClusterPolicyFullname

func FlattenClusterPolicyFullname(fullname *policyclustermodel.VmwareTanzuManageV1alpha1ClusterPolicyFullName) (data []interface{})

func FlattenOrganizationPolicyFullname

func FlattenOrganizationPolicyFullname(fullname *policyorganizationmodel.VmwareTanzuManageV1alpha1OrganizationPolicyFullName) (data []interface{})

func FlattenScope added in v1.1.4

func FlattenScope(scopedFullname *ScopedFullname, scopesAllowed []string) (data []interface{}, name string)

func FlattenWorkspacePolicyFullname

func FlattenWorkspacePolicyFullname(fullname *policyworkspacemodel.VmwareTanzuManageV1alpha1WorkspacePolicyFullName) (data []interface{})

Types

type Scope added in v1.1.4

type Scope int64
const (
	UnknownScope Scope = iota
	ClusterScope
	ClusterGroupScope
	WorkspaceScope
	OrganizationScope
)

Allowed scopes.

type ScopedFullname added in v1.1.4

ScopedFullname is a struct for all types of policy full names.

func ConstructScope added in v1.1.4

func ConstructScope(d *schema.ResourceData, name string) (scopedFullnameData *ScopedFullname)

type ValidateScopeType added in v1.1.4

type ValidateScopeType func(ctx context.Context, diff *schema.ResourceDiff, i interface{}) error

func ValidateScope added in v1.1.4

func ValidateScope(scopesAllowed []string) ValidateScopeType

Jump to

Keyboard shortcuts

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