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 #1684

Merged
merged 1 commit into from
Apr 5, 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
205 changes: 47 additions & 158 deletions addressing/prefixbgpbinding.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func NewPrefixBGPBindingService(opts ...option.RequestOption) (r *PrefixBGPBindi
// service running on Cloudflare's network. **Note:** This API may only be used on
// prefixes currently configured with a Magic Transit service binding, and only
// allows creating service bindings for the Cloudflare CDN or Cloudflare Spectrum.
func (r *PrefixBGPBindingService) New(ctx context.Context, prefixID string, params PrefixBGPBindingNewParams, opts ...option.RequestOption) (res *PrefixBGPBindingNewResponse, err error) {
func (r *PrefixBGPBindingService) New(ctx context.Context, prefixID string, params PrefixBGPBindingNewParams, opts ...option.RequestOption) (res *ServiceBinding, err error) {
opts = append(r.Options[:], opts...)
var env PrefixBGPBindingNewResponseEnvelope
path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bindings", params.AccountID, prefixID)
Expand All @@ -55,7 +55,7 @@ func (r *PrefixBGPBindingService) New(ctx context.Context, prefixID string, para
// `192.0.2.0/24` to Cloudflare Magic Transit and `192.0.2.1/32` to the Cloudflare
// CDN would route traffic for `192.0.2.1` to the CDN, and traffic for all other
// IPs in the prefix to Cloudflare Magic Transit.
func (r *PrefixBGPBindingService) List(ctx context.Context, prefixID string, query PrefixBGPBindingListParams, opts ...option.RequestOption) (res *pagination.SinglePage[PrefixBGPBindingListResponse], err error) {
func (r *PrefixBGPBindingService) List(ctx context.Context, prefixID string, query PrefixBGPBindingListParams, opts ...option.RequestOption) (res *pagination.SinglePage[ServiceBinding], err error) {
var raw *http.Response
opts = append(r.Options, opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
Expand All @@ -78,7 +78,7 @@ func (r *PrefixBGPBindingService) List(ctx context.Context, prefixID string, que
// `192.0.2.0/24` to Cloudflare Magic Transit and `192.0.2.1/32` to the Cloudflare
// CDN would route traffic for `192.0.2.1` to the CDN, and traffic for all other
// IPs in the prefix to Cloudflare Magic Transit.
func (r *PrefixBGPBindingService) ListAutoPaging(ctx context.Context, prefixID string, query PrefixBGPBindingListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[PrefixBGPBindingListResponse] {
func (r *PrefixBGPBindingService) ListAutoPaging(ctx context.Context, prefixID string, query PrefixBGPBindingListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[ServiceBinding] {
return pagination.NewSinglePageAutoPager(r.List(ctx, prefixID, query, opts...))
}

Expand All @@ -96,7 +96,7 @@ func (r *PrefixBGPBindingService) Delete(ctx context.Context, prefixID string, b
}

// Fetch a single Service Binding
func (r *PrefixBGPBindingService) Get(ctx context.Context, prefixID string, bindingID string, query PrefixBGPBindingGetParams, opts ...option.RequestOption) (res *PrefixBGPBindingGetResponse, err error) {
func (r *PrefixBGPBindingService) Get(ctx context.Context, prefixID string, bindingID string, query PrefixBGPBindingGetParams, opts ...option.RequestOption) (res *ServiceBinding, err error) {
opts = append(r.Options[:], opts...)
var env PrefixBGPBindingGetResponseEnvelope
path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bindings/%s", query.AccountID, prefixID, bindingID)
Expand All @@ -108,23 +108,22 @@ func (r *PrefixBGPBindingService) Get(ctx context.Context, prefixID string, bind
return
}

type PrefixBGPBindingNewResponse struct {
type ServiceBinding struct {
// Identifier
ID string `json:"id"`
// IP Prefix in Classless Inter-Domain Routing format.
CIDR string `json:"cidr"`
// Status of a Service Binding's deployment to the Cloudflare network
Provisioning PrefixBGPBindingNewResponseProvisioning `json:"provisioning"`
Provisioning ServiceBindingProvisioning `json:"provisioning"`
// Identifier
ServiceID string `json:"service_id"`
// Name of a service running on the Cloudflare network
ServiceName string `json:"service_name"`
JSON prefixBGPBindingNewResponseJSON `json:"-"`
ServiceName string `json:"service_name"`
JSON serviceBindingJSON `json:"-"`
}

// prefixBGPBindingNewResponseJSON contains the JSON metadata for the struct
// [PrefixBGPBindingNewResponse]
type prefixBGPBindingNewResponseJSON struct {
// serviceBindingJSON contains the JSON metadata for the struct [ServiceBinding]
type serviceBindingJSON struct {
ID apijson.Field
CIDR apijson.Field
Provisioning apijson.Field
Expand All @@ -134,203 +133,93 @@ type prefixBGPBindingNewResponseJSON struct {
ExtraFields map[string]apijson.Field
}

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

func (r prefixBGPBindingNewResponseJSON) RawJSON() string {
func (r serviceBindingJSON) RawJSON() string {
return r.raw
}

func (r ServiceBinding) implementsWorkersBinding() {}

func (r ServiceBinding) implementsWorkersBindingItem() {}

// Status of a Service Binding's deployment to the Cloudflare network
type PrefixBGPBindingNewResponseProvisioning struct {
type ServiceBindingProvisioning struct {
// When a binding has been deployed to a majority of Cloudflare datacenters, the
// binding will become active and can be used with its associated service.
State PrefixBGPBindingNewResponseProvisioningState `json:"state"`
JSON prefixBGPBindingNewResponseProvisioningJSON `json:"-"`
State ServiceBindingProvisioningState `json:"state"`
JSON serviceBindingProvisioningJSON `json:"-"`
}

// prefixBGPBindingNewResponseProvisioningJSON contains the JSON metadata for the
// struct [PrefixBGPBindingNewResponseProvisioning]
type prefixBGPBindingNewResponseProvisioningJSON struct {
// serviceBindingProvisioningJSON contains the JSON metadata for the struct
// [ServiceBindingProvisioning]
type serviceBindingProvisioningJSON struct {
State apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

func (r prefixBGPBindingNewResponseProvisioningJSON) RawJSON() string {
func (r serviceBindingProvisioningJSON) RawJSON() string {
return r.raw
}

// When a binding has been deployed to a majority of Cloudflare datacenters, the
// binding will become active and can be used with its associated service.
type PrefixBGPBindingNewResponseProvisioningState string
type ServiceBindingProvisioningState string

const (
PrefixBGPBindingNewResponseProvisioningStateProvisioning PrefixBGPBindingNewResponseProvisioningState = "provisioning"
PrefixBGPBindingNewResponseProvisioningStateActive PrefixBGPBindingNewResponseProvisioningState = "active"
ServiceBindingProvisioningStateProvisioning ServiceBindingProvisioningState = "provisioning"
ServiceBindingProvisioningStateActive ServiceBindingProvisioningState = "active"
)

func (r PrefixBGPBindingNewResponseProvisioningState) IsKnown() bool {
func (r ServiceBindingProvisioningState) IsKnown() bool {
switch r {
case PrefixBGPBindingNewResponseProvisioningStateProvisioning, PrefixBGPBindingNewResponseProvisioningStateActive:
case ServiceBindingProvisioningStateProvisioning, ServiceBindingProvisioningStateActive:
return true
}
return false
}

type PrefixBGPBindingListResponse struct {
// Identifier
ID string `json:"id"`
type ServiceBindingParam struct {
// IP Prefix in Classless Inter-Domain Routing format.
CIDR string `json:"cidr"`
CIDR param.Field[string] `json:"cidr"`
// Status of a Service Binding's deployment to the Cloudflare network
Provisioning PrefixBGPBindingListResponseProvisioning `json:"provisioning"`
Provisioning param.Field[ServiceBindingProvisioningParam] `json:"provisioning"`
// Identifier
ServiceID string `json:"service_id"`
ServiceID param.Field[string] `json:"service_id"`
// Name of a service running on the Cloudflare network
ServiceName string `json:"service_name"`
JSON prefixBGPBindingListResponseJSON `json:"-"`
}

// prefixBGPBindingListResponseJSON contains the JSON metadata for the struct
// [PrefixBGPBindingListResponse]
type prefixBGPBindingListResponseJSON struct {
ID apijson.Field
CIDR apijson.Field
Provisioning apijson.Field
ServiceID apijson.Field
ServiceName apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

func (r prefixBGPBindingListResponseJSON) RawJSON() string {
return r.raw
ServiceName param.Field[string] `json:"service_name"`
}

// Status of a Service Binding's deployment to the Cloudflare network
type PrefixBGPBindingListResponseProvisioning struct {
// When a binding has been deployed to a majority of Cloudflare datacenters, the
// binding will become active and can be used with its associated service.
State PrefixBGPBindingListResponseProvisioningState `json:"state"`
JSON prefixBGPBindingListResponseProvisioningJSON `json:"-"`
}

// prefixBGPBindingListResponseProvisioningJSON contains the JSON metadata for the
// struct [PrefixBGPBindingListResponseProvisioning]
type prefixBGPBindingListResponseProvisioningJSON struct {
State apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

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

// When a binding has been deployed to a majority of Cloudflare datacenters, the
// binding will become active and can be used with its associated service.
type PrefixBGPBindingListResponseProvisioningState string

const (
PrefixBGPBindingListResponseProvisioningStateProvisioning PrefixBGPBindingListResponseProvisioningState = "provisioning"
PrefixBGPBindingListResponseProvisioningStateActive PrefixBGPBindingListResponseProvisioningState = "active"
)

func (r PrefixBGPBindingListResponseProvisioningState) IsKnown() bool {
switch r {
case PrefixBGPBindingListResponseProvisioningStateProvisioning, PrefixBGPBindingListResponseProvisioningStateActive:
return true
}
return false
}
func (r ServiceBindingParam) implementsWorkersBindingItemUnionParam() {}

type PrefixBGPBindingGetResponse struct {
// Identifier
ID string `json:"id"`
// IP Prefix in Classless Inter-Domain Routing format.
CIDR string `json:"cidr"`
// Status of a Service Binding's deployment to the Cloudflare network
Provisioning PrefixBGPBindingGetResponseProvisioning `json:"provisioning"`
// Identifier
ServiceID string `json:"service_id"`
// Name of a service running on the Cloudflare network
ServiceName string `json:"service_name"`
JSON prefixBGPBindingGetResponseJSON `json:"-"`
}
func (r ServiceBindingParam) implementsWorkersBindingItemUnionParam() {}

// prefixBGPBindingGetResponseJSON contains the JSON metadata for the struct
// [PrefixBGPBindingGetResponse]
type prefixBGPBindingGetResponseJSON struct {
ID apijson.Field
CIDR apijson.Field
Provisioning apijson.Field
ServiceID apijson.Field
ServiceName apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r ServiceBindingParam) implementsWorkersBindingItemUnionParam() {}

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

func (r prefixBGPBindingGetResponseJSON) RawJSON() string {
return r.raw
}
func (r ServiceBindingParam) implementsWorkersBindingItemUnionParam() {}

// Status of a Service Binding's deployment to the Cloudflare network
type PrefixBGPBindingGetResponseProvisioning struct {
type ServiceBindingProvisioningParam struct {
// When a binding has been deployed to a majority of Cloudflare datacenters, the
// binding will become active and can be used with its associated service.
State PrefixBGPBindingGetResponseProvisioningState `json:"state"`
JSON prefixBGPBindingGetResponseProvisioningJSON `json:"-"`
}

// prefixBGPBindingGetResponseProvisioningJSON contains the JSON metadata for the
// struct [PrefixBGPBindingGetResponseProvisioning]
type prefixBGPBindingGetResponseProvisioningJSON struct {
State apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

func (r prefixBGPBindingGetResponseProvisioningJSON) RawJSON() string {
return r.raw
State param.Field[ServiceBindingProvisioningState] `json:"state"`
}

// When a binding has been deployed to a majority of Cloudflare datacenters, the
// binding will become active and can be used with its associated service.
type PrefixBGPBindingGetResponseProvisioningState string

const (
PrefixBGPBindingGetResponseProvisioningStateProvisioning PrefixBGPBindingGetResponseProvisioningState = "provisioning"
PrefixBGPBindingGetResponseProvisioningStateActive PrefixBGPBindingGetResponseProvisioningState = "active"
)

func (r PrefixBGPBindingGetResponseProvisioningState) IsKnown() bool {
switch r {
case PrefixBGPBindingGetResponseProvisioningStateProvisioning, PrefixBGPBindingGetResponseProvisioningStateActive:
return true
}
return false
func (r ServiceBindingProvisioningParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

type PrefixBGPBindingNewParams struct {
Expand All @@ -349,7 +238,7 @@ func (r PrefixBGPBindingNewParams) MarshalJSON() (data []byte, err error) {
type PrefixBGPBindingNewResponseEnvelope struct {
Errors []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"errors,required"`
Messages []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"messages,required"`
Result PrefixBGPBindingNewResponse `json:"result,required"`
Result ServiceBinding `json:"result,required"`
// Whether the API call was successful
Success PrefixBGPBindingNewResponseEnvelopeSuccess `json:"success,required"`
JSON prefixBGPBindingNewResponseEnvelopeJSON `json:"-"`
Expand Down Expand Up @@ -450,7 +339,7 @@ type PrefixBGPBindingGetParams struct {
type PrefixBGPBindingGetResponseEnvelope struct {
Errors []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"errors,required"`
Messages []shared.UnnamedSchemaRef3248f24329456e19dfa042fff9986f72 `json:"messages,required"`
Result PrefixBGPBindingGetResponse `json:"result,required"`
Result ServiceBinding `json:"result,required"`
// Whether the API call was successful
Success PrefixBGPBindingGetResponseEnvelopeSuccess `json:"success,required"`
JSON prefixBGPBindingGetResponseEnvelopeJSON `json:"-"`
Expand Down
Loading