-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathmodel_algorithm.go
More file actions
159 lines (138 loc) · 6.18 KB
/
model_algorithm.go
File metadata and controls
159 lines (138 loc) · 6.18 KB
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/*
STACKIT Key Management Service API
This API provides endpoints for managing keys and key rings.
API version: 1.0.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
package kms
import (
"encoding/json"
"fmt"
)
// Algorithm The algorithm the key material uses.
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
type Algorithm string
// List of algorithm
const (
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
ALGORITHM_AES_256_GCM Algorithm = "aes_256_gcm"
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
ALGORITHM_RSA_2048_OAEP_SHA256 Algorithm = "rsa_2048_oaep_sha256"
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
ALGORITHM_RSA_3072_OAEP_SHA256 Algorithm = "rsa_3072_oaep_sha256"
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
ALGORITHM_RSA_4096_OAEP_SHA256 Algorithm = "rsa_4096_oaep_sha256"
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
ALGORITHM_RSA_4096_OAEP_SHA512 Algorithm = "rsa_4096_oaep_sha512"
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
ALGORITHM_HMAC_SHA256 Algorithm = "hmac_sha256"
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
ALGORITHM_HMAC_SHA384 Algorithm = "hmac_sha384"
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
ALGORITHM_HMAC_SHA512 Algorithm = "hmac_sha512"
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
ALGORITHM_ECDSA_P256_SHA256 Algorithm = "ecdsa_p256_sha256"
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
ALGORITHM_ECDSA_P384_SHA384 Algorithm = "ecdsa_p384_sha384"
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
ALGORITHM_ECDSA_P521_SHA512 Algorithm = "ecdsa_p521_sha512"
)
// All allowed values of Algorithm enum
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
var AllowedAlgorithmEnumValues = []Algorithm{
"aes_256_gcm",
"rsa_2048_oaep_sha256",
"rsa_3072_oaep_sha256",
"rsa_4096_oaep_sha256",
"rsa_4096_oaep_sha512",
"hmac_sha256",
"hmac_sha384",
"hmac_sha512",
"ecdsa_p256_sha256",
"ecdsa_p384_sha384",
"ecdsa_p521_sha512",
}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (v *Algorithm) UnmarshalJSON(src []byte) error {
var value string
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
// Allow unmarshalling zero value for testing purposes
var zeroValue string
if value == zeroValue {
return nil
}
enumTypeValue := Algorithm(value)
for _, existing := range AllowedAlgorithmEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid Algorithm", value)
}
// NewAlgorithmFromValue returns a pointer to a valid Algorithm
// for the value passed as argument, or an error if the value passed is not allowed by the enum
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func NewAlgorithmFromValue(v string) (*Algorithm, error) {
ev := Algorithm(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for Algorithm: valid values are %v", v, AllowedAlgorithmEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (v Algorithm) IsValid() bool {
for _, existing := range AllowedAlgorithmEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to algorithm value
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (v Algorithm) Ptr() *Algorithm {
return &v
}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
type NullableAlgorithm struct {
value *Algorithm
isSet bool
}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (v NullableAlgorithm) Get() *Algorithm {
return v.value
}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (v *NullableAlgorithm) Set(val *Algorithm) {
v.value = val
v.isSet = true
}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (v NullableAlgorithm) IsSet() bool {
return v.isSet
}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (v *NullableAlgorithm) Unset() {
v.value = nil
v.isSet = false
}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func NewNullableAlgorithm(val *Algorithm) *NullableAlgorithm {
return &NullableAlgorithm{value: val, isSet: true}
}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (v NullableAlgorithm) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (v *NullableAlgorithm) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}