Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): update via SDK Studio #1724

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4422,7 +4422,6 @@ Methods:
Params Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#AccessRuleUnionParam">AccessRuleUnionParam</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#AuthenticationMethodRuleParam">AuthenticationMethodRuleParam</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#AzureGroupRuleParam">AzureGroupRuleParam</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#CertificateRuleParam">CertificateRuleParam</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#CountryRuleParam">CountryRuleParam</a>
Expand All @@ -4443,7 +4442,6 @@ Params Types:
Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#AccessRule">AccessRule</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#AuthenticationMethodRule">AuthenticationMethodRule</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#AzureGroupRule">AzureGroupRule</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#CertificateRule">CertificateRule</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust">zero_trust</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/zero_trust#CountryRule">CountryRule</a>
Expand Down
228 changes: 67 additions & 161 deletions zero_trust/access.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (r AccessRule) AsUnion() AccessRuleUnion {
// [zero_trust.SAMLGroupRule], [zero_trust.ServiceTokenRule],
// [zero_trust.AccessRuleAccessAnyValidServiceTokenRule],
// [zero_trust.ExternalEvaluationRule], [zero_trust.CountryRule],
// [zero_trust.AuthenticationMethodRule] or
// [zero_trust.AccessRuleAccessAuthenticationMethodRule] or
// [zero_trust.AccessRuleAccessDevicePostureRule].
type AccessRuleUnion interface {
implementsZeroTrustAccessRule()
Expand Down Expand Up @@ -204,7 +204,7 @@ func init() {
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Type: reflect.TypeOf(AuthenticationMethodRule{}),
Type: reflect.TypeOf(AccessRuleAccessAuthenticationMethodRule{}),
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
Expand Down Expand Up @@ -238,6 +238,52 @@ func (r accessRuleAccessAnyValidServiceTokenRuleJSON) RawJSON() string {

func (r AccessRuleAccessAnyValidServiceTokenRule) implementsZeroTrustAccessRule() {}

// Enforce different MFA options
type AccessRuleAccessAuthenticationMethodRule struct {
AuthMethod AccessRuleAccessAuthenticationMethodRuleAuthMethod `json:"auth_method,required"`
JSON accessRuleAccessAuthenticationMethodRuleJSON `json:"-"`
}

// accessRuleAccessAuthenticationMethodRuleJSON contains the JSON metadata for the
// struct [AccessRuleAccessAuthenticationMethodRule]
type accessRuleAccessAuthenticationMethodRuleJSON struct {
AuthMethod apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *AccessRuleAccessAuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r accessRuleAccessAuthenticationMethodRuleJSON) RawJSON() string {
return r.raw
}

func (r AccessRuleAccessAuthenticationMethodRule) implementsZeroTrustAccessRule() {}

type AccessRuleAccessAuthenticationMethodRuleAuthMethod struct {
// The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176.
AuthMethod string `json:"auth_method,required"`
JSON accessRuleAccessAuthenticationMethodRuleAuthMethodJSON `json:"-"`
}

// accessRuleAccessAuthenticationMethodRuleAuthMethodJSON contains the JSON
// metadata for the struct [AccessRuleAccessAuthenticationMethodRuleAuthMethod]
type accessRuleAccessAuthenticationMethodRuleAuthMethodJSON struct {
AuthMethod apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *AccessRuleAccessAuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r accessRuleAccessAuthenticationMethodRuleAuthMethodJSON) RawJSON() string {
return r.raw
}

// Enforces a device posture rule has run successfully
type AccessRuleAccessDevicePostureRule struct {
DevicePosture AccessRuleAccessDevicePostureRuleDevicePosture `json:"device_posture,required"`
Expand Down Expand Up @@ -324,7 +370,7 @@ func (r AccessRuleParam) implementsZeroTrustAccessRuleUnionParam() {}
// [zero_trust.SAMLGroupRuleParam], [zero_trust.ServiceTokenRuleParam],
// [zero_trust.AccessRuleAccessAnyValidServiceTokenRuleParam],
// [zero_trust.ExternalEvaluationRuleParam], [zero_trust.CountryRuleParam],
// [zero_trust.AuthenticationMethodRuleParam],
// [zero_trust.AccessRuleAccessAuthenticationMethodRuleParam],
// [zero_trust.AccessRuleAccessDevicePostureRuleParam], [AccessRuleParam].
type AccessRuleUnionParam interface {
implementsZeroTrustAccessRuleUnionParam()
Expand All @@ -342,183 +388,43 @@ func (r AccessRuleAccessAnyValidServiceTokenRuleParam) MarshalJSON() (data []byt

func (r AccessRuleAccessAnyValidServiceTokenRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

// Enforces a device posture rule has run successfully
type AccessRuleAccessDevicePostureRuleParam struct {
DevicePosture param.Field[AccessRuleAccessDevicePostureRuleDevicePostureParam] `json:"device_posture,required"`
}

func (r AccessRuleAccessDevicePostureRuleParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

func (r AccessRuleAccessDevicePostureRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

type AccessRuleAccessDevicePostureRuleDevicePostureParam struct {
// The ID of a device posture integration.
IntegrationUid param.Field[string] `json:"integration_uid,required"`
}

func (r AccessRuleAccessDevicePostureRuleDevicePostureParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

// Enforce different MFA options
type AuthenticationMethodRule struct {
AuthMethod AuthenticationMethodRuleAuthMethod `json:"auth_method,required"`
JSON authenticationMethodRuleJSON `json:"-"`
type AccessRuleAccessAuthenticationMethodRuleParam struct {
AuthMethod param.Field[AccessRuleAccessAuthenticationMethodRuleAuthMethodParam] `json:"auth_method,required"`
}

// authenticationMethodRuleJSON contains the JSON metadata for the struct
// [AuthenticationMethodRule]
type authenticationMethodRuleJSON struct {
AuthMethod apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *AuthenticationMethodRule) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r authenticationMethodRuleJSON) RawJSON() string {
return r.raw
func (r AccessRuleAccessAuthenticationMethodRuleParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

func (r AuthenticationMethodRule) implementsZeroTrustAccessRule() {}
func (r AccessRuleAccessAuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

type AuthenticationMethodRuleAuthMethod struct {
type AccessRuleAccessAuthenticationMethodRuleAuthMethodParam struct {
// The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176.
AuthMethod string `json:"auth_method,required"`
JSON authenticationMethodRuleAuthMethodJSON `json:"-"`
}

// authenticationMethodRuleAuthMethodJSON contains the JSON metadata for the struct
// [AuthenticationMethodRuleAuthMethod]
type authenticationMethodRuleAuthMethodJSON struct {
AuthMethod apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *AuthenticationMethodRuleAuthMethod) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
AuthMethod param.Field[string] `json:"auth_method,required"`
}

func (r authenticationMethodRuleAuthMethodJSON) RawJSON() string {
return r.raw
func (r AccessRuleAccessAuthenticationMethodRuleAuthMethodParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

// Enforce different MFA options
type AuthenticationMethodRuleParam struct {
AuthMethod param.Field[AuthenticationMethodRuleAuthMethodParam] `json:"auth_method,required"`
// Enforces a device posture rule has run successfully
type AccessRuleAccessDevicePostureRuleParam struct {
DevicePosture param.Field[AccessRuleAccessDevicePostureRuleDevicePostureParam] `json:"device_posture,required"`
}

func (r AuthenticationMethodRuleParam) MarshalJSON() (data []byte, err error) {
func (r AccessRuleAccessDevicePostureRuleParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

func (r AuthenticationMethodRuleParam) implementsZeroTrustAccessRuleUnionParam() {}
func (r AccessRuleAccessDevicePostureRuleParam) implementsZeroTrustAccessRuleUnionParam() {}

type AuthenticationMethodRuleAuthMethodParam struct {
// The type of authentication method https://datatracker.ietf.org/doc/html/rfc8176.
AuthMethod param.Field[string] `json:"auth_method,required"`
type AccessRuleAccessDevicePostureRuleDevicePostureParam struct {
// The ID of a device posture integration.
IntegrationUid param.Field[string] `json:"integration_uid,required"`
}

func (r AuthenticationMethodRuleAuthMethodParam) MarshalJSON() (data []byte, err error) {
func (r AccessRuleAccessDevicePostureRuleDevicePostureParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

Expand Down