Skip to content

Commit

Permalink
feat(api): api update (#3678)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Nov 26, 2024
1 parent d407746 commit 56a8b59
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1436
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-da11321182930ad0deb0691d0e8e6c3bf9cced28dfb452d612590e86ec13a5a3.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-2c78a7b2b9c6b823fa3394dedc7537f11ecc9c05b381df6dd2066c378d22b617.yml
6 changes: 6 additions & 0 deletions custom_hostnames/customhostname.go
Original file line number Diff line number Diff line change
Expand Up @@ -2011,6 +2011,9 @@ type CustomHostnameNewParamsSSL struct {
BundleMethod param.Field[BundleMethod] `json:"bundle_method"`
// The Certificate Authority that will issue the certificate
CertificateAuthority param.Field[shared.CertificateCA] `json:"certificate_authority"`
// Whether or not to add Cloudflare Branding for the order. This will add a
// subdomain of sni.cloudflaressl.com as the Common Name if set to true
CloudflareBranding param.Field[bool] `json:"cloudflare_branding"`
// If a custom uploaded certificate is used.
CustomCertificate param.Field[string] `json:"custom_certificate"`
// The key for a custom uploaded certificate.
Expand Down Expand Up @@ -2274,6 +2277,9 @@ type CustomHostnameEditParamsSSL struct {
BundleMethod param.Field[BundleMethod] `json:"bundle_method"`
// The Certificate Authority that will issue the certificate
CertificateAuthority param.Field[shared.CertificateCA] `json:"certificate_authority"`
// Whether or not to add Cloudflare Branding for the order. This will add a
// subdomain of sni.cloudflaressl.com as the Common Name if set to true
CloudflareBranding param.Field[bool] `json:"cloudflare_branding"`
// If a custom uploaded certificate is used.
CustomCertificate param.Field[string] `json:"custom_certificate"`
// The key for a custom uploaded certificate.
Expand Down
2 changes: 2 additions & 0 deletions custom_hostnames/customhostname_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func TestCustomHostnameNewWithOptionalParams(t *testing.T) {
SSL: cloudflare.F(custom_hostnames.CustomHostnameNewParamsSSL{
BundleMethod: cloudflare.F(custom_hostnames.BundleMethodUbiquitous),
CertificateAuthority: cloudflare.F(shared.CertificateCADigicert),
CloudflareBranding: cloudflare.F(false),
CustomCertificate: cloudflare.F("-----BEGIN CERTIFICATE-----\\nMIIFJDCCBAygAwIBAgIQD0ifmj/Yi5NP/2gdUySbfzANBgkqhkiG9w0BAQsFADBN\\nMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMScwJQYDVQQDEx5E...SzSHfXp5lnu/3V08I72q1QNzOCgY1XeL4GKVcj4or6cT6tX6oJH7ePPmfrBfqI/O\\nOeH8gMJ+FuwtXYEPa4hBf38M5eU5xWG7\\n-----END CERTIFICATE-----\\n"),
CustomKey: cloudflare.F("-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xdp/\naxiuprIs9JzkYK8Ox0r+dlwCG1kSW+UAbX0bQ/qUqlsTvU6muVuMP8vZYHxJ3wmb\n+uf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aMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n"),
Method: cloudflare.F(custom_hostnames.DCVMethodHTTP),
Expand Down Expand Up @@ -147,6 +148,7 @@ func TestCustomHostnameEditWithOptionalParams(t *testing.T) {
SSL: cloudflare.F(custom_hostnames.CustomHostnameEditParamsSSL{
BundleMethod: cloudflare.F(custom_hostnames.BundleMethodUbiquitous),
CertificateAuthority: cloudflare.F(shared.CertificateCADigicert),
CloudflareBranding: cloudflare.F(false),
CustomCertificate: cloudflare.F("-----BEGIN CERTIFICATE-----\\nMIIFJDCCBAygAwIBAgIQD0ifmj/Yi5NP/2gdUySbfzANBgkqhkiG9w0BAQsFADBN\\nMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMScwJQYDVQQDEx5E...SzSHfXp5lnu/3V08I72q1QNzOCgY1XeL4GKVcj4or6cT6tX6oJH7ePPmfrBfqI/O\\nOeH8gMJ+FuwtXYEPa4hBf38M5eU5xWG7\\n-----END CERTIFICATE-----\\n"),
CustomKey: cloudflare.F("-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xd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\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n"),
Method: cloudflare.F(custom_hostnames.DCVMethodHTTP),
Expand Down
24 changes: 12 additions & 12 deletions origin_ca_certificates/origincacertificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func NewOriginCACertificateService(opts ...option.RequestOption) (r *OriginCACer
return
}

// Create an Origin CA certificate. Use your Origin CA Key as your User Service Key
// when calling this endpoint ([see above](#requests)).
// Create an Origin CA certificate. You can use an Origin CA Key as your User
// Service Key or an API token when calling this endpoint ([see above](#requests)).
func (r *OriginCACertificateService) New(ctx context.Context, body OriginCACertificateNewParams, opts ...option.RequestOption) (res *OriginCACertificate, err error) {
var env OriginCACertificateNewResponseEnvelope
opts = append(r.Options[:], opts...)
Expand All @@ -53,8 +53,8 @@ func (r *OriginCACertificateService) New(ctx context.Context, body OriginCACerti
return
}

// List all existing Origin CA certificates for a given zone. Use your Origin CA
// Key as your User Service Key when calling this endpoint
// List all existing Origin CA certificates for a given zone. You can use an Origin
// CA Key as your User Service Key or an API token when calling this endpoint
// ([see above](#requests)).
func (r *OriginCACertificateService) List(ctx context.Context, query OriginCACertificateListParams, opts ...option.RequestOption) (res *pagination.SinglePage[OriginCACertificate], err error) {
var raw *http.Response
Expand All @@ -73,16 +73,16 @@ func (r *OriginCACertificateService) List(ctx context.Context, query OriginCACer
return res, nil
}

// List all existing Origin CA certificates for a given zone. Use your Origin CA
// Key as your User Service Key when calling this endpoint
// List all existing Origin CA certificates for a given zone. You can use an Origin
// CA Key as your User Service Key or an API token when calling this endpoint
// ([see above](#requests)).
func (r *OriginCACertificateService) ListAutoPaging(ctx context.Context, query OriginCACertificateListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[OriginCACertificate] {
return pagination.NewSinglePageAutoPager(r.List(ctx, query, opts...))
}

// Revoke an existing Origin CA certificate by its serial number. Use your Origin
// CA Key as your User Service Key when calling this endpoint
// ([see above](#requests)).
// Revoke an existing Origin CA certificate by its serial number. You can use an
// Origin CA Key as your User Service Key or an API token when calling this
// endpoint ([see above](#requests)).
func (r *OriginCACertificateService) Delete(ctx context.Context, certificateID string, opts ...option.RequestOption) (res *OriginCACertificateDeleteResponse, err error) {
var env OriginCACertificateDeleteResponseEnvelope
opts = append(r.Options[:], opts...)
Expand All @@ -99,9 +99,9 @@ func (r *OriginCACertificateService) Delete(ctx context.Context, certificateID s
return
}

// Get an existing Origin CA certificate by its serial number. Use your Origin CA
// Key as your User Service Key when calling this endpoint
// ([see above](#requests)).
// Get an existing Origin CA certificate by its serial number. You can use an
// Origin CA Key as your User Service Key or an API token when calling this
// endpoint ([see above](#requests)).
func (r *OriginCACertificateService) Get(ctx context.Context, certificateID string, opts ...option.RequestOption) (res *OriginCACertificate, err error) {
var env OriginCACertificateGetResponseEnvelope
opts = append(r.Options[:], opts...)
Expand Down
24 changes: 13 additions & 11 deletions ssl/certificatepack.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ func (r *CertificatePackService) Delete(ctx context.Context, certificatePackID s
return
}

// For a given zone, restart validation for an advanced certificate pack. This is
// only a validation operation for a Certificate Pack in a validation_timed_out
// status.
// For a given zone, restart validation or add cloudflare branding for an advanced
// certificate pack. The former is only a validation operation for a Certificate
// Pack in a validation_timed_out status.
func (r *CertificatePackService) Edit(ctx context.Context, certificatePackID string, params CertificatePackEditParams, opts ...option.RequestOption) (res *CertificatePackEditResponse, err error) {
var env CertificatePackEditResponseEnvelope
opts = append(r.Options[:], opts...)
Expand Down Expand Up @@ -232,8 +232,8 @@ type CertificatePackNewResponse struct {
// authority specific details or restrictions
// [see this page for more details.](https://developers.cloudflare.com/ssl/reference/certificate-authorities)
CertificateAuthority CertificatePackNewResponseCertificateAuthority `json:"certificate_authority"`
// Whether or not to add Cloudflare Branding for the order. This will add
// sni.cloudflaressl.com as the Common Name if set true.
// Whether or not to add Cloudflare Branding for the order. This will add a
// subdomain of sni.cloudflaressl.com as the Common Name if set to true.
CloudflareBranding bool `json:"cloudflare_branding"`
// Comma separated list of valid host names for the certificate packs. Must contain
// the zone apex, may not contain more than 50 hosts, and may not be empty.
Expand Down Expand Up @@ -372,8 +372,8 @@ type CertificatePackEditResponse struct {
// authority specific details or restrictions
// [see this page for more details.](https://developers.cloudflare.com/ssl/reference/certificate-authorities)
CertificateAuthority CertificatePackEditResponseCertificateAuthority `json:"certificate_authority"`
// Whether or not to add Cloudflare Branding for the order. This will add
// sni.cloudflaressl.com as the Common Name if set true.
// Whether or not to add Cloudflare Branding for the order. This will add a
// subdomain of sni.cloudflaressl.com as the Common Name if set to true.
CloudflareBranding bool `json:"cloudflare_branding"`
// Comma separated list of valid host names for the certificate packs. Must contain
// the zone apex, may not contain more than 50 hosts, and may not be empty.
Expand Down Expand Up @@ -499,8 +499,8 @@ type CertificatePackNewParams struct {
ValidationMethod param.Field[CertificatePackNewParamsValidationMethod] `json:"validation_method,required"`
// Validity Days selected for the order.
ValidityDays param.Field[CertificatePackNewParamsValidityDays] `json:"validity_days,required"`
// Whether or not to add Cloudflare Branding for the order. This will add
// sni.cloudflaressl.com as the Common Name if set true.
// Whether or not to add Cloudflare Branding for the order. This will add a
// subdomain of sni.cloudflaressl.com as the Common Name if set to true.
CloudflareBranding param.Field[bool] `json:"cloudflare_branding"`
}

Expand Down Expand Up @@ -702,11 +702,13 @@ func (r CertificatePackDeleteResponseEnvelopeSuccess) IsKnown() bool {
type CertificatePackEditParams struct {
// Identifier
ZoneID param.Field[string] `path:"zone_id,required"`
Body interface{} `json:"body,required"`
// Whether or not to add Cloudflare Branding for the order. This will add a
// subdomain of sni.cloudflaressl.com as the Common Name if set to true.
CloudflareBranding param.Field[bool] `json:"cloudflare_branding"`
}

func (r CertificatePackEditParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r.Body)
return apijson.MarshalRoot(r)
}

type CertificatePackEditResponseEnvelope struct {
Expand Down
6 changes: 3 additions & 3 deletions ssl/certificatepack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func TestCertificatePackDelete(t *testing.T) {
}
}

func TestCertificatePackEdit(t *testing.T) {
func TestCertificatePackEditWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
Expand All @@ -117,8 +117,8 @@ func TestCertificatePackEdit(t *testing.T) {
context.TODO(),
"023e105f4ecef8ad9ca31a8372d0c353",
ssl.CertificatePackEditParams{
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
Body: map[string]interface{}{},
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
CloudflareBranding: cloudflare.F(false),
},
)
if err != nil {
Expand Down

0 comments on commit 56a8b59

Please sign in to comment.