-
Notifications
You must be signed in to change notification settings - Fork 10
/
cloud_account_region_enumeration_specification.go
142 lines (113 loc) · 4.72 KB
/
cloud_account_region_enumeration_specification.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
132
133
134
135
136
137
138
139
140
141
142
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// CloudAccountRegionEnumerationSpecification Specification for a region enumeration of generic cloud account.
//
// swagger:model CloudAccountRegionEnumerationSpecification
type CloudAccountRegionEnumerationSpecification struct {
// Certificate for a cloud account.
// Example: {\"certificate\": \"-----BEGIN CERTIFICATE-----\\nMIIDHjCCAoegAwIBAgIBATANBgkqhkiG9w0BAQsFADCBpjEUMBIGA1UEChMLVk13\\nYXJlIEluYAAc1pw18GT3iAqQRPx0PrjzJhgjIJMla\\n/1Kg4byY4FPSacNiRgY/FG2bPCqZk1yRfzmkFYCW/vU+Dg==\\n-----END CERTIFICATE-----\\n-\"}
CertificateInfo *CertificateInfoSpecification `json:"certificateInfo,omitempty"`
// Existing cloud account id. Either provide existing cloud account Id, or privateKeyId/privateKey credentials pair.
// Example: b8b7a918-342e-4a53-a3b0-b935da0fe601
CloudAccountID string `json:"cloudAccountId,omitempty"`
// Cloud Account specific properties supplied in as name value pairs. In case of AAP, provide environment property here. Example: "cloudAccountProperties": {
// "environment": "aap"
// }
// Example: {\"supportPublicImages\": \"true\", \"acceptSelfSignedCertificate\": \"true\" }
// Required: true
CloudAccountProperties map[string]string `json:"cloudAccountProperties"`
// Cloud account type
// Example: vsphere, aws, azure, nsxv, nsxt
CloudAccountType string `json:"cloudAccountType,omitempty"`
// Secret access key or password to be used to authenticate with the cloud account. Either provide privateKey or provide a cloudAccountId of an existing account.
// Example: gfsScK345sGGaVdds222dasdfDDSSasdfdsa34fS
PrivateKey string `json:"privateKey,omitempty"`
// Access key id or username to be used to authenticate with the cloud account. Either provide privateKeyId or provide a cloudAccountId of an existing account.
// Example: ACDC55DB4MFH6ADG75KK
PrivateKeyID string `json:"privateKeyId,omitempty"`
}
// Validate validates this cloud account region enumeration specification
func (m *CloudAccountRegionEnumerationSpecification) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCertificateInfo(formats); err != nil {
res = append(res, err)
}
if err := m.validateCloudAccountProperties(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *CloudAccountRegionEnumerationSpecification) validateCertificateInfo(formats strfmt.Registry) error {
if swag.IsZero(m.CertificateInfo) { // not required
return nil
}
if m.CertificateInfo != nil {
if err := m.CertificateInfo.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("certificateInfo")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("certificateInfo")
}
return err
}
}
return nil
}
func (m *CloudAccountRegionEnumerationSpecification) validateCloudAccountProperties(formats strfmt.Registry) error {
if err := validate.Required("cloudAccountProperties", "body", m.CloudAccountProperties); err != nil {
return err
}
return nil
}
// ContextValidate validate this cloud account region enumeration specification based on the context it is used
func (m *CloudAccountRegionEnumerationSpecification) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateCertificateInfo(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *CloudAccountRegionEnumerationSpecification) contextValidateCertificateInfo(ctx context.Context, formats strfmt.Registry) error {
if m.CertificateInfo != nil {
if err := m.CertificateInfo.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("certificateInfo")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("certificateInfo")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *CloudAccountRegionEnumerationSpecification) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CloudAccountRegionEnumerationSpecification) UnmarshalBinary(b []byte) error {
var res CloudAccountRegionEnumerationSpecification
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}