Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#1652)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Apr 3, 2024
1 parent d6d08c9 commit cdb0efe
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 23 deletions.
7 changes: 4 additions & 3 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1521,12 +1521,13 @@ Methods:

Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities">certificate_authorities</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities#TLSHostnameAssociation">TLSHostnameAssociation</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities">certificate_authorities</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities#HostnameAssociationUpdateResponse">HostnameAssociationUpdateResponse</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities">certificate_authorities</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities#HostnameAssociationGetResponse">HostnameAssociationGetResponse</a>

Methods:

- <code title="put /zones/{zone_id}/certificate_authorities/hostname_associations">client.CertificateAuthorities.HostnameAssociations.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities#HostnameAssociationService.Update">Update</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities">certificate_authorities</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities#HostnameAssociationUpdateParams">HostnameAssociationUpdateParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities">certificate_authorities</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities#TLSHostnameAssociation">TLSHostnameAssociation</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /zones/{zone_id}/certificate_authorities/hostname_associations">client.CertificateAuthorities.HostnameAssociations.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities#HostnameAssociationService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities">certificate_authorities</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities#HostnameAssociationGetParams">HostnameAssociationGetParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities">certificate_authorities</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities#TLSHostnameAssociation">TLSHostnameAssociation</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="put /zones/{zone_id}/certificate_authorities/hostname_associations">client.CertificateAuthorities.HostnameAssociations.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities#HostnameAssociationService.Update">Update</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities">certificate_authorities</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities#HostnameAssociationUpdateParams">HostnameAssociationUpdateParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities">certificate_authorities</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities#HostnameAssociationUpdateResponse">HostnameAssociationUpdateResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /zones/{zone_id}/certificate_authorities/hostname_associations">client.CertificateAuthorities.HostnameAssociations.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities#HostnameAssociationService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities">certificate_authorities</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities#HostnameAssociationGetParams">HostnameAssociationGetParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities">certificate_authorities</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/certificate_authorities#HostnameAssociationGetResponse">HostnameAssociationGetResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

# ClientCertificates

Expand Down
56 changes: 36 additions & 20 deletions certificate_authorities/hostnameassociation.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func NewHostnameAssociationService(opts ...option.RequestOption) (r *HostnameAss
}

// Replace Hostname Associations
func (r *HostnameAssociationService) Update(ctx context.Context, params HostnameAssociationUpdateParams, opts ...option.RequestOption) (res *TLSHostnameAssociation, err error) {
func (r *HostnameAssociationService) Update(ctx context.Context, params HostnameAssociationUpdateParams, opts ...option.RequestOption) (res *HostnameAssociationUpdateResponse, err error) {
opts = append(r.Options[:], opts...)
var env HostnameAssociationUpdateResponseEnvelope
path := fmt.Sprintf("zones/%s/certificate_authorities/hostname_associations", params.ZoneID)
Expand All @@ -47,7 +47,7 @@ func (r *HostnameAssociationService) Update(ctx context.Context, params Hostname
}

// List Hostname Associations
func (r *HostnameAssociationService) Get(ctx context.Context, params HostnameAssociationGetParams, opts ...option.RequestOption) (res *TLSHostnameAssociation, err error) {
func (r *HostnameAssociationService) Get(ctx context.Context, params HostnameAssociationGetParams, opts ...option.RequestOption) (res *HostnameAssociationGetResponse, err error) {
opts = append(r.Options[:], opts...)
var env HostnameAssociationGetResponseEnvelope
path := fmt.Sprintf("zones/%s/certificate_authorities/hostname_associations", params.ZoneID)
Expand All @@ -59,29 +59,45 @@ func (r *HostnameAssociationService) Get(ctx context.Context, params HostnameAss
return
}

type TLSHostnameAssociation struct {
Hostnames []string `json:"hostnames"`
// The UUID for a certificate that was uploaded to the mTLS Certificate Management
// endpoint. If no mtls_certificate_id is given, the hostnames will be associated
// to your active Cloudflare Managed CA.
MTLSCertificateID string `json:"mtls_certificate_id"`
JSON tlsHostnameAssociationJSON `json:"-"`
type HostnameAssociationUpdateResponse struct {
Hostnames []string `json:"hostnames"`
JSON hostnameAssociationUpdateResponseJSON `json:"-"`
}

// tlsHostnameAssociationJSON contains the JSON metadata for the struct
// [TLSHostnameAssociation]
type tlsHostnameAssociationJSON struct {
Hostnames apijson.Field
MTLSCertificateID apijson.Field
raw string
ExtraFields map[string]apijson.Field
// hostnameAssociationUpdateResponseJSON contains the JSON metadata for the struct
// [HostnameAssociationUpdateResponse]
type hostnameAssociationUpdateResponseJSON struct {
Hostnames apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

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

type HostnameAssociationGetResponse struct {
Hostnames []string `json:"hostnames"`
JSON hostnameAssociationGetResponseJSON `json:"-"`
}

// hostnameAssociationGetResponseJSON contains the JSON metadata for the struct
// [HostnameAssociationGetResponse]
type hostnameAssociationGetResponseJSON struct {
Hostnames apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

func (r tlsHostnameAssociationJSON) RawJSON() string {
func (r hostnameAssociationGetResponseJSON) RawJSON() string {
return r.raw
}

Expand All @@ -102,7 +118,7 @@ func (r HostnameAssociationUpdateParams) MarshalJSON() (data []byte, err error)
type HostnameAssociationUpdateResponseEnvelope struct {
Errors []HostnameAssociationUpdateResponseEnvelopeErrors `json:"errors,required"`
Messages []HostnameAssociationUpdateResponseEnvelopeMessages `json:"messages,required"`
Result TLSHostnameAssociation `json:"result,required"`
Result HostnameAssociationUpdateResponse `json:"result,required"`
// Whether the API call was successful
Success HostnameAssociationUpdateResponseEnvelopeSuccess `json:"success,required"`
JSON hostnameAssociationUpdateResponseEnvelopeJSON `json:"-"`
Expand Down Expand Up @@ -209,7 +225,7 @@ func (r HostnameAssociationGetParams) URLQuery() (v url.Values) {
type HostnameAssociationGetResponseEnvelope struct {
Errors []HostnameAssociationGetResponseEnvelopeErrors `json:"errors,required"`
Messages []HostnameAssociationGetResponseEnvelopeMessages `json:"messages,required"`
Result TLSHostnameAssociation `json:"result,required"`
Result HostnameAssociationGetResponse `json:"result,required"`
// Whether the API call was successful
Success HostnameAssociationGetResponseEnvelopeSuccess `json:"success,required"`
JSON hostnameAssociationGetResponseEnvelopeJSON `json:"-"`
Expand Down

0 comments on commit cdb0efe

Please sign in to comment.