Skip to content

Commit

Permalink
feat(leaked_credential_check): add terraform resource (#3688)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Nov 29, 2024
1 parent 7299dbf commit 0fc715c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
48 changes: 24 additions & 24 deletions leakedcredentialcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions leakedcredentialcheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down

0 comments on commit 0fc715c

Please sign in to comment.