Repository: cloudflare/cloudflare-go
Pull request #3688 (2024-11-29 00:08:27)

feat(leaked_credential_check): add terraform resource


Patch:
diff --git a/api.md b/api.md
index d6772e400..8dd0a2c28 100644
--- a/api.md
+++ b/api.md
@@ -7558,12 +7558,12 @@ Methods:
 Response Types:
 
 - <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3">cloudflare</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3#LeakedCredentialCheckNewResponse">LeakedCredentialCheckNewResponse</a>
-- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3">cloudflare</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3#LeakedCredentialCheckListResponse">LeakedCredentialCheckListResponse</a>
+- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3">cloudflare</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3#LeakedCredentialCheckGetResponse">LeakedCredentialCheckGetResponse</a>
 
 Methods:
 
 - <code title="post /zones/{zone_id}/leaked-credential-checks">client.LeakedCredentialChecks.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3#LeakedCredentialCheckService.New">New</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/v3">cloudflare</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3#LeakedCredentialCheckNewParams">LeakedCredentialCheckNewParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3">cloudflare</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3#LeakedCredentialCheckNewResponse">LeakedCredentialCheckNewResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
-- <code title="get /zones/{zone_id}/leaked-credential-checks">client.LeakedCredentialChecks.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3#LeakedCredentialCheckService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3">cloudflare</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3#LeakedCredentialCheckListParams">LeakedCredentialCheckListParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3">cloudflare</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3#LeakedCredentialCheckListResponse">LeakedCredentialCheckListResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
+- <code title="get /zones/{zone_id}/leaked-credential-checks">client.LeakedCredentialChecks.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3#LeakedCredentialCheckService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3">cloudflare</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3#LeakedCredentialCheckGetParams">LeakedCredentialCheckGetParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3">cloudflare</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3#LeakedCredentialCheckGetResponse">LeakedCredentialCheckGetResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
 
 ## Detections
 
diff --git a/leakedcredentialcheck.go b/leakedcredentialcheck.go
index 16675afe0..ebc609e41 100644
--- a/leakedcredentialcheck.go
+++ b/leakedcredentialcheck.go
@@ -54,8 +54,8 @@ func (r *LeakedCredentialCheckService) New(ctx context.Context, params LeakedCre
 }
 
 // Retrieves the current status of Leaked Credential Checks
