Skip to content

Commit d4e1307

Browse files
stainless-app[bot]stainless-bot
authored andcommittedNov 21, 2024·
feat(api): api update (#3656)
1 parent 79d0254 commit d4e1307

5 files changed

+1028
-105
lines changed
 

‎.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 1451
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-4acaaed718bd08d16e3866d5ad032fbf2bbfeb978df2cf5164edb81fe41e4f89.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-c41d5095ac6ddaaef83c817e3f7a3bbf8d609ee792e4a1f07590fdd6719da1d0.yml

‎zero_trust/accessapplication.go

+956-90
Large diffs are not rendered by default.

‎zero_trust/accessapplication_test.go

+44-12
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,28 @@ func TestAccessApplicationNewWithOptionalParams(t *testing.T) {
5050
CustomDenyURL: cloudflare.F("custom_deny_url"),
5151
CustomNonIdentityDenyURL: cloudflare.F("custom_non_identity_deny_url"),
5252
CustomPages: cloudflare.F([]string{"699d98642c564d2e855e9661899b7252"}),
53-
EnableBindingCookie: cloudflare.F(true),
54-
HTTPOnlyCookieAttribute: cloudflare.F(true),
55-
LogoURL: cloudflare.F("https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg"),
56-
Name: cloudflare.F("Admin Site"),
57-
OptionsPreflightBypass: cloudflare.F(true),
58-
PathCookieAttribute: cloudflare.F(true),
53+
Destinations: cloudflare.F([]zero_trust.AccessApplicationNewParamsBodySelfHostedApplicationDestination{{
54+
Destination: cloudflare.F("test.example.com/admin"),
55+
Type: cloudflare.F(zero_trust.AccessApplicationNewParamsBodySelfHostedApplicationDestinationsTypePublic),
56+
}, {
57+
Destination: cloudflare.F("test.anotherexample.com/staff"),
58+
Type: cloudflare.F(zero_trust.AccessApplicationNewParamsBodySelfHostedApplicationDestinationsTypePublic),
59+
}, {
60+
Destination: cloudflare.F("10.5.0.2"),
61+
Type: cloudflare.F(zero_trust.AccessApplicationNewParamsBodySelfHostedApplicationDestinationsTypePublic),
62+
}, {
63+
Destination: cloudflare.F("10.5.0.3/32:1234-4321"),
64+
Type: cloudflare.F(zero_trust.AccessApplicationNewParamsBodySelfHostedApplicationDestinationsTypePublic),
65+
}, {
66+
Destination: cloudflare.F("private-sni.example.com"),
67+
Type: cloudflare.F(zero_trust.AccessApplicationNewParamsBodySelfHostedApplicationDestinationsTypePublic),
68+
}}),
69+
EnableBindingCookie: cloudflare.F(true),
70+
HTTPOnlyCookieAttribute: cloudflare.F(true),
71+
LogoURL: cloudflare.F("https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg"),
72+
Name: cloudflare.F("Admin Site"),
73+
OptionsPreflightBypass: cloudflare.F(true),
74+
PathCookieAttribute: cloudflare.F(true),
5975
Policies: cloudflare.F([]zero_trust.AccessApplicationNewParamsBodySelfHostedApplicationPolicyUnion{zero_trust.AccessApplicationNewParamsBodySelfHostedApplicationPoliciesAccessAppPolicyLink{
6076
ID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"),
6177
Precedence: cloudflare.F(int64(0)),
@@ -140,12 +156,28 @@ func TestAccessApplicationUpdateWithOptionalParams(t *testing.T) {
140156
CustomDenyURL: cloudflare.F("custom_deny_url"),
141157
CustomNonIdentityDenyURL: cloudflare.F("custom_non_identity_deny_url"),
142158
CustomPages: cloudflare.F([]string{"699d98642c564d2e855e9661899b7252"}),
143-
EnableBindingCookie: cloudflare.F(true),
144-
HTTPOnlyCookieAttribute: cloudflare.F(true),
145-
LogoURL: cloudflare.F("https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg"),
146-
Name: cloudflare.F("Admin Site"),
147-
OptionsPreflightBypass: cloudflare.F(true),
148-
PathCookieAttribute: cloudflare.F(true),
159+
Destinations: cloudflare.F([]zero_trust.AccessApplicationUpdateParamsBodySelfHostedApplicationDestination{{
160+
Destination: cloudflare.F("test.example.com/admin"),
161+
Type: cloudflare.F(zero_trust.AccessApplicationUpdateParamsBodySelfHostedApplicationDestinationsTypePublic),
162+
}, {
163+
Destination: cloudflare.F("test.anotherexample.com/staff"),
164+
Type: cloudflare.F(zero_trust.AccessApplicationUpdateParamsBodySelfHostedApplicationDestinationsTypePublic),
165+
}, {
166+
Destination: cloudflare.F("10.5.0.2"),
167+
Type: cloudflare.F(zero_trust.AccessApplicationUpdateParamsBodySelfHostedApplicationDestinationsTypePublic),
168+
}, {
169+
Destination: cloudflare.F("10.5.0.3/32:1234-4321"),
170+
Type: cloudflare.F(zero_trust.AccessApplicationUpdateParamsBodySelfHostedApplicationDestinationsTypePublic),
171+
}, {
172+
Destination: cloudflare.F("private-sni.example.com"),
173+
Type: cloudflare.F(zero_trust.AccessApplicationUpdateParamsBodySelfHostedApplicationDestinationsTypePublic),
174+
}}),
175+
EnableBindingCookie: cloudflare.F(true),
176+
HTTPOnlyCookieAttribute: cloudflare.F(true),
177+
LogoURL: cloudflare.F("https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg"),
178+
Name: cloudflare.F("Admin Site"),
179+
OptionsPreflightBypass: cloudflare.F(true),
180+
PathCookieAttribute: cloudflare.F(true),
149181
Policies: cloudflare.F([]zero_trust.AccessApplicationUpdateParamsBodySelfHostedApplicationPolicyUnion{zero_trust.AccessApplicationUpdateParamsBodySelfHostedApplicationPoliciesAccessAppPolicyLink{
150182
ID: cloudflare.F("f174e90a-fafe-4643-bbbc-4a0ed4fc8415"),
151183
Precedence: cloudflare.F(int64(0)),

‎zero_trust/organization.go

+21
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ import (
77
"errors"
88
"fmt"
99
"net/http"
10+
"net/url"
1011
"time"
1112

1213
"github.com/cloudflare/cloudflare-go/v3/internal/apijson"
14+
"github.com/cloudflare/cloudflare-go/v3/internal/apiquery"
1315
"github.com/cloudflare/cloudflare-go/v3/internal/param"
1416
"github.com/cloudflare/cloudflare-go/v3/internal/requestconfig"
1517
"github.com/cloudflare/cloudflare-go/v3/option"
@@ -551,12 +553,31 @@ type OrganizationRevokeUsersParams struct {
551553
AccountID param.Field[string] `path:"account_id"`
552554
// The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.
553555
ZoneID param.Field[string] `path:"zone_id"`
556+
// When set to `true`, all devices associated with the user will be revoked.
557+
QueryDevices param.Field[bool] `query:"devices"`
558+
// When set to `true`, all devices associated with the user will be revoked.
559+
BodyDevices param.Field[bool] `json:"devices"`
560+
// The uuid of the user to revoke.
561+
UserUID param.Field[string] `json:"user_uid"`
562+
// When set to `true`, the user will be required to re-authenticate to WARP for all
563+
// Gateway policies that enforce a WARP client session duration. When `false`, the
564+
// user’s WARP session will remain active
565+
WARPSessionReauth param.Field[bool] `json:"warp_session_reauth"`
554566
}
555567

556568
func (r OrganizationRevokeUsersParams) MarshalJSON() (data []byte, err error) {
557569
return apijson.MarshalRoot(r)
558570
}
559571

572+
// URLQuery serializes [OrganizationRevokeUsersParams]'s query parameters as
573+
// `url.Values`.
574+
func (r OrganizationRevokeUsersParams) URLQuery() (v url.Values) {
575+
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
576+
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
577+
NestedFormat: apiquery.NestedQueryFormatDots,
578+
})
579+
}
580+
560581
type OrganizationRevokeUsersResponseEnvelope struct {
561582
Result OrganizationRevokeUsersResponse `json:"result"`
562583
Success OrganizationRevokeUsersResponseEnvelopeSuccess `json:"success"`

‎zero_trust/organization_test.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,12 @@ func TestOrganizationRevokeUsersWithOptionalParams(t *testing.T) {
143143
option.WithAPIEmail("user@example.com"),
144144
)
145145
_, err := client.ZeroTrust.Organizations.RevokeUsers(context.TODO(), zero_trust.OrganizationRevokeUsersParams{
146-
Email: cloudflare.F("test@example.com"),
147-
AccountID: cloudflare.F("account_id"),
146+
Email: cloudflare.F("test@example.com"),
147+
AccountID: cloudflare.F("account_id"),
148+
QueryDevices: cloudflare.F(true),
149+
BodyDevices: cloudflare.F(true),
150+
UserUID: cloudflare.F("699d98642c564d2e855e9661899b7252"),
151+
WARPSessionReauth: cloudflare.F(true),
148152
})
149153
if err != nil {
150154
var apierr *cloudflare.Error

0 commit comments

Comments
 (0)
Please sign in to comment.