diff --git a/.stats.yml b/.stats.yml
index c82be893b3e..ee82d7a6ae8 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 1448
+configured_endpoints: 1450
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-0530d6510c5b139af850d24a4f932d5139c8d321a955ffa101b0debafbd75465.yml
diff --git a/api.md b/api.md
index 219e585f9b3..0bdd7631b78 100644
--- a/api.md
+++ b/api.md
@@ -4818,6 +4818,7 @@ Response Types:
- zero_trust.AccessInfrastructureTargetNewResponse
- zero_trust.AccessInfrastructureTargetUpdateResponse
- zero_trust.AccessInfrastructureTargetListResponse
+- zero_trust.AccessInfrastructureTargetBulkUpdateResponse
- zero_trust.AccessInfrastructureTargetGetResponse
Methods:
@@ -4826,6 +4827,8 @@ Methods:
- client.ZeroTrust.Access.Infrastructure.Targets.Update(ctx context.Context, targetID string, params zero_trust.AccessInfrastructureTargetUpdateParams) (zero_trust.AccessInfrastructureTargetUpdateResponse, error)
- client.ZeroTrust.Access.Infrastructure.Targets.List(ctx context.Context, params zero_trust.AccessInfrastructureTargetListParams) (pagination.V4PagePaginationArray[zero_trust.AccessInfrastructureTargetListResponse], error)
- client.ZeroTrust.Access.Infrastructure.Targets.Delete(ctx context.Context, targetID string, body zero_trust.AccessInfrastructureTargetDeleteParams) error
+- client.ZeroTrust.Access.Infrastructure.Targets.BulkDelete(ctx context.Context, body zero_trust.AccessInfrastructureTargetBulkDeleteParams) error
+- client.ZeroTrust.Access.Infrastructure.Targets.BulkUpdate(ctx context.Context, params zero_trust.AccessInfrastructureTargetBulkUpdateParams) ([]zero_trust.AccessInfrastructureTargetBulkUpdateResponse, error)
- client.ZeroTrust.Access.Infrastructure.Targets.Get(ctx context.Context, targetID string, query zero_trust.AccessInfrastructureTargetGetParams) (zero_trust.AccessInfrastructureTargetGetResponse, error)
### Applications
diff --git a/zero_trust/accessinfrastructuretarget.go b/zero_trust/accessinfrastructuretarget.go
index f1140ea63cd..a735ab81e10 100644
--- a/zero_trust/accessinfrastructuretarget.go
+++ b/zero_trust/accessinfrastructuretarget.go
@@ -120,6 +120,31 @@ func (r *AccessInfrastructureTargetService) Delete(ctx context.Context, targetID
return
}
+// Removes one or more targets.
+func (r *AccessInfrastructureTargetService) BulkDelete(ctx context.Context, body AccessInfrastructureTargetBulkDeleteParams, opts ...option.RequestOption) (err error) {
+ opts = append(r.Options[:], opts...)
+ opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
+ if body.AccountID.Value == "" {
+ err = errors.New("missing required account_id parameter")
+ return
+ }
+ path := fmt.Sprintf("accounts/%s/infrastructure/targets/batch", body.AccountID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
+ return
+}
+
+// Adds one or more targets.
+func (r *AccessInfrastructureTargetService) BulkUpdate(ctx context.Context, params AccessInfrastructureTargetBulkUpdateParams, opts ...option.RequestOption) (res *[]AccessInfrastructureTargetBulkUpdateResponse, err error) {
+ opts = append(r.Options[:], opts...)
+ if params.AccountID.Value == "" {
+ err = errors.New("missing required account_id parameter")
+ return
+ }
+ path := fmt.Sprintf("accounts/%s/infrastructure/targets/batch", params.AccountID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &res, opts...)
+ return
+}
+
// Get target
func (r *AccessInfrastructureTargetService) Get(ctx context.Context, targetID string, query AccessInfrastructureTargetGetParams, opts ...option.RequestOption) (res *AccessInfrastructureTargetGetResponse, err error) {
var env AccessInfrastructureTargetGetResponseEnvelope
@@ -483,6 +508,120 @@ func (r accessInfrastructureTargetListResponseIpipv6JSON) RawJSON() string {
return r.raw
}
+type AccessInfrastructureTargetBulkUpdateResponse struct {
+ // Target identifier
+ ID string `json:"id,required" format:"uuid"`
+ // Date and time at which the target was created
+ CreatedAt time.Time `json:"created_at,required" format:"date-time"`
+ // A non-unique field that refers to a target
+ Hostname string `json:"hostname,required"`
+ // The IPv4/IPv6 address that identifies where to reach a target
+ IP AccessInfrastructureTargetBulkUpdateResponseIP `json:"ip,required"`
+ // Date and time at which the target was modified
+ ModifiedAt time.Time `json:"modified_at,required" format:"date-time"`
+ JSON accessInfrastructureTargetBulkUpdateResponseJSON `json:"-"`
+}
+
+// accessInfrastructureTargetBulkUpdateResponseJSON contains the JSON metadata for
+// the struct [AccessInfrastructureTargetBulkUpdateResponse]
+type accessInfrastructureTargetBulkUpdateResponseJSON struct {
+ ID apijson.Field
+ CreatedAt apijson.Field
+ Hostname apijson.Field
+ IP apijson.Field
+ ModifiedAt apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AccessInfrastructureTargetBulkUpdateResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r accessInfrastructureTargetBulkUpdateResponseJSON) RawJSON() string {
+ return r.raw
+}
+
+// The IPv4/IPv6 address that identifies where to reach a target
+type AccessInfrastructureTargetBulkUpdateResponseIP struct {
+ // The target's IPv4 address
+ IPV4 AccessInfrastructureTargetBulkUpdateResponseIPIPV4 `json:"ipv4"`
+ // The target's IPv6 address
+ IPV6 AccessInfrastructureTargetBulkUpdateResponseIPIPV6 `json:"ipv6"`
+ JSON accessInfrastructureTargetBulkUpdateResponseIPJSON `json:"-"`
+}
+
+// accessInfrastructureTargetBulkUpdateResponseIPJSON contains the JSON metadata
+// for the struct [AccessInfrastructureTargetBulkUpdateResponseIP]
+type accessInfrastructureTargetBulkUpdateResponseIPJSON struct {
+ IPV4 apijson.Field
+ IPV6 apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AccessInfrastructureTargetBulkUpdateResponseIP) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r accessInfrastructureTargetBulkUpdateResponseIPJSON) RawJSON() string {
+ return r.raw
+}
+
+// The target's IPv4 address
+type AccessInfrastructureTargetBulkUpdateResponseIPIPV4 struct {
+ // IP address of the target
+ IPAddr string `json:"ip_addr"`
+ // (optional) Private virtual network identifier for the target. If omitted, the
+ // default virtual network ID will be used.
+ VirtualNetworkID string `json:"virtual_network_id" format:"uuid"`
+ JSON accessInfrastructureTargetBulkUpdateResponseIpipv4JSON `json:"-"`
+}
+
+// accessInfrastructureTargetBulkUpdateResponseIpipv4JSON contains the JSON
+// metadata for the struct [AccessInfrastructureTargetBulkUpdateResponseIPIPV4]
+type accessInfrastructureTargetBulkUpdateResponseIpipv4JSON struct {
+ IPAddr apijson.Field
+ VirtualNetworkID apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AccessInfrastructureTargetBulkUpdateResponseIPIPV4) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r accessInfrastructureTargetBulkUpdateResponseIpipv4JSON) RawJSON() string {
+ return r.raw
+}
+
+// The target's IPv6 address
+type AccessInfrastructureTargetBulkUpdateResponseIPIPV6 struct {
+ // IP address of the target
+ IPAddr string `json:"ip_addr"`
+ // (optional) Private virtual network identifier for the target. If omitted, the
+ // default virtual network ID will be used.
+ VirtualNetworkID string `json:"virtual_network_id" format:"uuid"`
+ JSON accessInfrastructureTargetBulkUpdateResponseIpipv6JSON `json:"-"`
+}
+
+// accessInfrastructureTargetBulkUpdateResponseIpipv6JSON contains the JSON
+// metadata for the struct [AccessInfrastructureTargetBulkUpdateResponseIPIPV6]
+type accessInfrastructureTargetBulkUpdateResponseIpipv6JSON struct {
+ IPAddr apijson.Field
+ VirtualNetworkID apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AccessInfrastructureTargetBulkUpdateResponseIPIPV6) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r accessInfrastructureTargetBulkUpdateResponseIpipv6JSON) RawJSON() string {
+ return r.raw
+}
+
type AccessInfrastructureTargetGetResponse struct {
// Target identifier
ID string `json:"id,required" format:"uuid"`
@@ -826,6 +965,72 @@ type AccessInfrastructureTargetDeleteParams struct {
AccountID param.Field[string] `path:"account_id,required"`
}
+type AccessInfrastructureTargetBulkDeleteParams struct {
+ // Account identifier
+ AccountID param.Field[string] `path:"account_id,required"`
+}
+
+type AccessInfrastructureTargetBulkUpdateParams struct {
+ // Account identifier
+ AccountID param.Field[string] `path:"account_id,required"`
+ Body []AccessInfrastructureTargetBulkUpdateParamsBody `json:"body,required"`
+}
+
+func (r AccessInfrastructureTargetBulkUpdateParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r.Body)
+}
+
+type AccessInfrastructureTargetBulkUpdateParamsBody struct {
+ // A non-unique field that refers to a target. Case insensitive, maximum length of
+ // 255 characters, supports the use of special characters dash and period, does not
+ // support spaces, and must start and end with an alphanumeric character.
+ Hostname param.Field[string] `json:"hostname,required"`
+ // The IPv4/IPv6 address that identifies where to reach a target
+ IP param.Field[AccessInfrastructureTargetBulkUpdateParamsBodyIP] `json:"ip,required"`
+}
+
+func (r AccessInfrastructureTargetBulkUpdateParamsBody) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// The IPv4/IPv6 address that identifies where to reach a target
+type AccessInfrastructureTargetBulkUpdateParamsBodyIP struct {
+ // The target's IPv4 address
+ IPV4 param.Field[AccessInfrastructureTargetBulkUpdateParamsBodyIPIPV4] `json:"ipv4"`
+ // The target's IPv6 address
+ IPV6 param.Field[AccessInfrastructureTargetBulkUpdateParamsBodyIPIPV6] `json:"ipv6"`
+}
+
+func (r AccessInfrastructureTargetBulkUpdateParamsBodyIP) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// The target's IPv4 address
+type AccessInfrastructureTargetBulkUpdateParamsBodyIPIPV4 struct {
+ // IP address of the target
+ IPAddr param.Field[string] `json:"ip_addr"`
+ // (optional) Private virtual network identifier for the target. If omitted, the
+ // default virtual network ID will be used.
+ VirtualNetworkID param.Field[string] `json:"virtual_network_id" format:"uuid"`
+}
+
+func (r AccessInfrastructureTargetBulkUpdateParamsBodyIPIPV4) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+// The target's IPv6 address
+type AccessInfrastructureTargetBulkUpdateParamsBodyIPIPV6 struct {
+ // IP address of the target
+ IPAddr param.Field[string] `json:"ip_addr"`
+ // (optional) Private virtual network identifier for the target. If omitted, the
+ // default virtual network ID will be used.
+ VirtualNetworkID param.Field[string] `json:"virtual_network_id" format:"uuid"`
+}
+
+func (r AccessInfrastructureTargetBulkUpdateParamsBodyIPIPV6) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
type AccessInfrastructureTargetGetParams struct {
// Account identifier
AccountID param.Field[string] `path:"account_id,required"`
diff --git a/zero_trust/accessinfrastructuretarget_test.go b/zero_trust/accessinfrastructuretarget_test.go
index 804a43d7659..162cecc3e20 100644
--- a/zero_trust/accessinfrastructuretarget_test.go
+++ b/zero_trust/accessinfrastructuretarget_test.go
@@ -154,6 +154,69 @@ func TestAccessInfrastructureTargetDelete(t *testing.T) {
}
}
+func TestAccessInfrastructureTargetBulkDelete(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := cloudflare.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
+ option.WithAPIEmail("user@example.com"),
+ )
+ err := client.ZeroTrust.Access.Infrastructure.Targets.BulkDelete(context.TODO(), zero_trust.AccessInfrastructureTargetBulkDeleteParams{
+ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
+ })
+ if err != nil {
+ var apierr *cloudflare.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestAccessInfrastructureTargetBulkUpdate(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := cloudflare.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
+ option.WithAPIEmail("user@example.com"),
+ )
+ _, err := client.ZeroTrust.Access.Infrastructure.Targets.BulkUpdate(context.TODO(), zero_trust.AccessInfrastructureTargetBulkUpdateParams{
+ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
+ Body: []zero_trust.AccessInfrastructureTargetBulkUpdateParamsBody{{
+ Hostname: cloudflare.F("infra-access-target"),
+ IP: cloudflare.F(zero_trust.AccessInfrastructureTargetBulkUpdateParamsBodyIP{
+ IPV4: cloudflare.F(zero_trust.AccessInfrastructureTargetBulkUpdateParamsBodyIPIPV4{
+ IPAddr: cloudflare.F("187.26.29.249"),
+ VirtualNetworkID: cloudflare.F("c77b744e-acc8-428f-9257-6878c046ed55"),
+ }),
+ IPV6: cloudflare.F(zero_trust.AccessInfrastructureTargetBulkUpdateParamsBodyIPIPV6{
+ IPAddr: cloudflare.F("64c0:64e8:f0b4:8dbf:7104:72b0:ec8f:f5e0"),
+ VirtualNetworkID: cloudflare.F("c77b744e-acc8-428f-9257-6878c046ed55"),
+ }),
+ }),
+ }},
+ })
+ if err != nil {
+ var apierr *cloudflare.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
func TestAccessInfrastructureTargetGet(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {