Skip to content

Latest commit

 

History

History
191 lines (144 loc) · 7.9 KB

File metadata and controls

191 lines (144 loc) · 7.9 KB

v7.7.0 Migration Guide

Breaking Changes

ssl

1. Recommendations.Get method and types removed

What changed: The Recommendations sub-resource has been removed from the SSL service. The endpoint GET /zones/{zone_id}/ssl/recommendation is no longer exposed by the SDK.

Impact: Code that reads SSL recommendations via client.SSL.Recommendations.Get(...) will no longer compile.

Removed Types:

  • SSL.Recommendations.Get method
  • RecommendationGetResponse
  • RecommendationGetParams
  • RecommendationService

Before (v7.6.0):

rec, err := client.SSL.Recommendations.Get(ctx, ssl.RecommendationGetParams{
    ZoneID: cloudflare.F("zone-id"),
})

After (v7.7.0):

Call the endpoint directly using the low-level request helper:

var rec map[string]interface{}
err := client.Get(ctx, "zones/zone-id/ssl/recommendation", nil, &rec)

Actions Needed:

  1. Remove all client.SSL.Recommendations.Get call sites and imports of RecommendationGetResponse / RecommendationGetParams.
  2. If your code path still needs the recommendation, call the HTTP endpoint directly via client.Get(...).

ai_gateway, workflows, zero_trust

2. Union-merged parent fields changed to interface{}

What changed: When the same field name appears on multiple union variants with different Go types, the merged parent struct's field is now typed as interface{} (with a // This field can have the runtime type of ... comment) instead of the variant-struct type. This matches how the code generator already emits sibling merged fields on the same structs (e.g. Values, Fields, AllowedMicrosoftOrganizations).

Impact: Direct field access on the affected parent fields will no longer compile against the previous type. In practice, direct field access on these fields did not work in v7.6.0 either -- json.Unmarshal panicked with reflect: call of reflect.Value.SetString on struct Value whenever an API response included the field. Callers that only used .AsUnion() for variant handling are unaffected.

Affected Types:

Package Struct Field
ai_gateway AIGatewayNewResponseSpendLimitsRulesMetadata Mode
ai_gateway AIGatewayUpdateResponseSpendLimitsRulesMetadata Mode
ai_gateway AIGatewayListResponseSpendLimitsRulesMetadata Mode
ai_gateway AIGatewayDeleteResponseSpendLimitsRulesMetadata Mode
ai_gateway AIGatewayGetResponseSpendLimitsRulesMetadata Mode
workflows VersionGraphResponseGraphWorkflowPayload Type
zero_trust DLPEmailAccountMappingNewResponseAuthRequirements Type
zero_trust DLPEmailAccountMappingGetResponseAuthRequirements Type

Before (v7.6.0):

// Panics at json.Unmarshal time -- effectively unreachable code:
resp, _ := client.AIGateway.New(ctx, ai_gateway.AIGatewayNewParams{ /* ... */ })
for _, rule := range resp.SpendLimits.Rules {
    for _, meta := range rule.Metadata {
        mode := meta.Mode // AIGatewayNewResponseSpendLimitsRulesMetadataMode (variant struct)
        _ = mode
    }
}

After (v7.7.0):

Use .AsUnion() on the parent to switch on the actual variant:

resp, _ := client.AIGateway.New(ctx, ai_gateway.AIGatewayNewParams{ /* ... */ })
for _, rule := range resp.SpendLimits.Rules {
    for _, meta := range rule.Metadata {
        switch variant := meta.AsUnion().(type) {
        case ai_gateway.AIGatewayNewResponseSpendLimitsRulesMetadataMode:
            // variant.Mode is an AIGatewayNewResponseSpendLimitsRulesMetadataModeMode
            // (e.g. "partition")
        case ai_gateway.AIGatewayNewResponseSpendLimitsRulesMetadataObject:
            // variant.Mode is an AIGatewayNewResponseSpendLimitsRulesMetadataObjectMode
            // (e.g. "filter") and variant.Values is []string
        }
    }
}

If you must read the raw value without a type switch, type-assert on the runtime type documented in the field comment:

