Documentation
¶
Overview ¶
Package papi contains code for exporting properties
Index ¶
- Variables
- func AsInt(f any) int64
- func CheckErrors() (string, error)
- func CmdCreateInclude(c *cli.Context) error
- func CmdCreateProperty(c *cli.Context) error
- func ReportError(format string, a ...any) string
- func TerraformName(str string) string
- func ToSnakeCase(str string) string
- type EdgeHostname
- type Hostname
- type NetworkInfo
- type RuleTemplate
- type RulesTemplate
- type TFData
- type TFIncludeData
- type TFPropertyData
- type WrappedRules
Constants ¶
This section is empty.
Variables ¶
var ( // ErrFetchingActivations is returned when fetching activations of include request failed ErrFetchingActivations = errors.New("fetching include activations") // ErrFetchingLatestIncludeVersion is returned when fetching latest version of include request failed ErrFetchingLatestIncludeVersion = errors.New("fetching latest include version") // ErrIncludeNotFound is returned when include couldn't be found ErrIncludeNotFound = errors.New("include name not found") // ErrIncludeRulesNotFound is returned when include rules couldn't be found ErrIncludeRulesNotFound = errors.New("include rules not found") )
var ( // ErrHostnamesNotFound is returned when hostnames couldn't be found ErrHostnamesNotFound = errors.New("hostnames not found") // ErrPropertyVersionNotFound is returned when property version couldn't be found ErrPropertyVersionNotFound = errors.New("property version not found") // ErrPropertyVersionNotValid is returned when property version couldn't be found ErrPropertyVersionNotValid = errors.New("property version not valid") // ErrProductNameNotFound is returned when product couldn't be found ErrProductNameNotFound = errors.New("product name not found") // ErrFetchingActivationDetails is returned when fetching activation details request failed ErrFetchingActivationDetails = errors.New("fetching activations") // ErrFetchingHostnameDetails is returned when fetching hostname details request failed ErrFetchingHostnameDetails = errors.New("fetching hostnames") // ErrFetchingReferencedIncludes is returned when fetching referenced includes request failed ErrFetchingReferencedIncludes = errors.New("fetching referenced includes") // ErrSavingSnippets is returned when error appeared while saving property snippet JSON files ErrSavingSnippets = errors.New("saving snippets") // ErrPropertyRulesNotFound is returned when property rules couldn't be found ErrPropertyRulesNotFound = errors.New("property rules not found") // ErrGroupNotFound is returned when group couldn't be found ErrGroupNotFound = errors.New("group not found") // ErrPropertyNotFound is returned when property couldn't be found ErrPropertyNotFound = errors.New("property not found") // ErrSavingFiles is returned when an issue with processing templates occurs ErrSavingFiles = errors.New("saving terraform project files") // ErrUnsupportedRuleFormat is returned when there is no template for provided rule format ErrUnsupportedRuleFormat = errors.New("unsupported rule format") )
Functions ¶
func AsInt ¶ added in v1.4.0
AsInt provides proper conversion of values which are integers in reality
func CheckErrors ¶ added in v1.5.0
CheckErrors is used to fail the processing of the template in case of any unknown behaviors or criteria
func CmdCreateInclude ¶ added in v1.3.0
func CmdCreateInclude(c *cli.Context) error
CmdCreateInclude is an entrypoint to export-include include sub-command
func CmdCreateProperty ¶
func CmdCreateProperty(c *cli.Context) error
CmdCreateProperty is an entrypoint to create-property command
func ReportError ¶ added in v1.5.0
ReportError is used to report unknown behaviors or criteria during processing the template
func TerraformName ¶ added in v1.4.0
TerraformName is used to convert rule name into valid name of the exported data source Current implementation is not covering all the cases defined in the terraform specification https://github.com/hashicorp/hcl/blob/main/hclsyntax/spec.md#identifiers and http://unicode.org/reports/tr31/ , but only a reasonable subset.
func ToSnakeCase ¶ added in v1.4.0
ToSnakeCase returns name using snake case notation - SomeName -> some_name
Types ¶
type EdgeHostname ¶
type EdgeHostname struct { EdgeHostname string EdgeHostnameID string ContractID string GroupID string ID string IPv6 string EdgeHostnameResourceName string SecurityType string UseCases string }
EdgeHostname represents EdgeHostname resource
type Hostname ¶
type Hostname struct { CnameFrom string CnameTo string EdgeHostnameResourceName string CertProvisioningType string IsActive bool }
Hostname represents edge hostname resource
type NetworkInfo ¶ added in v1.7.0
type NetworkInfo struct { Emails []string ActivationNote string HasActivation bool Version int IsActiveOnLatestVersion bool }
NetworkInfo holds details for specific network
type RuleTemplate ¶
type RuleTemplate struct { Name string `json:"name"` Criteria []papi.RuleBehavior `json:"criteria,omitempty"` Behaviors []papi.RuleBehavior `json:"behaviors,omitempty"` Children []string `json:"children,omitempty"` Comments string `json:"comments,omitempty"` CriteriaLocked bool `json:"criteriaLocked,omitempty"` CriteriaMustSatisfy papi.RuleCriteriaMustSatisfy `json:"criteriaMustSatisfy,omitempty"` UUID string `json:"uuid,omitempty"` Variables []papi.RuleVariable `json:"variables,omitempty"` AdvancedOverride string `json:"advancedOverride,omitempty"` Options struct { IsSecure bool `json:"is_secure,omitempty"` } `json:"options,omitempty"` CustomOverride *papi.RuleCustomOverride `json:"customOverride,omitempty"` }
RuleTemplate represent data used for single rule
type RulesTemplate ¶
type RulesTemplate struct { AccountID string `json:"accountId"` ContractID string `json:"contractId"` GroupID string `json:"groupId"` PropertyID string `json:"propertyId,omitempty"` IncludeID string `json:"includeId,omitempty"` PropertyVersion int `json:"propertyVersion,omitempty"` IncludeVersion int `json:"includeVersion,omitempty"` IncludeType string `json:"includeType,omitempty"` Etag string `json:"etag"` RuleFormat string `json:"ruleFormat"` Comments string `json:"comments,omitempty"` Rule *RuleTemplate `json:"rules"` Errors []*papi.Error `json:"errors,omitempty"` }
RulesTemplate represent data used for rules
type TFData ¶
type TFData struct { Includes []TFIncludeData Property TFPropertyData Section string Rules []*WrappedRules RulesAsHCL bool WithIncludes bool UseBootstrap bool }
TFData holds template data
type TFIncludeData ¶ added in v1.3.0
type TFIncludeData struct { ContractID string GroupID string IncludeID string IncludeName string IncludeType string RuleFormat string Rules []*WrappedRules ProductionInfo NetworkInfo StagingInfo NetworkInfo }
TFIncludeData holds template data for include
type TFPropertyData ¶ added in v1.3.0
type TFPropertyData struct { GroupName string GroupID string ContractID string PropertyResourceName string PropertyName string PropertyID string ProductID string ProductName string RuleFormat string IsSecure string EdgeHostnames map[string]EdgeHostname Hostnames map[string]Hostname ReadVersion string ProductionInfo NetworkInfo StagingInfo NetworkInfo }
TFPropertyData holds template data for property
type WrappedRules ¶ added in v1.4.0
type WrappedRules struct { Rule papi.Rules TerraformName string Children []*WrappedRules }
WrappedRules is a wrapper around Rule which simplifies flattening rule tree into list and adjust names of the datasources