-func (r *LeakedCredentialCheckService) List(ctx context.Context, query LeakedCredentialCheckListParams, opts ...option.RequestOption) (res *LeakedCredentialCheckListResponse, err error) {
-	var env LeakedCredentialCheckListResponseEnvelope
+func (r *LeakedCredentialCheckService) Get(ctx context.Context, query LeakedCredentialCheckGetParams, opts ...option.RequestOption) (res *LeakedCredentialCheckGetResponse, err error) {
+	var env LeakedCredentialCheckGetResponseEnvelope
 	opts = append(r.Options[:], opts...)
 	if query.ZoneID.Value == "" {
 		err = errors.New("missing required zone_id parameter")
@@ -94,25 +94,25 @@ func (r leakedCredentialCheckNewResponseJSON) RawJSON() string {
 }
 
 // The overall status for Leaked Credential Checks
-type LeakedCredentialCheckListResponse struct {
+type LeakedCredentialCheckGetResponse struct {
 	// Whether or not Leaked Credential Checks are enabled
-	Enabled bool                                  `json:"enabled"`
-	JSON    leakedCredentialCheckListResponseJSON `json:"-"`
+	Enabled bool                                 `json:"enabled"`
+	JSON    leakedCredentialCheckGetResponseJSON `json:"-"`
 }
 
-// leakedCredentialCheckListResponseJSON contains the JSON metadata for the struct
-// [LeakedCredentialCheckListResponse]
-type leakedCredentialCheckListResponseJSON struct {
+// leakedCredentialCheckGetResponseJSON contains the JSON metadata for the struct
+// [LeakedCredentialCheckGetResponse]
+type leakedCredentialCheckGetResponseJSON struct {
 	Enabled     apijson.Field
 	raw         string
 	ExtraFields map[string]apijson.Field
 }
 
-func (r *LeakedCredentialCheckListResponse) UnmarshalJSON(data []byte) (err error) {
+func (r *LeakedCredentialCheckGetResponse) UnmarshalJSON(data []byte) (err error) {
 	return apijson.UnmarshalRoot(data, r)
 }
 
-func (r leakedCredentialCheckListResponseJSON) RawJSON() string {
+func (r leakedCredentialCheckGetResponseJSON) RawJSON() string {
 	return r.raw
 }
 
@@ -171,24 +171,24 @@ func (r LeakedCredentialCheckNewResponseEnvelopeSuccess) IsKnown() bool {
 	return false
 }
 
-type LeakedCredentialCheckListParams struct {
+type LeakedCredentialCheckGetParams struct {
 	// Identifier
 	ZoneID param.Field[string] `path:"zone_id,required"`
 }
 
-type LeakedCredentialCheckListResponseEnvelope struct {
+type LeakedCredentialCheckGetResponseEnvelope struct {
 	Errors   []shared.ResponseInfo `json:"errors,required"`
 	Messages []shared.ResponseInfo `json:"messages,required"`
 	// The overall status for Leaked Credential Checks
-	Result LeakedCredentialCheckListResponse `json:"result,required"`
+	Result LeakedCredentialCheckGetResponse `json:"result,required"`
 	// Whether the API call was successful
-	Success LeakedCredentialCheckListResponseEnvelopeSuccess `json:"success,required"`
-	JSON    leakedCredentialCheckListResponseEnvelopeJSON    `json:"-"`
+	Success LeakedCredentialCheckGetResponseEnvelopeSuccess `json:"success,required"`
+	JSON    leakedCredentialCheckGetResponseEnvelopeJSON    `json:"-"`
 }
 
-// leakedCredentialCheckListResponseEnvelopeJSON contains the JSON metadata for the
-// struct [LeakedCredentialCheckListResponseEnvelope]
-type leakedCredentialCheckListResponseEnvelopeJSON struct {
+// leakedCredentialCheckGetResponseEnvelopeJSON contains the JSON metadata for the
+// struct [LeakedCredentialCheckGetResponseEnvelope]
+type leakedCredentialCheckGetResponseEnvelopeJSON struct {
 	Errors      apijson.Field
 	Messages    apijson.Field
 	Result      apijson.Field
@@ -197,24 +197,24 @@ type leakedCredentialCheckListResponseEnvelopeJSON struct {
 	ExtraFields map[string]apijson.Field
 }
 
-func (r *LeakedCredentialCheckListResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
+func (r *LeakedCredentialCheckGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) {
 	return apijson.UnmarshalRoot(data, r)
 }
 
-func (r leakedCredentialCheckListResponseEnvelopeJSON) RawJSON() string {
+func (r leakedCredentialCheckGetResponseEnvelopeJSON) RawJSON() string {
 	return r.raw
 }
 
 // Whether the API call was successful
-type LeakedCredentialCheckListResponseEnvelopeSuccess bool
+type LeakedCredentialCheckGetResponseEnvelopeSuccess bool
 
 const (
-	LeakedCredentialCheckListResponseEnvelopeSuccessTrue LeakedCredentialCheckListResponseEnvelopeSuccess = true
+	LeakedCredentialCheckGetResponseEnvelopeSuccessTrue LeakedCredentialCheckGetResponseEnvelopeSuccess = true
 )
 
-func (r LeakedCredentialCheckListResponseEnvelopeSuccess) IsKnown() bool {
+func (r LeakedCredentialCheckGetResponseEnvelopeSuccess) IsKnown() bool {
 	switch r {
-	case LeakedCredentialCheckListResponseEnvelopeSuccessTrue:
+	case LeakedCredentialCheckGetResponseEnvelopeSuccessTrue:
 		return true
 	}
 	return false


Test patch:
diff --git a/leakedcredentialcheck_test.go b/leakedcredentialcheck_test.go
index 998015451..f5ef734ac 100644
--- a/leakedcredentialcheck_test.go
+++ b/leakedcredentialcheck_test.go
@@ -39,7 +39,7 @@ func TestLeakedCredentialCheckNewWithOptionalParams(t *testing.T) {
 	}
 }
 
-func TestLeakedCredentialCheckList(t *testing.T) {
+func TestLeakedCredentialCheckGet(t *testing.T) {
 	baseURL := "http://localhost:4010"
 	if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
 		baseURL = envURL
@@ -52,7 +52,7 @@ func TestLeakedCredentialCheckList(t *testing.T) {
 		option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
 		option.WithAPIEmail("user@example.com"),
 	)
-	_, err := client.LeakedCredentialChecks.List(context.TODO(), cloudflare.LeakedCredentialCheckListParams{
+	_, err := client.LeakedCredentialChecks.Get(context.TODO(), cloudflare.LeakedCredentialCheckGetParams{
 		ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
 	})
 	if err != nil {