/
papi_errors.go
131 lines (107 loc) · 5.9 KB
/
papi_errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
package property
import (
"errors"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
)
var (
// PAPI group errors
// ErrLookingUpGroupByName is returned when fetching group from API client by groupName returned an error or no group was found
ErrLookingUpGroupByName = errors.New("looking up group with name")
// ErrNoGroupsFound is returned when no groups were found
ErrNoGroupsFound = errors.New("no groups found")
// ErrGroupNotInContract is returned when none of the groups could be associated with given contractID
ErrGroupNotInContract = errors.New("group does not belong to contract")
// ErrFetchingGroups represents error while fetching groups
ErrFetchingGroups = errors.New("fetching groups")
// ErrGroupNotFound is returned when group with provided ID is not found
ErrGroupNotFound = errors.New("group not found")
// PAPI Contract errors
// ErrLookingUpContract is returned when fetching contract from API client by groupId returned an error or no contract was found
ErrLookingUpContract = errors.New("looking up contract for provided group")
// ErrMultipleContractsInGroup is returned when fetching contract from API client by groupId returned multiple different contracts
ErrMultipleContractsInGroup = diag.Diagnostics{
diag.Diagnostic{
Severity: diag.Error,
Summary: "multiple contracts found for given group",
Detail: "Resource doesn't support groups with multiple contracts. " +
"Make sure your group has only one contract assigned before proceeding.",
},
}
// ErrNoContractProvided is retured when no contract ID was provided but "name" was
ErrNoContractProvided = errors.New("'contractId' is required for non-default name")
// ErrNoGroupProvided is returned when no "group" property is provided
ErrNoGroupProvided = errors.New("'group' not provided and it is a required input")
// ErrNoContractsFound is returned when no contracts were found
ErrNoContractsFound = errors.New("no contracts were found")
// ErrContractNotFound is returned when contract with provided ID does not exist
ErrContractNotFound = errors.New("contract not found")
// ErrFetchingContracts represents error while fetching contracts
ErrFetchingContracts = errors.New("fetching contracts")
// ErrMultipleContractsFound is returned when more than one contract was found
ErrMultipleContractsFound = diag.Diagnostics{
diag.Diagnostic{
Severity: diag.Error,
Summary: "multiple contracts found",
Detail: "Resource cannot unambiguously identify the contract. " +
"Please provide either a 'group_id' or 'group_name' for accurate identification.",
},
}
// PAPI Product errors
// ErrNoProductProvided is returned when no "product" property is provided
ErrNoProductProvided = errors.New("'product' not provided and it is a required input")
// ErrProductFetch represents error while fetching product
ErrProductFetch = errors.New("fetching product")
// ErrProductNotFound is returned when product with provided ID does not exist
ErrProductNotFound = errors.New("product not found")
// PAPI CP Code errors
// ErrLookingUpCPCode is returned when fetching CP Code from API client by contractID returned an error or no CP Code was found
ErrLookingUpCPCode = errors.New("looking up CP Code by name")
// ErrCpCodeNotFound is returned when cp code with provided ID does not exist
ErrCpCodeNotFound = errors.New("cp code not found")
// ErrCPCodeUpdateTimeout is returned when waiting for a cp code update results in timeout
ErrCPCodeUpdateTimeout = errors.New("cp code update timeout")
// PAPI Property errors
// ErrPropertyNotFound is returned when no property was found for given name
ErrPropertyNotFound = errors.New("property not found")
// ErrRulesNotFound is returned when no rules were found
ErrRulesNotFound = errors.New("property rules not found")
// PAPI property version errors
// ErrVersionCreate represents an error while creating new property version
ErrVersionCreate = errors.New("creating property version")
// ErrPropertyVersionNotFound is returned when no property versions were found
ErrPropertyVersionNotFound = errors.New("property version not found")
// PAPI rule format errors
// ErrRuleFormatsNotFound is returned when no rule formats were found
ErrRuleFormatsNotFound = errors.New("no rule formats found")
// ErrEdgeHostnameNotFound is returned when no edgehostname were found
ErrEdgeHostnameNotFound = errors.New("unable to find edge hostname")
// Property includes errors
// ErrNoLatestIncludeActivation is returned when there is no activation for provided include
ErrNoLatestIncludeActivation = errors.New("no latest activation for given include")
// ErrPropertyInclude is returned when operation on property include fails
ErrPropertyInclude = errors.New("property include")
// DiagWarnActivationTimeout returned on activation poll timeout
DiagWarnActivationTimeout = diag.Diagnostic{
Severity: diag.Warning,
Summary: "Timeout waiting for activation status",
Detail: `
The activation creation request has been started successfully, however the operation timeout was
exceeded while waiting for the remote resource to update. You may retry the operation to continue
to wait for the final status.
It is recommended that the timeout for activation resources be set to greater than 90 minutes.
See: https://www.terraform.io/docs/configuration/resources.html#operation-timeouts
`,
}
// DiagWarnActivationCanceled is returned on activation poll cancel
DiagWarnActivationCanceled = diag.Diagnostic{
Severity: diag.Warning,
Summary: "Operation canceled while waiting for activation status",
Detail: `
The activation creation request has been started successfully, however the a cancellation was received
while waiting for the remote resource to update. You may retry the operation to continue to wait for
the final status.
It is recommended that the timeout for activation resources be set to greater than 90 minutes.
See: https://www.terraform.io/docs/configuration/resources.html#operation-timeouts
`,
}
)