3
3
package zero_trust
4
4
5
5
import (
6
- "context"
7
- "errors"
8
- "fmt"
9
- "net/http"
10
-
11
- "github.com/cloudflare/cloudflare-go/v3/internal/apijson"
12
- "github.com/cloudflare/cloudflare-go/v3/internal/requestconfig"
13
6
"github.com/cloudflare/cloudflare-go/v3/option"
14
- "github.com/cloudflare/cloudflare-go/v3/shared"
15
7
)
16
8
17
9
// DevicePolicyDefaultCertificateService contains methods and other services that
@@ -32,133 +24,3 @@ func NewDevicePolicyDefaultCertificateService(opts ...option.RequestOption) (r *
32
24
r .Options = opts
33
25
return
34
26
}
35
-
36
- // Enable Zero Trust Clients to provision a certificate, containing a x509 subject,
37
- // and referenced by Access device posture policies when the client visits MTLS
38
- // protected domains. This facilitates device posture without a WARP session.
39
- func (r * DevicePolicyDefaultCertificateService ) Edit (ctx context.Context , zoneTag string , body DevicePolicyDefaultCertificateEditParams , opts ... option.RequestOption ) (res * interface {}, err error ) {
40
- var env DevicePolicyDefaultCertificateEditResponseEnvelope
41
- opts = append (r .Options [:], opts ... )
42
- if zoneTag == "" {
43
- err = errors .New ("missing required zone_tag parameter" )
44
- return
45
- }
46
- path := fmt .Sprintf ("zones/%s/devices/policy/certificates" , zoneTag )
47
- err = requestconfig .ExecuteNewRequest (ctx , http .MethodPatch , path , body , & env , opts ... )
48
- if err != nil {
49
- return
50
- }
51
- res = & env .Result
52
- return
53
- }
54
-
55
- // Fetches device certificate provisioning
56
- func (r * DevicePolicyDefaultCertificateService ) Get (ctx context.Context , zoneTag string , opts ... option.RequestOption ) (res * interface {}, err error ) {
57
- var env DevicePolicyDefaultCertificateGetResponseEnvelope
58
- opts = append (r .Options [:], opts ... )
59
- if zoneTag == "" {
60
- err = errors .New ("missing required zone_tag parameter" )
61
- return
62
- }
63
- path := fmt .Sprintf ("zones/%s/devices/policy/certificates" , zoneTag )
64
- err = requestconfig .ExecuteNewRequest (ctx , http .MethodGet , path , nil , & env , opts ... )
65
- if err != nil {
66
- return
67
- }
68
- res = & env .Result
69
- return
70
- }
71
-
72
- type DevicePolicyDefaultCertificateEditParams struct {
73
- DevicePolicyCertificates DevicePolicyCertificatesParam `json:"device_policy_certificates,required"`
74
- }
75
-
76
- func (r DevicePolicyDefaultCertificateEditParams ) MarshalJSON () (data []byte , err error ) {
77
- return apijson .MarshalRoot (r .DevicePolicyCertificates )
78
- }
79
-
80
- type DevicePolicyDefaultCertificateEditResponseEnvelope struct {
81
- Errors []shared.ResponseInfo `json:"errors,required"`
82
- Messages []shared.ResponseInfo `json:"messages,required"`
83
- Result interface {} `json:"result,required"`
84
- // Whether the API call was successful.
85
- Success DevicePolicyDefaultCertificateEditResponseEnvelopeSuccess `json:"success,required"`
86
- JSON devicePolicyDefaultCertificateEditResponseEnvelopeJSON `json:"-"`
87
- }
88
-
89
- // devicePolicyDefaultCertificateEditResponseEnvelopeJSON contains the JSON
90
- // metadata for the struct [DevicePolicyDefaultCertificateEditResponseEnvelope]
91
- type devicePolicyDefaultCertificateEditResponseEnvelopeJSON struct {
92
- Errors apijson.Field
93
- Messages apijson.Field
94
- Result apijson.Field
95
- Success apijson.Field
96
- raw string
97
- ExtraFields map [string ]apijson.Field
98
- }
99
-
100
- func (r * DevicePolicyDefaultCertificateEditResponseEnvelope ) UnmarshalJSON (data []byte ) (err error ) {
101
- return apijson .UnmarshalRoot (data , r )
102
- }
103
-
104
- func (r devicePolicyDefaultCertificateEditResponseEnvelopeJSON ) RawJSON () string {
105
- return r .raw
106
- }
107
-
108
- // Whether the API call was successful.
109
- type DevicePolicyDefaultCertificateEditResponseEnvelopeSuccess bool
110
-
111
- const (
112
- DevicePolicyDefaultCertificateEditResponseEnvelopeSuccessTrue DevicePolicyDefaultCertificateEditResponseEnvelopeSuccess = true
113
- )
114
-
115
- func (r DevicePolicyDefaultCertificateEditResponseEnvelopeSuccess ) IsKnown () bool {
116
- switch r {
117
- case DevicePolicyDefaultCertificateEditResponseEnvelopeSuccessTrue :
118
- return true
119
- }
120
- return false
121
- }
122
-
123
- type DevicePolicyDefaultCertificateGetResponseEnvelope struct {
124
- Errors []shared.ResponseInfo `json:"errors,required"`
125
- Messages []shared.ResponseInfo `json:"messages,required"`
126
- Result interface {} `json:"result,required"`
127
- // Whether the API call was successful.
128
- Success DevicePolicyDefaultCertificateGetResponseEnvelopeSuccess `json:"success,required"`
129
- JSON devicePolicyDefaultCertificateGetResponseEnvelopeJSON `json:"-"`
130
- }
131
-
132
- // devicePolicyDefaultCertificateGetResponseEnvelopeJSON contains the JSON metadata
133
- // for the struct [DevicePolicyDefaultCertificateGetResponseEnvelope]
134
- type devicePolicyDefaultCertificateGetResponseEnvelopeJSON struct {
135
- Errors apijson.Field
136
- Messages apijson.Field
137
- Result apijson.Field
138
- Success apijson.Field
139
- raw string
140
- ExtraFields map [string ]apijson.Field
141
- }
142
-
143
- func (r * DevicePolicyDefaultCertificateGetResponseEnvelope ) UnmarshalJSON (data []byte ) (err error ) {
144
- return apijson .UnmarshalRoot (data , r )
145
- }
146
-
147
- func (r devicePolicyDefaultCertificateGetResponseEnvelopeJSON ) RawJSON () string {
148
- return r .raw
149
- }
150
-
151
- // Whether the API call was successful.
152
- type DevicePolicyDefaultCertificateGetResponseEnvelopeSuccess bool
153
-
154
- const (
155
- DevicePolicyDefaultCertificateGetResponseEnvelopeSuccessTrue DevicePolicyDefaultCertificateGetResponseEnvelopeSuccess = true
156
- )
157
-
158
- func (r DevicePolicyDefaultCertificateGetResponseEnvelopeSuccess ) IsKnown () bool {
159
- switch r {
160
- case DevicePolicyDefaultCertificateGetResponseEnvelopeSuccessTrue :
161
- return true
162
- }
163
- return false
164
- }
0 commit comments