-
Notifications
You must be signed in to change notification settings - Fork 10
/
cloud_account_vsphere_region_enumeration_specification.go
134 lines (107 loc) · 4.7 KB
/
cloud_account_vsphere_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
// 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"
)
// CloudAccountVsphereRegionEnumerationSpecification Specification for a region enumeration of vshpere cloud account.
//
// swagger:model CloudAccountVsphereRegionEnumerationSpecification
type CloudAccountVsphereRegionEnumerationSpecification struct {
// Accept self signed certificate when connecting to vSphere
// Example: false
AcceptSelfSignedCertificate bool `json:"acceptSelfSignedCertificate,omitempty"`
// 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 hostName, username, password.
// Example: b8b7a918-342e-4a53-a3b0-b935da0fe601
CloudAccountID string `json:"cloudAccountId,omitempty"`
// Identifier of a data collector vm deployed in the on premise infrastructure. Refer to the data-collector API to create or list data collectors.
// Note: Data collector endpoints are not available in vRA on-prem release.
// Example: 23959a1e-18bc-4f0c-ac49-b5aeb4b6eef4
Dcid string `json:"dcid,omitempty"`
// The environment where data collectors are deployed. When the data collectors are deployed on a cloud gateway appliance, use "aap".
// Example: aap
Environment string `json:"environment,omitempty"`
// Host name for the vSphere endpoint. Either provide hostName or provide a cloudAccountId of an existing account.
// Example: vc.mycompany.com
HostName string `json:"hostName,omitempty"`
// Password for the user used to authenticate with the cloud Account. Either provide password or provide a cloudAccountId of an existing account.
// Example: cndhjslacd90ascdbasyoucbdh
Password string `json:"password,omitempty"`
// Username to authenticate with the cloud account. Either provide username or provide a cloudAccountId of an existing account.
// Example: administrator@mycompany.com
Username string `json:"username,omitempty"`
}
// Validate validates this cloud account vsphere region enumeration specification
func (m *CloudAccountVsphereRegionEnumerationSpecification) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCertificateInfo(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *CloudAccountVsphereRegionEnumerationSpecification) 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
}
// ContextValidate validate this cloud account vsphere region enumeration specification based on the context it is used
func (m *CloudAccountVsphereRegionEnumerationSpecification) 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 *CloudAccountVsphereRegionEnumerationSpecification) 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 *CloudAccountVsphereRegionEnumerationSpecification) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CloudAccountVsphereRegionEnumerationSpecification) UnmarshalBinary(b []byte) error {
var res CloudAccountVsphereRegionEnumerationSpecification
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}