Skip to content

Commit

Permalink
Merge pull request #2571 from cloudflare/release-please--branches--v2…
Browse files Browse the repository at this point in the history
…--changes--next

release: 2.4.0
  • Loading branch information
jacobbednarz authored Jul 16, 2024
2 parents 6cde8d6 + aeb0a6e commit 32b522b
Show file tree
Hide file tree
Showing 736 changed files with 20,157 additions and 26,376 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
pull_request:
branches:
- v2
- next

jobs:
lint:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.prism.log
codegen.log
Brewfile.lock.json
.idea/
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.3.0"
".": "2.4.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1348
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-49d54760f87326f9200c777f867e4ea579c92a43f481207ae252db9748c9b07b.yml
configured_endpoints: 1256
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-923d8c7667b68c786e6c026c4f4851798943c7d68ea055c0043d9253413c5847.yml
307 changes: 307 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/cloudflare/cloudflare-go/v2@v2.3.0'
go get -u 'github.com/cloudflare/cloudflare-go/v2@v2.4.0'
```

<!-- x-release-please-end -->
Expand Down
8 changes: 4 additions & 4 deletions accounts/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ func NewAccountService(opts ...option.RequestOption) (r *AccountService) {

// Update an existing account.
func (r *AccountService) Update(ctx context.Context, params AccountUpdateParams, opts ...option.RequestOption) (res *AccountUpdateResponse, err error) {
opts = append(r.Options[:], opts...)
var env AccountUpdateResponseEnvelope
opts = append(r.Options[:], opts...)
path := fmt.Sprintf("accounts/%v", params.AccountID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...)
if err != nil {
Expand All @@ -56,7 +56,7 @@ func (r *AccountService) Update(ctx context.Context, params AccountUpdateParams,
// List all accounts you have ownership or verified access to.
func (r *AccountService) List(ctx context.Context, query AccountListParams, opts ...option.RequestOption) (res *pagination.V4PagePaginationArray[AccountListResponse], err error) {
var raw *http.Response
opts = append(r.Options, opts...)
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "accounts"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
Expand All @@ -78,8 +78,8 @@ func (r *AccountService) ListAutoPaging(ctx context.Context, query AccountListPa

// Get information about a specific account that you are a member of.
func (r *AccountService) Get(ctx context.Context, query AccountGetParams, opts ...option.RequestOption) (res *AccountGetResponse, err error) {
opts = append(r.Options[:], opts...)
var env AccountGetResponseEnvelope
opts = append(r.Options[:], opts...)
path := fmt.Sprintf("accounts/%v", query.AccountID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
if err != nil {
Expand Down Expand Up @@ -280,7 +280,7 @@ type AccountListParams struct {
func (r AccountListParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
NestedFormat: apiquery.NestedQueryFormatBrackets,
NestedFormat: apiquery.NestedQueryFormatDots,
})
}

Expand Down
2 changes: 1 addition & 1 deletion accounts/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestAccountUpdateWithOptionalParams(t *testing.T) {
Account: accounts.AccountParam{
Name: cloudflare.F("Demo Account"),
Settings: cloudflare.F(accounts.AccountSettingsParam{
AbuseContactEmail: cloudflare.F("string"),
AbuseContactEmail: cloudflare.F("abuse_contact_email"),
DefaultNameservers: cloudflare.F(accounts.AccountSettingsDefaultNameserversCloudflareStandard),
EnforceTwofactor: cloudflare.F(true),
UseAccountCustomNSByDefault: cloudflare.F(true),
Expand Down
16 changes: 10 additions & 6 deletions accounts/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func NewMemberService(opts ...option.RequestOption) (r *MemberService) {

// Add a user to the list of members for this account.
func (r *MemberService) New(ctx context.Context, params MemberNewParams, opts ...option.RequestOption) (res *MemberNewResponse, err error) {
opts = append(r.Options[:], opts...)
var env MemberNewResponseEnvelope
opts = append(r.Options[:], opts...)
if params.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
Expand All @@ -56,8 +56,8 @@ func (r *MemberService) New(ctx context.Context, params MemberNewParams, opts ..

// Modify an account member.
func (r *MemberService) Update(ctx context.Context, memberID string, params MemberUpdateParams, opts ...option.RequestOption) (res *MemberUpdateResponse, err error) {
opts = append(r.Options[:], opts...)
var env MemberUpdateResponseEnvelope
opts = append(r.Options[:], opts...)
if params.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
Expand All @@ -78,8 +78,12 @@ func (r *MemberService) Update(ctx context.Context, memberID string, params Memb
// List all members of an account.
func (r *MemberService) List(ctx context.Context, params MemberListParams, opts ...option.RequestOption) (res *pagination.V4PagePaginationArray[MemberListResponse], err error) {
var raw *http.Response
opts = append(r.Options, opts...)
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
if params.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
}
path := fmt.Sprintf("accounts/%s/members", params.AccountID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, params, &res, opts...)
if err != nil {
Expand All @@ -100,8 +104,8 @@ func (r *MemberService) ListAutoPaging(ctx context.Context, params MemberListPar

// Remove a member from an account.
func (r *MemberService) Delete(ctx context.Context, memberID string, body MemberDeleteParams, opts ...option.RequestOption) (res *MemberDeleteResponse, err error) {
opts = append(r.Options[:], opts...)
var env MemberDeleteResponseEnvelope
opts = append(r.Options[:], opts...)
if body.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
Expand All @@ -121,8 +125,8 @@ func (r *MemberService) Delete(ctx context.Context, memberID string, body Member

// Get information about a specific member of an account.
func (r *MemberService) Get(ctx context.Context, memberID string, query MemberGetParams, opts ...option.RequestOption) (res *MemberGetResponse, err error) {
opts = append(r.Options[:], opts...)
var env MemberGetResponseEnvelope
opts = append(r.Options[:], opts...)
if query.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
Expand Down Expand Up @@ -1487,7 +1491,7 @@ type MemberListParams struct {
func (r MemberListParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
NestedFormat: apiquery.NestedQueryFormatBrackets,
NestedFormat: apiquery.NestedQueryFormatDots,
})
}

Expand Down
8 changes: 6 additions & 2 deletions accounts/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ func NewRoleService(opts ...option.RequestOption) (r *RoleService) {
// Get all available roles for an account.
func (r *RoleService) List(ctx context.Context, query RoleListParams, opts ...option.RequestOption) (res *pagination.SinglePage[shared.Role], err error) {
var raw *http.Response
opts = append(r.Options, opts...)
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
if query.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
}
path := fmt.Sprintf("accounts/%s/roles", query.AccountID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...)
if err != nil {
Expand All @@ -60,8 +64,8 @@ func (r *RoleService) ListAutoPaging(ctx context.Context, query RoleListParams,

// Get information about a specific role for an account.
func (r *RoleService) Get(ctx context.Context, roleID interface{}, query RoleGetParams, opts ...option.RequestOption) (res *RoleGetResponse, err error) {
opts = append(r.Options[:], opts...)
var env RoleGetResponseEnvelope
opts = append(r.Options[:], opts...)
if query.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
Expand Down
4 changes: 2 additions & 2 deletions acm/totaltls.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func NewTotalTLSService(opts ...option.RequestOption) (r *TotalTLSService) {

// Set Total TLS Settings or disable the feature for a Zone.
func (r *TotalTLSService) New(ctx context.Context, params TotalTLSNewParams, opts ...option.RequestOption) (res *TotalTLSNewResponse, err error) {
opts = append(r.Options[:], opts...)
var env TotalTLSNewResponseEnvelope
opts = append(r.Options[:], opts...)
if params.ZoneID.Value == "" {
err = errors.New("missing required zone_id parameter")
return
Expand All @@ -53,8 +53,8 @@ func (r *TotalTLSService) New(ctx context.Context, params TotalTLSNewParams, opt

// Get Total TLS Settings for a Zone.
func (r *TotalTLSService) Get(ctx context.Context, query TotalTLSGetParams, opts ...option.RequestOption) (res *TotalTLSGetResponse, err error) {
opts = append(r.Options[:], opts...)
var env TotalTLSGetResponseEnvelope
opts = append(r.Options[:], opts...)
if query.ZoneID.Value == "" {
err = errors.New("missing required zone_id parameter")
return
Expand Down
14 changes: 9 additions & 5 deletions addressing/addressmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ func NewAddressMapService(opts ...option.RequestOption) (r *AddressMapService) {

// Create a new address map under the account.
func (r *AddressMapService) New(ctx context.Context, params AddressMapNewParams, opts ...option.RequestOption) (res *AddressMapNewResponse, err error) {
opts = append(r.Options[:], opts...)
var env AddressMapNewResponseEnvelope
opts = append(r.Options[:], opts...)
if params.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
Expand All @@ -62,8 +62,12 @@ func (r *AddressMapService) New(ctx context.Context, params AddressMapNewParams,
// List all address maps owned by the account.
func (r *AddressMapService) List(ctx context.Context, query AddressMapListParams, opts ...option.RequestOption) (res *pagination.SinglePage[AddressMap], err error) {
var raw *http.Response
opts = append(r.Options, opts...)
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
if query.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
}
path := fmt.Sprintf("accounts/%s/addressing/address_maps", query.AccountID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...)
if err != nil {
Expand All @@ -85,8 +89,8 @@ func (r *AddressMapService) ListAutoPaging(ctx context.Context, query AddressMap
// Delete a particular address map owned by the account. An Address Map must be
// disabled before it can be deleted.
func (r *AddressMapService) Delete(ctx context.Context, addressMapID string, body AddressMapDeleteParams, opts ...option.RequestOption) (res *[]AddressMapDeleteResponse, err error) {
opts = append(r.Options[:], opts...)
var env AddressMapDeleteResponseEnvelope
opts = append(r.Options[:], opts...)
if body.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
Expand All @@ -106,8 +110,8 @@ func (r *AddressMapService) Delete(ctx context.Context, addressMapID string, bod

// Modify properties of an address map owned by the account.
func (r *AddressMapService) Edit(ctx context.Context, addressMapID string, params AddressMapEditParams, opts ...option.RequestOption) (res *AddressMap, err error) {
opts = append(r.Options[:], opts...)
var env AddressMapEditResponseEnvelope
opts = append(r.Options[:], opts...)
if params.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
Expand All @@ -127,8 +131,8 @@ func (r *AddressMapService) Edit(ctx context.Context, addressMapID string, param

// Show a particular address map owned by the account.
func (r *AddressMapService) Get(ctx context.Context, addressMapID string, query AddressMapGetParams, opts ...option.RequestOption) (res *AddressMapGetResponse, err error) {
opts = append(r.Options[:], opts...)
var env AddressMapGetResponseEnvelope
opts = append(r.Options[:], opts...)
if query.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
Expand Down
4 changes: 2 additions & 2 deletions addressing/addressmapaccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func NewAddressMapAccountService(opts ...option.RequestOption) (r *AddressMapAcc

// Add an account as a member of a particular address map.
func (r *AddressMapAccountService) Update(ctx context.Context, addressMapID string, params AddressMapAccountUpdateParams, opts ...option.RequestOption) (res *[]AddressMapAccountUpdateResponse, err error) {
opts = append(r.Options[:], opts...)
var env AddressMapAccountUpdateResponseEnvelope
opts = append(r.Options[:], opts...)
if params.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
Expand All @@ -57,8 +57,8 @@ func (r *AddressMapAccountService) Update(ctx context.Context, addressMapID stri

// Remove an account as a member of a particular address map.
func (r *AddressMapAccountService) Delete(ctx context.Context, addressMapID string, body AddressMapAccountDeleteParams, opts ...option.RequestOption) (res *[]AddressMapAccountDeleteResponse, err error) {
opts = append(r.Options[:], opts...)
var env AddressMapAccountDeleteResponseEnvelope
opts = append(r.Options[:], opts...)
if body.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
Expand Down
4 changes: 2 additions & 2 deletions addressing/addressmapip.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func NewAddressMapIPService(opts ...option.RequestOption) (r *AddressMapIPServic

// Add an IP from a prefix owned by the account to a particular address map.
func (r *AddressMapIPService) Update(ctx context.Context, addressMapID string, ipAddress string, params AddressMapIPUpdateParams, opts ...option.RequestOption) (res *[]AddressMapIPUpdateResponse, err error) {
opts = append(r.Options[:], opts...)
var env AddressMapIPUpdateResponseEnvelope
opts = append(r.Options[:], opts...)
if params.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
Expand All @@ -61,8 +61,8 @@ func (r *AddressMapIPService) Update(ctx context.Context, addressMapID string, i

// Remove an IP from a particular address map.
func (r *AddressMapIPService) Delete(ctx context.Context, addressMapID string, ipAddress string, body AddressMapIPDeleteParams, opts ...option.RequestOption) (res *[]AddressMapIPDeleteResponse, err error) {
opts = append(r.Options[:], opts...)
var env AddressMapIPDeleteResponseEnvelope
opts = append(r.Options[:], opts...)
if body.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
Expand Down
4 changes: 2 additions & 2 deletions addressing/addressmapzone.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func NewAddressMapZoneService(opts ...option.RequestOption) (r *AddressMapZoneSe

// Add a zone as a member of a particular address map.
func (r *AddressMapZoneService) Update(ctx context.Context, addressMapID string, params AddressMapZoneUpdateParams, opts ...option.RequestOption) (res *[]AddressMapZoneUpdateResponse, err error) {
opts = append(r.Options[:], opts...)
var env AddressMapZoneUpdateResponseEnvelope
opts = append(r.Options[:], opts...)
if params.ZoneID.Value == "" {
err = errors.New("missing required zone_id parameter")
return
Expand All @@ -61,8 +61,8 @@ func (r *AddressMapZoneService) Update(ctx context.Context, addressMapID string,

// Remove a zone as a member of a particular address map.
func (r *AddressMapZoneService) Delete(ctx context.Context, addressMapID string, body AddressMapZoneDeleteParams, opts ...option.RequestOption) (res *[]AddressMapZoneDeleteResponse, err error) {
opts = append(r.Options[:], opts...)
var env AddressMapZoneDeleteResponseEnvelope
opts = append(r.Options[:], opts...)
if body.ZoneID.Value == "" {
err = errors.New("missing required zone_id parameter")
return
Expand Down
20 changes: 17 additions & 3 deletions addressing/loadocument.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
package addressing

import (
"bytes"
"context"
"errors"
"fmt"
"mime/multipart"
"net/http"

"github.com/cloudflare/cloudflare-go/v2/internal/apiform"
"github.com/cloudflare/cloudflare-go/v2/internal/apijson"
"github.com/cloudflare/cloudflare-go/v2/internal/param"
"github.com/cloudflare/cloudflare-go/v2/internal/requestconfig"
Expand Down Expand Up @@ -38,8 +41,8 @@ func NewLOADocumentService(opts ...option.RequestOption) (r *LOADocumentService)

// Submit LOA document (pdf format) under the account.
func (r *LOADocumentService) New(ctx context.Context, params LOADocumentNewParams, opts ...option.RequestOption) (res *LOADocumentNewResponse, err error) {
opts = append(r.Options[:], opts...)
var env LOADocumentNewResponseEnvelope
opts = append(r.Options[:], opts...)
if params.AccountID.Value == "" {
err = errors.New("missing required account_id parameter")
return
Expand Down Expand Up @@ -82,8 +85,19 @@ type LOADocumentNewParams struct {
LOADocument param.Field[string] `json:"loa_document,required"`
}

func (r LOADocumentNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
func (r LOADocumentNewParams) MarshalMultipart() (data []byte, contentType string, err error) {
buf := bytes.NewBuffer(nil)
writer := multipart.NewWriter(buf)
err = apiform.MarshalRoot(r, writer)
if err != nil {
writer.Close()
return nil, "", err
}
err = writer.Close()
if err != nil {
return nil, "", err
}
return buf.Bytes(), writer.FormDataContentType(), nil
}

type LOADocumentNewResponseEnvelope struct {
Expand Down
Loading

0 comments on commit 32b522b

Please sign in to comment.