zpa

package
v3.33.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 72 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllowedPolicyTypes = map[string]struct{}{
	"ACCESS_POLICY":                        {},
	"GLOBAL_POLICY":                        {},
	"TIMEOUT_POLICY":                       {},
	"REAUTH_POLICY":                        {},
	"CLIENT_FORWARDING_POLICY":             {},
	"BYPASS_POLICY":                        {},
	"ISOLATION_POLICY":                     {},
	"INSPECTION_POLICY":                    {},
	"CREDENTIAL_POLICY":                    {},
	"CAPABILITIES_POLICY":                  {},
	"CLIENTLESS_SESSION_PROTECTION_POLICY": {},
	"REDIRECTION_POLICY":                   {},
}
View Source
var ProviderVersion = "3.32.0"

ProviderVersion is set at build-time in the release process

Functions

func CommonPolicySchema

func CommonPolicySchema() map[string]*schema.Schema

func ConvertV1ResponseToV2Request added in v3.3.24

func ConvertV1ResponseToV2Request(v1Response policysetcontrollerv2.PolicyRuleResource) policysetcontrollerv2.PolicyRule

// ConvertV1ResponseToV2Request converts a PolicyRuleResource (API v1 response) to a PolicyRule (API v2 request) with aggregated values.

func ConvertV1ResponseToV2Request(v1Response policysetcontrollerv2.PolicyRuleResource) policysetcontrollerv2.PolicyRule {
	v2Request := policysetcontrollerv2.PolicyRule{
		ID:                     v1Response.ID,
		Name:                   v1Response.Name,
		Description:            v1Response.Description,
		Action:                 v1Response.Action,
		PolicySetID:            v1Response.PolicySetID,
		Operator:               v1Response.Operator,
		CustomMsg:              v1Response.CustomMsg,
		ZpnIsolationProfileID:  v1Response.ZpnIsolationProfileID,
		ZpnInspectionProfileID: v1Response.ZpnInspectionProfileID,
		Conditions:             make([]policysetcontrollerv2.PolicyRuleResourceConditions, 0),
	}

	for _, condition := range v1Response.Conditions {
		newCondition := policysetcontrollerv2.PolicyRuleResourceConditions{
			Operator: condition.Operator,
			Operands: make([]policysetcontrollerv2.PolicyRuleResourceOperands, 0),
		}

		// Use a map to aggregate RHS values by ObjectType
		operandMap := make(map[string][]string)
		entryValuesMap := make(map[string][]policysetcontrollerv2.OperandsResourceLHSRHSValue)

		for _, operand := range condition.Operands {
			switch operand.ObjectType {
			case "APP", "APP_GROUP", "CONSOLE", "MACHINE_GRP", "LOCATION", "BRANCH_CONNECTOR_GROUP", "EDGE_CONNECTOR_GROUP", "CLIENT_TYPE":
				operandMap[operand.ObjectType] = append(operandMap[operand.ObjectType], operand.RHS)
			case "PLATFORM", "POSTURE", "TRUSTED_NETWORK", "SAML", "SCIM", "SCIM_GROUP", "COUNTRY_CODE":
				entryValuesMap[operand.ObjectType] = append(entryValuesMap[operand.ObjectType], policysetcontrollerv2.OperandsResourceLHSRHSValue{
					LHS: operand.LHS,
					RHS: operand.RHS,
				})
			}
		}

		// Create operand blocks from the aggregated data
		for objectType, values := range operandMap {
			newCondition.Operands = append(newCondition.Operands, policysetcontrollerv2.PolicyRuleResourceOperands{
				ObjectType: objectType,
				Values:     values,
			})
		}

		for objectType, entryValues := range entryValuesMap {
			newCondition.Operands = append(newCondition.Operands, policysetcontrollerv2.PolicyRuleResourceOperands{
				ObjectType:        objectType,
				EntryValuesLHSRHS: entryValues,
			})
		}
		v2Request.Conditions = append(v2Request.Conditions, newCondition)
	}
	return v2Request
}

ConvertV1ResponseToV2Request converts a PolicyRuleResource (API v1 response) to a PolicyRule (API v2 request) with aggregated values.

func DiffSuppressFuncCoordinate

func DiffSuppressFuncCoordinate(_, old, new string, _ *schema.ResourceData) bool

func ExpandPolicyConditionsV2 added in v3.2.0

func ExpandPolicyRuleResourceConditions

func ExpandPolicyRuleResourceConditions(d map[string]interface{}) ([]lssconfigcontroller.PolicyRuleResourceConditions, error)

func GetBool added in v3.2.0

func GetBool(v interface{}) bool

Helper to safely extract bool values from map

func GetGlobalPolicySetByPolicyType

func GetGlobalPolicySetByPolicyType(client *Client, policyType string) (*policysetcontroller.PolicySet, error)

func GetPolicyConditionsSchema

func GetPolicyConditionsSchema(objectTypes []string) *schema.Schema

func GetString

func GetString(v interface{}) string

func ListToStringSlice

func ListToStringSlice(v []interface{}) []string

func MergeSchema

func MergeSchema(schemas ...map[string]*schema.Schema) map[string]*schema.Schema

func PRAPortOverlap

func PRAPortOverlap(s1, s2 []string) (bool, []string, []string)

func SetToStringList

func SetToStringList(d *schema.ResourceData, key string) []string

func SetToStringSlice

func SetToStringSlice(d *schema.Set) []string

func ValidateConditions

func ValidateConditions(conditions []policysetcontroller.Conditions, zClient *Client, microtenantID string) error

func ValidateLatitude

func ValidateLatitude(val interface{}, _ string) (warns []string, errs []error)

func ValidateLongitude

func ValidateLongitude(val interface{}, _ string) (warns []string, errs []error)

func ValidatePolicyRuleConditions added in v3.2.0

func ValidatePolicyRuleConditions(d *schema.ResourceData) error

ValidatePolicyRuleConditions ensures that the necessary values are provided for specific object types.

func ZPAProvider

func ZPAProvider() *schema.Provider

Types

type Client

type Client struct {
	AppConnectorGroup            *services.Service
	AppConnectorController       *services.Service
	AppConnectorSchedule         *services.Service
	ApplicationSegment           *services.Service
	ApplicationSegmentPRA        *services.Service
	ApplicationSegmentInspection *services.Service
	ApplicationSegmentByType     *services.Service
	AppServerController          *services.Service
	BACertificate                *services.Service
	BrowserAccess                *services.Service
	CBIRegions                   *services.Service
	CBIProfileController         *services.Service
	CBIZpaProfile                *services.Service
	CBICertificateController     *services.Service
	CBIBannerController          *services.Service
	CloudConnectorGroup          *services.Service
	CustomerVersionProfile       *services.Service
	ClientTypes                  *services.Service
	EmergencyAccess              *services.Service
	EnrollmentCert               *services.Service
	IDPController                *services.Service
	InspectionCustomControls     *services.Service
	InspectionPredefinedControls *services.Service
	InspectionProfile            *services.Service
	IsolationProfile             *services.Service
	LSSConfigController          *services.Service
	MachineGroup                 *services.Service
	MicroTenants                 *services.Service
	Platforms                    *services.Service
	PolicySetController          *services.Service
	PolicySetControllerV2        *services.Service
	PostureProfile               *services.Service
	PRAApproval                  *services.Service
	PRAConsole                   *services.Service
	PRACredential                *services.Service
	PRAPortal                    *services.Service
	ProvisioningKey              *services.Service
	SAMLAttribute                *services.Service
	ScimGroup                    *scimgroup.Service
	ScimAttributeHeader          *services.Service
	SegmentGroup                 *services.Service
	ServerGroup                  *services.Service
	ServiceEdgeGroup             *services.Service
	ServiceEdgeSchedule          *services.Service
	ServiceEdgeController        *services.Service
	TrustedNetwork               *services.Service
}

type Config

type Config struct {
	ClientID     string
	ClientSecret string
	CustomerID   string
	BaseURL      string
	UserAgent    string
}

func (*Config) Client

func (c *Config) Client() (*Client, error)

type Getter

type Getter func(id string) error

func (Getter) Get

func (g Getter) Get(id string) error

type RulesOrders

type RulesOrders struct {
	PolicyType string
	Orders     map[string]int
}

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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