|
| 1 | +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | + |
| 3 | +package cloudforce_one |
| 4 | + |
| 5 | +import ( |
| 6 | + "context" |
| 7 | + "errors" |
| 8 | + "fmt" |
| 9 | + "net/http" |
| 10 | + |
| 11 | + "github.com/cloudflare/cloudflare-go/v4/internal/apijson" |
| 12 | + "github.com/cloudflare/cloudflare-go/v4/internal/param" |
| 13 | + "github.com/cloudflare/cloudflare-go/v4/internal/requestconfig" |
| 14 | + "github.com/cloudflare/cloudflare-go/v4/option" |
| 15 | +) |
| 16 | + |
| 17 | +// ThreatEventDatasetHealthService contains methods and other services that help |
| 18 | +// with interacting with the cloudflare API. |
| 19 | +// |
| 20 | +// Note, unlike clients, this service does not read variables from the environment |
| 21 | +// automatically. You should not instantiate this service directly, and instead use |
| 22 | +// the [NewThreatEventDatasetHealthService] method instead. |
| 23 | +type ThreatEventDatasetHealthService struct { |
| 24 | + Options []option.RequestOption |
| 25 | +} |
| 26 | + |
| 27 | +// NewThreatEventDatasetHealthService generates a new service that applies the |
| 28 | +// given options to each request. These options are applied after the parent |
| 29 | +// client's options (if there is one), and before any request-specific options. |
| 30 | +func NewThreatEventDatasetHealthService(opts ...option.RequestOption) (r *ThreatEventDatasetHealthService) { |
| 31 | + r = &ThreatEventDatasetHealthService{} |
| 32 | + r.Options = opts |
| 33 | + return |
| 34 | +} |
| 35 | + |
| 36 | +// Benchmark Durable Object warmup |
| 37 | +func (r *ThreatEventDatasetHealthService) Get(ctx context.Context, datasetID string, query ThreatEventDatasetHealthGetParams, opts ...option.RequestOption) (res *ThreatEventDatasetHealthGetResponse, err error) { |
| 38 | + opts = append(r.Options[:], opts...) |
| 39 | + if !query.AccountID.Present { |
| 40 | + err = errors.New("missing required account_id parameter") |
| 41 | + return |
| 42 | + } |
| 43 | + if datasetID == "" { |
| 44 | + err = errors.New("missing required dataset_id parameter") |
| 45 | + return |
| 46 | + } |
| 47 | + path := fmt.Sprintf("accounts/%v/cloudforce-one/events/dataset/%s/health", query.AccountID, datasetID) |
| 48 | + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) |
| 49 | + return |
| 50 | +} |
| 51 | + |
| 52 | +type ThreatEventDatasetHealthGetResponse struct { |
| 53 | + Items ThreatEventDatasetHealthGetResponseItems `json:"items,required"` |
| 54 | + Type string `json:"type,required"` |
| 55 | + JSON threatEventDatasetHealthGetResponseJSON `json:"-"` |
| 56 | +} |
| 57 | + |
| 58 | +// threatEventDatasetHealthGetResponseJSON contains the JSON metadata for the |
| 59 | +// struct [ThreatEventDatasetHealthGetResponse] |
| 60 | +type threatEventDatasetHealthGetResponseJSON struct { |
| 61 | + Items apijson.Field |
| 62 | + Type apijson.Field |
| 63 | + raw string |
| 64 | + ExtraFields map[string]apijson.Field |
| 65 | +} |
| 66 | + |
| 67 | +func (r *ThreatEventDatasetHealthGetResponse) UnmarshalJSON(data []byte) (err error) { |
| 68 | + return apijson.UnmarshalRoot(data, r) |
| 69 | +} |
| 70 | + |
| 71 | +func (r threatEventDatasetHealthGetResponseJSON) RawJSON() string { |
| 72 | + return r.raw |
| 73 | +} |
| 74 | + |
| 75 | +type ThreatEventDatasetHealthGetResponseItems struct { |
| 76 | + Type string `json:"type,required"` |
| 77 | + JSON threatEventDatasetHealthGetResponseItemsJSON `json:"-"` |
| 78 | +} |
| 79 | + |
| 80 | +// threatEventDatasetHealthGetResponseItemsJSON contains the JSON metadata for the |
| 81 | +// struct [ThreatEventDatasetHealthGetResponseItems] |
| 82 | +type threatEventDatasetHealthGetResponseItemsJSON struct { |
| 83 | + Type apijson.Field |
| 84 | + raw string |
| 85 | + ExtraFields map[string]apijson.Field |
| 86 | +} |
| 87 | + |
| 88 | +func (r *ThreatEventDatasetHealthGetResponseItems) UnmarshalJSON(data []byte) (err error) { |
| 89 | + return apijson.UnmarshalRoot(data, r) |
| 90 | +} |
| 91 | + |
| 92 | +func (r threatEventDatasetHealthGetResponseItemsJSON) RawJSON() string { |
| 93 | + return r.raw |
| 94 | +} |
| 95 | + |
| 96 | +type ThreatEventDatasetHealthGetParams struct { |
| 97 | + // Account ID. |
| 98 | + AccountID param.Field[float64] `path:"account_id,required"` |
| 99 | +} |
0 commit comments