if s, ok := meta.Mode.(ai_gateway.AIGatewayNewResponseSpendLimitsRulesMetadataModeMode); ok {
    // ...
}

Actions Needed:

  1. Replace direct field access (x.Mode, x.Type) on the affected structs with x.AsUnion() and a type switch on the concrete variant.
  2. If a type switch is not practical, type-assert on one of the concrete runtime types listed in the field comment.
  3. Anywhere code was calling into the field expecting a struct, delete the call: it was unreachable in v7.6.0 due to the unmarshal panic.

zero_trust

3. Devices.DEXTests response type renamed to SchemaHTTP

What changed: The response types for the four zero_trust.Devices.DEXTests methods have been renamed from per-method types to a single shared type, SchemaHTTP. The field structure is unchanged — only the exported type names differ.

Removed Types:

  • DeviceDEXTestNewResponse
  • DeviceDEXTestUpdateResponse
  • DeviceDEXTestListResponse
  • DeviceDEXTestGetResponse
  • Nested types: DeviceDEXTestNewResponseData, DeviceDEXTestNewResponseTargetPolicy, and their Update/List/Get counterparts (renamed to SchemaData, SchemaHTTPTargetPolicy).

Impact:

  • Code using := type inference and field access (res.Enabled, res.Name, etc.) continues to compile unchanged.
  • Code that references the removed type names directly — e.g., declaring a typed variable, passing to a helper function with a typed parameter, or type-switching — will no longer compile.

Affected methods:

  • client.ZeroTrust.Devices.DEXTests.New
  • client.ZeroTrust.Devices.DEXTests.Update
  • client.ZeroTrust.Devices.DEXTests.List
  • client.ZeroTrust.Devices.DEXTests.Get

Before (v7.6.0):

var test *zero_trust.DeviceDEXTestNewResponse
test, err = client.ZeroTrust.Devices.DEXTests.New(ctx, params)

func printTest(t *zero_trust.DeviceDEXTestListResponse) { /* ... */ }

After (v7.7.0):

var test *zero_trust.SchemaHTTP
test, err = client.ZeroTrust.Devices.DEXTests.New(ctx, params)

func printTest(t *zero_trust.SchemaHTTP) { /* ... */ }

Actions Needed:

  1. Search for DeviceDEXTest{New,Update,List,Get}Response and replace with SchemaHTTP.
  2. Search for DeviceDEXTest{New,Update,List,Get}ResponseData / ...TargetPolicy and replace with SchemaData / SchemaHTTPTargetPolicy.

4. Devices.IPProfiles.List pagination type changed

What changed: client.ZeroTrust.Devices.IPProfiles.List now returns *pagination.V4PagePaginationArray[IPProfile] instead of *pagination.SinglePage[IPProfile].

Impact:

  • Code that iterates with .ListAutoPaging(...) continues to work — the auto-pager has the same .Next() / .Current() API.
  • Code that reads .Result (a []IPProfile on both types) continues to compile.
  • Code that references pagination.SinglePage[IPProfile] explicitly in a variable declaration or function signature will no longer compile.

Before (v7.6.0):

var page *pagination.SinglePage[zero_trust.IPProfile]
page, err = client.ZeroTrust.Devices.IPProfiles.List(ctx, params)

After (v7.7.0):

var page *pagination.V4PagePaginationArray[zero_trust.IPProfile]
page, err = client.ZeroTrust.Devices.IPProfiles.List(ctx, params)

Actions Needed:

  1. Search for pagination.SinglePage[zero_trust.IPProfile] (and SinglePageAutoPager[zero_trust.IPProfile]) and replace with V4PagePaginationArray[...] / V4PagePaginationArrayAutoPager[...].

Summary of Breaking Changes

  1. ssl.Recommendations.Get method removed along with RecommendationGetResponse, RecommendationGetParams, and RecommendationService.
  2. Eight union-merged parent-struct fields changed from a variant-struct type to interface{} across ai_gateway, workflows, and zero_trust.
  3. zero_trust.Devices.DEXTests.{New,Update,List,Get} response types renamed to shared SchemaHTTP (field structure unchanged).
  4. zero_trust.Devices.IPProfiles.List pagination changed from SinglePage[IPProfile] to V4PagePaginationArray[IPProfile].