-
Notifications
You must be signed in to change notification settings - Fork 622
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): add endpoint mappings (#3877)
- Loading branch information
1 parent
82c768f
commit 4005c7a
Showing
52 changed files
with
6,505 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
configured_endpoints: 1504 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-04299b899e2bbf8ba1b4ad96d5e9f9c3e0c9b6246bfeac3f9ab684b855b0e412.yml | ||
configured_endpoints: 1525 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-8973dde42d42a39c8fbc5f3f1eb1328e6ac0c805ca4d3e5920796749ed58eb0a.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
package custom_hostnames | ||
|
||
import ( | ||
"github.com/cloudflare/cloudflare-go/v4/option" | ||
) | ||
|
||
// CertificatePackService contains methods and other services that help with | ||
// interacting with the cloudflare API. | ||
// | ||
// Note, unlike clients, this service does not read variables from the environment | ||
// automatically. You should not instantiate this service directly, and instead use | ||
// the [NewCertificatePackService] method instead. | ||
type CertificatePackService struct { | ||
Options []option.RequestOption | ||
Certificates *CertificatePackCertificateService | ||
} | ||
|
||
// NewCertificatePackService generates a new service that applies the given options | ||
// to each request. These options are applied after the parent client's options (if | ||
// there is one), and before any request-specific options. | ||
func NewCertificatePackService(opts ...option.RequestOption) (r *CertificatePackService) { | ||
r = &CertificatePackService{} | ||
r.Options = opts | ||
r.Certificates = NewCertificatePackCertificateService(opts...) | ||
return | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
package custom_hostnames_test | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
"os" | ||
"testing" | ||
|
||
"github.com/cloudflare/cloudflare-go/v4" | ||
"github.com/cloudflare/cloudflare-go/v4/custom_hostnames" | ||
"github.com/cloudflare/cloudflare-go/v4/internal/testutil" | ||
"github.com/cloudflare/cloudflare-go/v4/option" | ||
) | ||
|
||
func TestCertificatePackCertificateUpdate(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.CustomHostnames.CertificatePack.Certificates.Update( | ||
context.TODO(), | ||
"023e105f4ecef8ad9ca31a8372d0c353", | ||
"023e105f4ecef8ad9ca31a8372d0c353", | ||
"023e105f4ecef8ad9ca31a8372d0c353", | ||
custom_hostnames.CertificatePackCertificateUpdateParams{ | ||
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), | ||
CustomCertificate: cloudflare.F("-----BEGIN CERTIFICATE-----\nMIIDdjCCAl6gAwIBAgIJAPnMg0Fs+/B0MA0GCSqGSIb3DQEBCwUAMFsx...\n-----END CERTIFICATE-----\n"), | ||
CustomKey: cloudflare.F("-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC/SCB5...\n-----END PRIVATE KEY-----\n"), | ||
}, | ||
) | ||
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 TestCertificatePackCertificateDelete(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.CustomHostnames.CertificatePack.Certificates.Delete( | ||
context.TODO(), | ||
"023e105f4ecef8ad9ca31a8372d0c353", | ||
"023e105f4ecef8ad9ca31a8372d0c353", | ||
"023e105f4ecef8ad9ca31a8372d0c353", | ||
custom_hostnames.CertificatePackCertificateDeleteParams{ | ||
ZoneID: 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()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.