From d7f433f1b68c32e2a0f6b3471ddbcd44ef770db9 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 6 Dec 2024 06:59:57 +0000 Subject: [PATCH] Generated v9.0.0 --- CHANGELOG.md | 32 ++ README.md | 19 +- docs/AccessKey.md | 12 + docs/AccessKeyResponse.md | 15 + docs/AclsInComputeApi.md | 4 +- docs/Backend.md | 4 +- docs/BackendApi.md | 16 +- docs/BackendResponse.md | 4 +- docs/BillingUsageMetricsApi.md | 32 +- docs/ComputeAclUpdate.md | 10 + docs/DimensionAttributesCountryStats.md | 12 + docs/DimensionAttributesRate.md | 10 + docs/DimensionBrowser.md | 10 + docs/DimensionContentType.md | 10 + docs/DimensionCountry.md | 10 + docs/DimensionDevice.md | 10 + docs/DimensionOs.md | 10 + docs/DimensionResponse.md | 10 + docs/DimensionStatusCode.md | 10 + docs/DimensionUrl.md | 10 + docs/EnabledProductsApi.md | 10 +- docs/FilterFieldItem.md | 12 + docs/GetLogInsightsResponse.md | 11 + docs/GetLogRecordsResponse.md | 11 + docs/GetLogRecordsResponseMeta.md | 10 + docs/GetLogRecordsResponseMetaFilters.md | 16 + docs/InsightsApi.md | 69 +++ docs/KvStoreItemApi.md | 2 + docs/LogExplorerApi.md | 65 +++ docs/LogInsights.md | 12 + docs/LogInsightsDimensionAttributes.md | 49 ++ docs/LogInsightsDimensions.md | 61 +++ docs/LogInsightsMeta.md | 10 + docs/LogInsightsMetaFilter.md | 14 + docs/LogInsightsValues.md | 65 +++ docs/LogPropertyServiceId.md | 9 + docs/LogRecord.md | 37 ++ docs/LoggingGrafanacloudlogsAdditional.md | 14 + docs/LoggingGrafanacloudlogsApi.md | 259 ++++++++++ docs/LoggingGrafanacloudlogsResponse.md | 23 + docs/ObjectStorageAccessKeysApi.md | 163 ++++++ docs/RealtimeEntryAggregated.md | 10 +- docs/RealtimeMeasurements.md | 10 +- docs/Results.md | 10 +- docs/SetConfiguration.md | 1 + docs/Usagemetric.md | 18 + docs/Usagemetrics.md | 10 + docs/ValueField.md | 59 +++ docs/Values503Responses.md | 12 + docs/ValuesBandwidth.md | 11 + docs/ValuesBrowser.md | 11 + docs/ValuesCacheHitRatio.md | 10 + docs/ValuesCountryStats.md | 12 + docs/ValuesDuration.md | 12 + docs/ValuesMisses.md | 10 + docs/ValuesRate.md | 10 + docs/ValuesRequests.md | 10 + docs/ValuesStatusCodes.md | 12 + lib/fastly.rb | 45 ++ lib/fastly/api/acls_in_compute_api.rb | 6 +- lib/fastly/api/backend_api.rb | 16 +- lib/fastly/api/billing_usage_metrics_api.rb | 87 ++-- lib/fastly/api/enabled_products_api.rb | 20 +- lib/fastly/api/insights_api.rb | 125 +++++ lib/fastly/api/kv_store_item_api.rb | 3 + lib/fastly/api/log_explorer_api.rb | 109 ++++ .../api/logging_grafanacloudlogs_api.rb | 471 +++++++++++++++++ .../api/object_storage_access_keys_api.rb | 263 ++++++++++ lib/fastly/configuration.rb | 68 ++- lib/fastly/models/access_key.rb | 248 +++++++++ lib/fastly/models/access_key_response.rb | 269 ++++++++++ lib/fastly/models/backend.rb | 4 +- lib/fastly/models/backend_response.rb | 4 +- lib/fastly/models/compute_acl_list_entries.rb | 2 +- lib/fastly/models/compute_acl_lookup.rb | 2 +- lib/fastly/models/compute_acl_update.rb | 219 ++++++++ lib/fastly/models/compute_acl_update_entry.rb | 2 +- .../dimension_attributes_country_stats.rb | 237 +++++++++ .../models/dimension_attributes_rate.rb | 217 ++++++++ lib/fastly/models/dimension_browser.rb | 217 ++++++++ lib/fastly/models/dimension_content_type.rb | 217 ++++++++ lib/fastly/models/dimension_country.rb | 217 ++++++++ lib/fastly/models/dimension_device.rb | 217 ++++++++ lib/fastly/models/dimension_os.rb | 217 ++++++++ lib/fastly/models/dimension_response.rb | 217 ++++++++ lib/fastly/models/dimension_status_code.rb | 217 ++++++++ lib/fastly/models/dimension_url.rb | 217 ++++++++ lib/fastly/models/filter_field_item.rb | 271 ++++++++++ .../models/get_log_insights_response.rb | 227 ++++++++ lib/fastly/models/get_log_records_response.rb | 227 ++++++++ .../models/get_log_records_response_meta.rb | 216 ++++++++ .../get_log_records_response_meta_filters.rb | 307 +++++++++++ lib/fastly/models/log_insights.rb | 234 +++++++++ .../log_insights_dimension_attributes.rb | 103 ++++ lib/fastly/models/log_insights_dimensions.rb | 109 ++++ lib/fastly/models/log_insights_meta.rb | 217 ++++++++ lib/fastly/models/log_insights_meta_filter.rb | 284 ++++++++++ lib/fastly/models/log_insights_values.rb | 111 ++++ lib/fastly/models/log_property_service_id.rb | 208 ++++++++ lib/fastly/models/log_record.rb | 486 ++++++++++++++++++ .../logging_grafanacloudlogs_additional.rb | 257 +++++++++ .../logging_grafanacloudlogs_response.rb | 408 +++++++++++++++ .../models/realtime_entry_aggregated.rb | 108 ++-- lib/fastly/models/realtime_measurements.rb | 108 ++-- lib/fastly/models/results.rb | 102 ++-- lib/fastly/models/set_configuration.rb | 18 +- lib/fastly/models/usagemetric.rb | 297 +++++++++++ lib/fastly/models/usagemetrics.rb | 218 ++++++++ lib/fastly/models/value_field.rb | 108 ++++ lib/fastly/models/values503_responses.rb | 237 +++++++++ lib/fastly/models/values_bandwidth.rb | 227 ++++++++ lib/fastly/models/values_browser.rb | 227 ++++++++ lib/fastly/models/values_cache_hit_ratio.rb | 217 ++++++++ lib/fastly/models/values_country_stats.rb | 237 +++++++++ lib/fastly/models/values_duration.rb | 237 +++++++++ lib/fastly/models/values_misses.rb | 217 ++++++++ lib/fastly/models/values_rate.rb | 217 ++++++++ lib/fastly/models/values_requests.rb | 217 ++++++++ lib/fastly/models/values_status_codes.rb | 237 +++++++++ lib/fastly/version.rb | 2 +- sig.json | 2 +- 121 files changed, 12077 insertions(+), 374 deletions(-) create mode 100644 docs/AccessKey.md create mode 100644 docs/AccessKeyResponse.md create mode 100644 docs/ComputeAclUpdate.md create mode 100644 docs/DimensionAttributesCountryStats.md create mode 100644 docs/DimensionAttributesRate.md create mode 100644 docs/DimensionBrowser.md create mode 100644 docs/DimensionContentType.md create mode 100644 docs/DimensionCountry.md create mode 100644 docs/DimensionDevice.md create mode 100644 docs/DimensionOs.md create mode 100644 docs/DimensionResponse.md create mode 100644 docs/DimensionStatusCode.md create mode 100644 docs/DimensionUrl.md create mode 100644 docs/FilterFieldItem.md create mode 100644 docs/GetLogInsightsResponse.md create mode 100644 docs/GetLogRecordsResponse.md create mode 100644 docs/GetLogRecordsResponseMeta.md create mode 100644 docs/GetLogRecordsResponseMetaFilters.md create mode 100644 docs/InsightsApi.md create mode 100644 docs/LogExplorerApi.md create mode 100644 docs/LogInsights.md create mode 100644 docs/LogInsightsDimensionAttributes.md create mode 100644 docs/LogInsightsDimensions.md create mode 100644 docs/LogInsightsMeta.md create mode 100644 docs/LogInsightsMetaFilter.md create mode 100644 docs/LogInsightsValues.md create mode 100644 docs/LogPropertyServiceId.md create mode 100644 docs/LogRecord.md create mode 100644 docs/LoggingGrafanacloudlogsAdditional.md create mode 100644 docs/LoggingGrafanacloudlogsApi.md create mode 100644 docs/LoggingGrafanacloudlogsResponse.md create mode 100644 docs/ObjectStorageAccessKeysApi.md create mode 100644 docs/Usagemetric.md create mode 100644 docs/Usagemetrics.md create mode 100644 docs/ValueField.md create mode 100644 docs/Values503Responses.md create mode 100644 docs/ValuesBandwidth.md create mode 100644 docs/ValuesBrowser.md create mode 100644 docs/ValuesCacheHitRatio.md create mode 100644 docs/ValuesCountryStats.md create mode 100644 docs/ValuesDuration.md create mode 100644 docs/ValuesMisses.md create mode 100644 docs/ValuesRate.md create mode 100644 docs/ValuesRequests.md create mode 100644 docs/ValuesStatusCodes.md create mode 100644 lib/fastly/api/insights_api.rb create mode 100644 lib/fastly/api/log_explorer_api.rb create mode 100644 lib/fastly/api/logging_grafanacloudlogs_api.rb create mode 100644 lib/fastly/api/object_storage_access_keys_api.rb create mode 100644 lib/fastly/models/access_key.rb create mode 100644 lib/fastly/models/access_key_response.rb create mode 100644 lib/fastly/models/compute_acl_update.rb create mode 100644 lib/fastly/models/dimension_attributes_country_stats.rb create mode 100644 lib/fastly/models/dimension_attributes_rate.rb create mode 100644 lib/fastly/models/dimension_browser.rb create mode 100644 lib/fastly/models/dimension_content_type.rb create mode 100644 lib/fastly/models/dimension_country.rb create mode 100644 lib/fastly/models/dimension_device.rb create mode 100644 lib/fastly/models/dimension_os.rb create mode 100644 lib/fastly/models/dimension_response.rb create mode 100644 lib/fastly/models/dimension_status_code.rb create mode 100644 lib/fastly/models/dimension_url.rb create mode 100644 lib/fastly/models/filter_field_item.rb create mode 100644 lib/fastly/models/get_log_insights_response.rb create mode 100644 lib/fastly/models/get_log_records_response.rb create mode 100644 lib/fastly/models/get_log_records_response_meta.rb create mode 100644 lib/fastly/models/get_log_records_response_meta_filters.rb create mode 100644 lib/fastly/models/log_insights.rb create mode 100644 lib/fastly/models/log_insights_dimension_attributes.rb create mode 100644 lib/fastly/models/log_insights_dimensions.rb create mode 100644 lib/fastly/models/log_insights_meta.rb create mode 100644 lib/fastly/models/log_insights_meta_filter.rb create mode 100644 lib/fastly/models/log_insights_values.rb create mode 100644 lib/fastly/models/log_property_service_id.rb create mode 100644 lib/fastly/models/log_record.rb create mode 100644 lib/fastly/models/logging_grafanacloudlogs_additional.rb create mode 100644 lib/fastly/models/logging_grafanacloudlogs_response.rb create mode 100644 lib/fastly/models/usagemetric.rb create mode 100644 lib/fastly/models/usagemetrics.rb create mode 100644 lib/fastly/models/value_field.rb create mode 100644 lib/fastly/models/values503_responses.rb create mode 100644 lib/fastly/models/values_bandwidth.rb create mode 100644 lib/fastly/models/values_browser.rb create mode 100644 lib/fastly/models/values_cache_hit_ratio.rb create mode 100644 lib/fastly/models/values_country_stats.rb create mode 100644 lib/fastly/models/values_duration.rb create mode 100644 lib/fastly/models/values_misses.rb create mode 100644 lib/fastly/models/values_rate.rb create mode 100644 lib/fastly/models/values_requests.rb create mode 100644 lib/fastly/models/values_status_codes.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index cad9d654..6a45b81e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,37 @@ # Changelog +## [v9.0.0](https://github.com/fastly/fastly-ruby/releases/tag/release/v9.0.0) (2024-12-05) + +**Breaking Changes:** + +- fix(udm-domains): Use v1 versioned HTTP endpoints for UDM domains +- fix(historical): Remove references to VCL on Compute metrics +- fix(realtime): Remove references to VCL on Compute metrics +- feat(billing-usage-metrics): Updated to v3 of the API + +**Bug fixes:** + +- fix(acls-in-compute): Corrected shape of `compute-acl-update` model. + +**Enhancements:** + +- feat(object-storage-access-keys): Added Object Storage Access Keys API +- feat(logging-grafanacloudlogs): Added Grafana Cloud Logs Loggin API +- feat(log-explorer): Added Log Explorer API +- feat(insights): Added Insights API +- feat(kv-store-item): Added `consistency` parameter to `get-keys` operation. +- feat(enabled-products): Added `mode` property to `set-configuration`. + +**Documentation:** + +- doc(observability-custom-dashboards): Fix bad link in custom dashboard documentation +- doc(observability-custom-dashboards): Reformat some enums to fix docs rendering +- doc(acls-in-compute): Corrections to descriptions of `compute-acl-lookup`, `compute-acl-list-entries`, + `compute-acl-update-entry`, and `compute-acl-update` structures +- doc(enabled-products): Added support for product ID `log_explorer_insights`. +- doc(enabled-products): Added support for product ID `ddos_protection`. +- doc(backend): Correct spelling in `connect_timeout` and `first_byte_timeout` field descriptions. + ## [v8.9.0](https://github.com/fastly/fastly-ruby/releases/tag/release/v8.9.0) (2024-09-13) **Bug fixes:** diff --git a/README.md b/README.md index 20eb2194..0bbccecc 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ A Ruby client library for interacting with most facets of the [Fastly API](https To install via RubyGems, add the following to your project's `Gemfile`: ```ruby -gem 'fastly', '~> 8.9.0' +gem 'fastly', '~> 9.0.0' ``` Then run `bundle install`. @@ -112,7 +112,7 @@ Class | Method | Description [*Fastly::BillingInvoicesApi*](docs/BillingInvoicesApi.md) | [**get_month_to_date_invoice**](docs/BillingInvoicesApi.md#get_month_to_date_invoice) | Get month-to-date invoice. [*Fastly::BillingInvoicesApi*](docs/BillingInvoicesApi.md) | [**list_invoices**](docs/BillingInvoicesApi.md#list_invoices) | List of invoices. [*Fastly::BillingUsageMetricsApi*](docs/BillingUsageMetricsApi.md) | [**get_service_level_usage**](docs/BillingUsageMetricsApi.md#get_service_level_usage) | Retrieve service-level usage metrics for a product. -[*Fastly::BillingUsageMetricsApi*](docs/BillingUsageMetricsApi.md) | [**get_service_level_usage_types**](docs/BillingUsageMetricsApi.md#get_service_level_usage_types) | Retrieve product usage types for a customer. +[*Fastly::BillingUsageMetricsApi*](docs/BillingUsageMetricsApi.md) | [**get_usage_metrics**](docs/BillingUsageMetricsApi.md#get_usage_metrics) | Get monthly usage metrics [*Fastly::CacheSettingsApi*](docs/CacheSettingsApi.md) | [**create_cache_settings**](docs/CacheSettingsApi.md#create_cache_settings) | Create a cache settings object [*Fastly::CacheSettingsApi*](docs/CacheSettingsApi.md) | [**delete_cache_settings**](docs/CacheSettingsApi.md#delete_cache_settings) | Delete a cache settings object [*Fastly::CacheSettingsApi*](docs/CacheSettingsApi.md) | [**get_cache_settings**](docs/CacheSettingsApi.md#get_cache_settings) | Get a cache settings object @@ -250,6 +250,7 @@ Class | Method | Description [*Fastly::IamUserGroupsApi*](docs/IamUserGroupsApi.md) | [**update_a_user_group**](docs/IamUserGroupsApi.md#update_a_user_group) | Update a user group [*Fastly::ImageOptimizerDefaultSettingsApi*](docs/ImageOptimizerDefaultSettingsApi.md) | [**get_default_settings**](docs/ImageOptimizerDefaultSettingsApi.md#get_default_settings) | Get current Image Optimizer Default Settings [*Fastly::ImageOptimizerDefaultSettingsApi*](docs/ImageOptimizerDefaultSettingsApi.md) | [**update_default_settings**](docs/ImageOptimizerDefaultSettingsApi.md#update_default_settings) | Update Image Optimizer Default Settings +[*Fastly::InsightsApi*](docs/InsightsApi.md) | [**get_log_insights**](docs/InsightsApi.md#get_log_insights) | Retrieve log insights [*Fastly::InvitationsApi*](docs/InvitationsApi.md) | [**create_invitation**](docs/InvitationsApi.md#create_invitation) | Create an invitation [*Fastly::InvitationsApi*](docs/InvitationsApi.md) | [**delete_invitation**](docs/InvitationsApi.md#delete_invitation) | Delete an invitation [*Fastly::InvitationsApi*](docs/InvitationsApi.md) | [**list_invitations**](docs/InvitationsApi.md#list_invitations) | List invitations @@ -289,6 +290,7 @@ Class | Method | Description [*Fastly::LegacyWafTagApi*](docs/LegacyWafTagApi.md) | [**list_legacy_waf_tags**](docs/LegacyWafTagApi.md#list_legacy_waf_tags) | List WAF tags [*Fastly::LegacyWafUpdateStatusApi*](docs/LegacyWafUpdateStatusApi.md) | [**get_waf_update_status**](docs/LegacyWafUpdateStatusApi.md#get_waf_update_status) | Get the status of a WAF update [*Fastly::LegacyWafUpdateStatusApi*](docs/LegacyWafUpdateStatusApi.md) | [**list_waf_update_statuses**](docs/LegacyWafUpdateStatusApi.md#list_waf_update_statuses) | List update statuses +[*Fastly::LogExplorerApi*](docs/LogExplorerApi.md) | [**get_log_records**](docs/LogExplorerApi.md#get_log_records) | Retrieve log records [*Fastly::LoggingAzureblobApi*](docs/LoggingAzureblobApi.md) | [**create_log_azure**](docs/LoggingAzureblobApi.md#create_log_azure) | Create an Azure Blob Storage log endpoint [*Fastly::LoggingAzureblobApi*](docs/LoggingAzureblobApi.md) | [**delete_log_azure**](docs/LoggingAzureblobApi.md#delete_log_azure) | Delete the Azure Blob Storage log endpoint [*Fastly::LoggingAzureblobApi*](docs/LoggingAzureblobApi.md) | [**get_log_azure**](docs/LoggingAzureblobApi.md#get_log_azure) | Get an Azure Blob Storage log endpoint @@ -329,6 +331,11 @@ Class | Method | Description [*Fastly::LoggingGcsApi*](docs/LoggingGcsApi.md) | [**get_log_gcs**](docs/LoggingGcsApi.md#get_log_gcs) | Get a GCS log endpoint [*Fastly::LoggingGcsApi*](docs/LoggingGcsApi.md) | [**list_log_gcs**](docs/LoggingGcsApi.md#list_log_gcs) | List GCS log endpoints [*Fastly::LoggingGcsApi*](docs/LoggingGcsApi.md) | [**update_log_gcs**](docs/LoggingGcsApi.md#update_log_gcs) | Update a GCS log endpoint +[*Fastly::LoggingGrafanacloudlogsApi*](docs/LoggingGrafanacloudlogsApi.md) | [**create_log_grafanacloudlogs**](docs/LoggingGrafanacloudlogsApi.md#create_log_grafanacloudlogs) | Create a Grafana Cloud Logs log endpoint +[*Fastly::LoggingGrafanacloudlogsApi*](docs/LoggingGrafanacloudlogsApi.md) | [**delete_log_grafanacloudlogs**](docs/LoggingGrafanacloudlogsApi.md#delete_log_grafanacloudlogs) | Delete the Grafana Cloud Logs log endpoint +[*Fastly::LoggingGrafanacloudlogsApi*](docs/LoggingGrafanacloudlogsApi.md) | [**get_log_grafanacloudlogs**](docs/LoggingGrafanacloudlogsApi.md#get_log_grafanacloudlogs) | Get a Grafana Cloud Logs log endpoint +[*Fastly::LoggingGrafanacloudlogsApi*](docs/LoggingGrafanacloudlogsApi.md) | [**list_log_grafanacloudlogs**](docs/LoggingGrafanacloudlogsApi.md#list_log_grafanacloudlogs) | List Grafana Cloud Logs log endpoints +[*Fastly::LoggingGrafanacloudlogsApi*](docs/LoggingGrafanacloudlogsApi.md) | [**update_log_grafanacloudlogs**](docs/LoggingGrafanacloudlogsApi.md#update_log_grafanacloudlogs) | Update a Grafana Cloud Logs log endpoint [*Fastly::LoggingHerokuApi*](docs/LoggingHerokuApi.md) | [**create_log_heroku**](docs/LoggingHerokuApi.md#create_log_heroku) | Create a Heroku log endpoint [*Fastly::LoggingHerokuApi*](docs/LoggingHerokuApi.md) | [**delete_log_heroku**](docs/LoggingHerokuApi.md#delete_log_heroku) | Delete the Heroku log endpoint [*Fastly::LoggingHerokuApi*](docs/LoggingHerokuApi.md) | [**get_log_heroku**](docs/LoggingHerokuApi.md#get_log_heroku) | Get a Heroku log endpoint @@ -429,6 +436,10 @@ Class | Method | Description [*Fastly::MutualAuthenticationApi*](docs/MutualAuthenticationApi.md) | [**get_mutual_authentication**](docs/MutualAuthenticationApi.md#get_mutual_authentication) | Get a Mutual Authentication [*Fastly::MutualAuthenticationApi*](docs/MutualAuthenticationApi.md) | [**list_mutual_authentications**](docs/MutualAuthenticationApi.md#list_mutual_authentications) | List Mutual Authentications [*Fastly::MutualAuthenticationApi*](docs/MutualAuthenticationApi.md) | [**patch_mutual_authentication**](docs/MutualAuthenticationApi.md#patch_mutual_authentication) | Update a Mutual Authentication +[*Fastly::ObjectStorageAccessKeysApi*](docs/ObjectStorageAccessKeysApi.md) | [**create_access_key**](docs/ObjectStorageAccessKeysApi.md#create_access_key) | Create an access key +[*Fastly::ObjectStorageAccessKeysApi*](docs/ObjectStorageAccessKeysApi.md) | [**delete_access_key**](docs/ObjectStorageAccessKeysApi.md#delete_access_key) | Delete an access key +[*Fastly::ObjectStorageAccessKeysApi*](docs/ObjectStorageAccessKeysApi.md) | [**get_access_key**](docs/ObjectStorageAccessKeysApi.md#get_access_key) | Get an access key +[*Fastly::ObjectStorageAccessKeysApi*](docs/ObjectStorageAccessKeysApi.md) | [**list_access_keys**](docs/ObjectStorageAccessKeysApi.md#list_access_keys) | List access keys [*Fastly::ObservabilityCustomDashboardsApi*](docs/ObservabilityCustomDashboardsApi.md) | [**create_dashboard**](docs/ObservabilityCustomDashboardsApi.md#create_dashboard) | Create a new dashboard [*Fastly::ObservabilityCustomDashboardsApi*](docs/ObservabilityCustomDashboardsApi.md) | [**delete_dashboard**](docs/ObservabilityCustomDashboardsApi.md#delete_dashboard) | Delete an existing dashboard [*Fastly::ObservabilityCustomDashboardsApi*](docs/ObservabilityCustomDashboardsApi.md) | [**get_dashboard**](docs/ObservabilityCustomDashboardsApi.md#get_dashboard) | Retrieve a dashboard by ID @@ -637,8 +648,8 @@ The fastly-ruby API client currently does not support the following endpoints: - [`/alerts/history`](https://www.fastly.com/documentation/reference/api/observability/alerts/history) (GET) - [`/dns/configurations/{dns_configuration_id}`](https://www.fastly.com/documentation/reference/api/) (DELETE, GET, PATCH) - [`/dns/configurations`](https://www.fastly.com/documentation/reference/api/) (GET, POST) -- [`/domains/{domain_id}`](https://www.fastly.com/documentation/reference/api/) (DELETE, GET, PATCH) -- [`/domains`](https://www.fastly.com/documentation/reference/api/) (GET, POST) +- [`/domains/v1/{domain_id}`](https://www.fastly.com/documentation/reference/api/) (DELETE, GET, PATCH) +- [`/domains/v1`](https://www.fastly.com/documentation/reference/api/) (GET, POST) - [`/notifications/integration-types`](https://developer.fastly.com/reference/api/observability/notification) (GET) - [`/notifications/integrations/{integration_id}/rotateSigningKey`](https://developer.fastly.com/reference/api/observability/notification) (POST) - [`/notifications/integrations/{integration_id}/signingKey`](https://developer.fastly.com/reference/api/observability/notification) (GET) diff --git a/docs/AccessKey.md b/docs/AccessKey.md new file mode 100644 index 00000000..c5aec6b0 --- /dev/null +++ b/docs/AccessKey.md @@ -0,0 +1,12 @@ +# Fastly::AccessKey + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **description** | **String** | A description of the access key. | | +| **permission** | **String** | The permissions granted to an access key. | | +| **buckets** | **Array<String>** | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/AccessKeyResponse.md b/docs/AccessKeyResponse.md new file mode 100644 index 00000000..757ec4ae --- /dev/null +++ b/docs/AccessKeyResponse.md @@ -0,0 +1,15 @@ +# Fastly::AccessKeyResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **access_key** | **String** | Generated access key. | [optional] | +| **secret_key** | **String** | Generated secret key. | [optional] | +| **description** | **String** | Description for the access key. | [optional] | +| **permission** | **String** | Permissions granted to an access key. | [optional] | +| **buckets** | **Array<String>** | | [optional] | +| **created_at** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/AclsInComputeApi.md b/docs/AclsInComputeApi.md index 0fe92734..53a5b72a 100644 --- a/docs/AclsInComputeApi.md +++ b/docs/AclsInComputeApi.md @@ -258,7 +258,7 @@ Update an ACL. api_instance = Fastly::AclsInComputeApi.new opts = { acl_id: 'acl_id_example', # String | - compute_acl_update_entry: [Fastly::ComputeAclUpdateEntry.new], # Array | + compute_acl_update: Fastly::ComputeAclUpdate.new, # ComputeAclUpdate | } begin @@ -274,7 +274,7 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **acl_id** | **String** | | | -| **compute_acl_update_entry** | [**Array<ComputeAclUpdateEntry>**](ComputeAclUpdateEntry.md) | | [optional] | +| **compute_acl_update** | [**ComputeAclUpdate**](ComputeAclUpdate.md) | | [optional] | ### Return type diff --git a/docs/Backend.md b/docs/Backend.md index c7f7117a..e2b08ee8 100644 --- a/docs/Backend.md +++ b/docs/Backend.md @@ -9,8 +9,8 @@ | **between_bytes_timeout** | **Integer** | Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using `bereq.between_bytes_timeout`. | [optional] | | **client_cert** | **String** | Unused. | [optional] | | **comment** | **String** | A freeform descriptive note. | [optional] | -| **connect_timeout** | **Integer** | Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. | [optional] | -| **first_byte_timeout** | **Integer** | Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. | [optional] | +| **connect_timeout** | **Integer** | Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. | [optional] | +| **first_byte_timeout** | **Integer** | Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. | [optional] | | **healthcheck** | **String** | The name of the healthcheck to use with this backend. | [optional] | | **hostname** | **String** | The hostname of the backend. May be used as an alternative to `address` to set the backend location. | [optional] | | **ipv4** | **String** | IPv4 address of the backend. May be used as an alternative to `address` to set the backend location. | [optional] | diff --git a/docs/BackendApi.md b/docs/BackendApi.md index d5b027d8..eee8767f 100644 --- a/docs/BackendApi.md +++ b/docs/BackendApi.md @@ -40,8 +40,8 @@ opts = { between_bytes_timeout: 56, # Integer | Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using `bereq.between_bytes_timeout`. client_cert: 'client_cert_example', # String | Unused. comment: 'comment_example', # String | A freeform descriptive note. - connect_timeout: 56, # Integer | Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. - first_byte_timeout: 56, # Integer | Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. + connect_timeout: 56, # Integer | Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. + first_byte_timeout: 56, # Integer | Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. healthcheck: 'healthcheck_example', # String | The name of the healthcheck to use with this backend. hostname: 'hostname_example', # String | The hostname of the backend. May be used as an alternative to `address` to set the backend location. ipv4: 'ipv4_example', # String | IPv4 address of the backend. May be used as an alternative to `address` to set the backend location. @@ -92,8 +92,8 @@ end | **between_bytes_timeout** | **Integer** | Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using `bereq.between_bytes_timeout`. | [optional] | | **client_cert** | **String** | Unused. | [optional] | | **comment** | **String** | A freeform descriptive note. | [optional] | -| **connect_timeout** | **Integer** | Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. | [optional] | -| **first_byte_timeout** | **Integer** | Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. | [optional] | +| **connect_timeout** | **Integer** | Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. | [optional] | +| **first_byte_timeout** | **Integer** | Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. | [optional] | | **healthcheck** | **String** | The name of the healthcheck to use with this backend. | [optional] | | **hostname** | **String** | The hostname of the backend. May be used as an alternative to `address` to set the backend location. | [optional] | | **ipv4** | **String** | IPv4 address of the backend. May be used as an alternative to `address` to set the backend location. | [optional] | @@ -271,8 +271,8 @@ opts = { between_bytes_timeout: 56, # Integer | Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using `bereq.between_bytes_timeout`. client_cert: 'client_cert_example', # String | Unused. comment: 'comment_example', # String | A freeform descriptive note. - connect_timeout: 56, # Integer | Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. - first_byte_timeout: 56, # Integer | Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. + connect_timeout: 56, # Integer | Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. + first_byte_timeout: 56, # Integer | Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. healthcheck: 'healthcheck_example', # String | The name of the healthcheck to use with this backend. hostname: 'hostname_example', # String | The hostname of the backend. May be used as an alternative to `address` to set the backend location. ipv4: 'ipv4_example', # String | IPv4 address of the backend. May be used as an alternative to `address` to set the backend location. @@ -324,8 +324,8 @@ end | **between_bytes_timeout** | **Integer** | Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using `bereq.between_bytes_timeout`. | [optional] | | **client_cert** | **String** | Unused. | [optional] | | **comment** | **String** | A freeform descriptive note. | [optional] | -| **connect_timeout** | **Integer** | Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. | [optional] | -| **first_byte_timeout** | **Integer** | Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. | [optional] | +| **connect_timeout** | **Integer** | Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. | [optional] | +| **first_byte_timeout** | **Integer** | Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. | [optional] | | **healthcheck** | **String** | The name of the healthcheck to use with this backend. | [optional] | | **hostname** | **String** | The hostname of the backend. May be used as an alternative to `address` to set the backend location. | [optional] | | **ipv4** | **String** | IPv4 address of the backend. May be used as an alternative to `address` to set the backend location. | [optional] | diff --git a/docs/BackendResponse.md b/docs/BackendResponse.md index e4dd3f4a..d96cfa2d 100644 --- a/docs/BackendResponse.md +++ b/docs/BackendResponse.md @@ -9,8 +9,8 @@ | **between_bytes_timeout** | **Integer** | Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using `bereq.between_bytes_timeout`. | [optional] | | **client_cert** | **String** | Unused. | [optional] | | **comment** | **String** | A freeform descriptive note. | [optional] | -| **connect_timeout** | **Integer** | Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. | [optional] | -| **first_byte_timeout** | **Integer** | Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. | [optional] | +| **connect_timeout** | **Integer** | Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. | [optional] | +| **first_byte_timeout** | **Integer** | Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. | [optional] | | **healthcheck** | **String** | The name of the healthcheck to use with this backend. | [optional] | | **hostname** | **String** | The hostname of the backend. May be used as an alternative to `address` to set the backend location. | [optional] | | **ipv4** | **String** | IPv4 address of the backend. May be used as an alternative to `address` to set the backend location. | [optional] | diff --git a/docs/BillingUsageMetricsApi.md b/docs/BillingUsageMetricsApi.md index f14d5f7e..affb58a7 100644 --- a/docs/BillingUsageMetricsApi.md +++ b/docs/BillingUsageMetricsApi.md @@ -13,8 +13,8 @@ api_instance = Fastly::BillingUsageMetricsApi.new Method | HTTP request | Description ------ | ------------ | ----------- -[**get_service_level_usage**](BillingUsageMetricsApi.md#get_service_level_usage) | **GET** /billing/v2/account_customers/{customer_id}/service-usage-metrics | Retrieve service-level usage metrics for a product. -[**get_service_level_usage_types**](BillingUsageMetricsApi.md#get_service_level_usage_types) | **GET** /billing/v2/account_customers/{customer_id}/service-usage-types | Retrieve product usage types for a customer. +[**get_service_level_usage**](BillingUsageMetricsApi.md#get_service_level_usage) | **GET** /billing/v3/service-usage-metrics | Retrieve service-level usage metrics for a product. +[**get_usage_metrics**](BillingUsageMetricsApi.md#get_usage_metrics) | **GET** /billing/v3/usage-metrics | Get monthly usage metrics ## `get_service_level_usage()` @@ -30,12 +30,8 @@ Returns product usage, broken down by service. ```ruby api_instance = Fastly::BillingUsageMetricsApi.new opts = { - customer_id: 'customer_id_example', # String | Alphanumeric string identifying the customer. product_id: 'product_id_example', # String | The product identifier for the metrics returned (e.g., `cdn_usage`). This field is not required for CSV requests. usage_type_name: 'usage_type_name_example', # String | The usage type name for the metrics returned (e.g., `North America Requests`). This field is not required for CSV requests. - time_granularity: 'time_granularity_example', # String | - start_date: '2023-01-01', # String | - end_date: '2023-01-31', # String | start_month: '2023-01', # String | end_month: '2023-03', # String | limit: 'limit_example', # String | Number of results per page. The maximum is 100. @@ -55,12 +51,8 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **customer_id** | **String** | Alphanumeric string identifying the customer. | | | **product_id** | **String** | The product identifier for the metrics returned (e.g., `cdn_usage`). This field is not required for CSV requests. | | | **usage_type_name** | **String** | The usage type name for the metrics returned (e.g., `North America Requests`). This field is not required for CSV requests. | | -| **time_granularity** | **String** | | | -| **start_date** | **String** | | [optional] | -| **end_date** | **String** | | [optional] | | **start_month** | **String** | | [optional] | | **end_month** | **String** | | [optional] | | **limit** | **String** | Number of results per page. The maximum is 100. | [optional][default to '5'] | @@ -72,28 +64,29 @@ end [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) -## `get_service_level_usage_types()` +## `get_usage_metrics()` ```ruby -get_service_level_usage_types(opts): # Retrieve product usage types for a customer. +get_usage_metrics(opts): # Get monthly usage metrics ``` -Returns product usage types reported by the customer's services. +Returns monthly usage metrics for customer by product. ### Examples ```ruby api_instance = Fastly::BillingUsageMetricsApi.new opts = { - customer_id: 'customer_id_example', # String | Alphanumeric string identifying the customer. + start_month: '2023-01', # String | + end_month: '2023-03', # String | } begin - # Retrieve product usage types for a customer. - result = api_instance.get_service_level_usage_types(opts) + # Get monthly usage metrics + result = api_instance.get_usage_metrics(opts) p result rescue Fastly::ApiError => e - puts "Error when calling BillingUsageMetricsApi->get_service_level_usage_types: #{e}" + puts "Error when calling BillingUsageMetricsApi->get_usage_metrics: #{e}" end ``` @@ -101,11 +94,12 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **customer_id** | **String** | Alphanumeric string identifying the customer. | | +| **start_month** | **String** | | [optional] | +| **end_month** | **String** | | [optional] | ### Return type -[**Serviceusagetypes**](Serviceusagetypes.md) +[**Usagemetric**](Usagemetric.md) [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/ComputeAclUpdate.md b/docs/ComputeAclUpdate.md new file mode 100644 index 00000000..e0997394 --- /dev/null +++ b/docs/ComputeAclUpdate.md @@ -0,0 +1,10 @@ +# Fastly::ComputeAclUpdate + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **entries** | [**Array<ComputeAclUpdateEntry>**](ComputeAclUpdateEntry.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/DimensionAttributesCountryStats.md b/docs/DimensionAttributesCountryStats.md new file mode 100644 index 00000000..15aa7cf1 --- /dev/null +++ b/docs/DimensionAttributesCountryStats.md @@ -0,0 +1,12 @@ +# Fastly::DimensionAttributesCountryStats + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **country_chr** | **Float** | The cache hit ratio for the country. | [optional] | +| **country_error_rate** | **Float** | The error rate for the country. | [optional] | +| **country_request_rate** | **Float** | This country's percentage of the total requests. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/DimensionAttributesRate.md b/docs/DimensionAttributesRate.md new file mode 100644 index 00000000..67e54a2c --- /dev/null +++ b/docs/DimensionAttributesRate.md @@ -0,0 +1,10 @@ +# Fastly::DimensionAttributesRate + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rate** | **Float** | The rate at which the value in the current dimension occurs. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/DimensionBrowser.md b/docs/DimensionBrowser.md new file mode 100644 index 00000000..d43670e2 --- /dev/null +++ b/docs/DimensionBrowser.md @@ -0,0 +1,10 @@ +# Fastly::DimensionBrowser + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **browser** | **String** | The client's browser for this dimension. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/DimensionContentType.md b/docs/DimensionContentType.md new file mode 100644 index 00000000..bc19cb1b --- /dev/null +++ b/docs/DimensionContentType.md @@ -0,0 +1,10 @@ +# Fastly::DimensionContentType + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **content_type** | **String** | The content type of the response for this dimension. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/DimensionCountry.md b/docs/DimensionCountry.md new file mode 100644 index 00000000..13f8e479 --- /dev/null +++ b/docs/DimensionCountry.md @@ -0,0 +1,10 @@ +# Fastly::DimensionCountry + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **country** | **String** | The client's country for this dimension. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/DimensionDevice.md b/docs/DimensionDevice.md new file mode 100644 index 00000000..486a6785 --- /dev/null +++ b/docs/DimensionDevice.md @@ -0,0 +1,10 @@ +# Fastly::DimensionDevice + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **device** | **String** | The client's device type for this dimension. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/DimensionOs.md b/docs/DimensionOs.md new file mode 100644 index 00000000..ba078d34 --- /dev/null +++ b/docs/DimensionOs.md @@ -0,0 +1,10 @@ +# Fastly::DimensionOs + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **os** | **String** | The client's operating system for this dimension. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/DimensionResponse.md b/docs/DimensionResponse.md new file mode 100644 index 00000000..a63086f9 --- /dev/null +++ b/docs/DimensionResponse.md @@ -0,0 +1,10 @@ +# Fastly::DimensionResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **response** | **String** | The HTTP reason phrase for this dimension. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/DimensionStatusCode.md b/docs/DimensionStatusCode.md new file mode 100644 index 00000000..73d979e0 --- /dev/null +++ b/docs/DimensionStatusCode.md @@ -0,0 +1,10 @@ +# Fastly::DimensionStatusCode + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **status_code** | **String** | The HTTP response code for this dimension. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/DimensionUrl.md b/docs/DimensionUrl.md new file mode 100644 index 00000000..344406a2 --- /dev/null +++ b/docs/DimensionUrl.md @@ -0,0 +1,10 @@ +# Fastly::DimensionUrl + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **url** | **String** | The URL path for this dimension. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/EnabledProductsApi.md b/docs/EnabledProductsApi.md index 181a49fb..674d1437 100644 --- a/docs/EnabledProductsApi.md +++ b/docs/EnabledProductsApi.md @@ -26,7 +26,7 @@ Method | HTTP request | Description disable_product(opts) # Disable a product ``` -Disable a product on a service. Supported product IDs: `brotli_compression`,`domain_inspector`,`fanout`,`image_optimizer`,`origin_inspector`, `websockets`, `bot_management`, and `ngwaf`. +Disable a product on a service. Supported product IDs: `brotli_compression`,`domain_inspector`,`fanout`,`image_optimizer`,`origin_inspector`, `websockets`, `bot_management`, `ngwaf`, `ddos_protection`, and `log_explorer_insights`. ### Examples @@ -64,7 +64,7 @@ nil (empty response body) enable_product(opts): # Enable a product ``` -Enable a product on a service. Supported product IDs: `brotli_compression`,`domain_inspector`,`fanout`,`image_optimizer`,`origin_inspector`, `websockets`, `bot_management`, and `ngwaf`. +Enable a product on a service. Supported product IDs: `brotli_compression`,`domain_inspector`,`fanout`,`image_optimizer`,`origin_inspector`, `websockets`, `bot_management`, `ngwaf`, `ddos_protection`, and `log_explorer_insights`. ### Examples @@ -105,7 +105,7 @@ end get_enabled_product(opts): # Get enabled product ``` -Get enabled product on a service. Supported product IDs: `brotli_compression`,`domain_inspector`,`fanout`,`image_optimizer`,`origin_inspector`, `websockets`, `bot_management`, and `ngwaf`. +Get enabled product on a service. Supported product IDs: `brotli_compression`,`domain_inspector`,`fanout`,`image_optimizer`,`origin_inspector`, `websockets`, `bot_management`, `ngwaf`, `ddos_protection`, and `log_explorer_insights`. ### Examples @@ -144,7 +144,7 @@ end get_product_configuration(opts): # Get configuration for a product ``` -Get configuration for an enabled product on a service. Supported product IDs: `ngwaf`. +Get configuration for an enabled product on a service. Supported product IDs: `ngwaf` and `ddos_protection`. ### Examples @@ -183,7 +183,7 @@ end set_product_configuration(opts): # Update configuration for a product ``` -Update configuration for an enabled product on a service. Supported product IDs: `ngwaf`. +Update configuration for an enabled product on a service. Supported product IDs: `ngwaf` and `ddos_protection`. ### Examples diff --git a/docs/FilterFieldItem.md b/docs/FilterFieldItem.md new file mode 100644 index 00000000..8acbe9eb --- /dev/null +++ b/docs/FilterFieldItem.md @@ -0,0 +1,12 @@ +# Fastly::FilterFieldItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **field** | **String** | The log field to which this filter should be applied. | [optional] | +| **operator** | **String** | The comparison operator used for this filter. | [optional] | +| **value** | [**ValueField**](ValueField.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/GetLogInsightsResponse.md b/docs/GetLogInsightsResponse.md new file mode 100644 index 00000000..7eb03daf --- /dev/null +++ b/docs/GetLogInsightsResponse.md @@ -0,0 +1,11 @@ +# Fastly::GetLogInsightsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<LogInsights>**](LogInsights.md) | | [optional] | +| **meta** | [**LogInsightsMeta**](LogInsightsMeta.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/GetLogRecordsResponse.md b/docs/GetLogRecordsResponse.md new file mode 100644 index 00000000..e3572e44 --- /dev/null +++ b/docs/GetLogRecordsResponse.md @@ -0,0 +1,11 @@ +# Fastly::GetLogRecordsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<LogRecord>**](LogRecord.md) | | [optional] | +| **meta** | [**GetLogRecordsResponseMeta**](GetLogRecordsResponseMeta.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/GetLogRecordsResponseMeta.md b/docs/GetLogRecordsResponseMeta.md new file mode 100644 index 00000000..fe6c901e --- /dev/null +++ b/docs/GetLogRecordsResponseMeta.md @@ -0,0 +1,10 @@ +# Fastly::GetLogRecordsResponseMeta + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **filters** | [**GetLogRecordsResponseMetaFilters**](GetLogRecordsResponseMetaFilters.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/GetLogRecordsResponseMetaFilters.md b/docs/GetLogRecordsResponseMetaFilters.md new file mode 100644 index 00000000..fa63b000 --- /dev/null +++ b/docs/GetLogRecordsResponseMetaFilters.md @@ -0,0 +1,16 @@ +# Fastly::GetLogRecordsResponseMetaFilters + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **service_id** | **String** | Specifies the ID of the service for which data should be returned. | [optional] | +| **start** | **String** | Start time for the query as supplied in the request. | [optional] | +| **_end** | **String** | End time for the query as supplied in the request. | [optional] | +| **domain_exact_match** | **Boolean** | Value of the `domain_exact_match` filter as supplied in the request. | [optional] | +| **limit** | **Integer** | Number of records per page. | [optional][default to 20] | +| **next_cursor** | **String** | A cursor to specify the next page of results, if any. | [optional] | +| **filter_fields** | [**Array<FilterFieldItem>**](FilterFieldItem.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/InsightsApi.md b/docs/InsightsApi.md new file mode 100644 index 00000000..2dc227fe --- /dev/null +++ b/docs/InsightsApi.md @@ -0,0 +1,69 @@ +# Fastly::InsightsApi + + +```ruby +require 'fastly' +api_instance = Fastly::InsightsApi.new +``` + +## Methods + +> [!NOTE] +> All URIs are relative to `https://api.fastly.com` + +Method | HTTP request | Description +------ | ------------ | ----------- +[**get_log_insights**](InsightsApi.md#get_log_insights) | **GET** /observability/log-insights | Retrieve log insights + + +## `get_log_insights()` + +```ruby +get_log_insights(opts): # Retrieve log insights +``` + +Retrieves statistics from sampled log records. + +### Examples + +```ruby +api_instance = Fastly::InsightsApi.new +opts = { + visualization: 'top-url-by-bandwidth', # String | + service_id: 'service_id_example', # String | + start: 'start_example', # String | + _end: '_end_example', # String | + pops: 'pops_example', # String | + domain: 'domain_example', # String | + domain_exact_match: true, # Boolean | + limit: 8.14, # Float | +} + +begin + # Retrieve log insights + result = api_instance.get_log_insights(opts) + p result +rescue Fastly::ApiError => e + puts "Error when calling InsightsApi->get_log_insights: #{e}" +end +``` + +### Options + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **visualization** | **String** | | | +| **service_id** | **String** | | | +| **start** | **String** | | | +| **_end** | **String** | | | +| **pops** | **String** | | [optional] | +| **domain** | **String** | | [optional] | +| **domain_exact_match** | **Boolean** | | [optional] | +| **limit** | **Float** | | [optional] | + +### Return type + +[**GetLogInsightsResponse**](GetLogInsightsResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) diff --git a/docs/KvStoreItemApi.md b/docs/KvStoreItemApi.md index 634ec989..7032844b 100644 --- a/docs/KvStoreItemApi.md +++ b/docs/KvStoreItemApi.md @@ -74,6 +74,7 @@ opts = { cursor: 'cursor_example', # String | limit: 56, # Integer | prefix: 'prefix_example', # String | + consistency: 'consistency_example', # String | } begin @@ -93,6 +94,7 @@ end | **cursor** | **String** | | [optional] | | **limit** | **Integer** | | [optional][default to 100] | | **prefix** | **String** | | [optional] | +| **consistency** | **String** | | [optional] | ### Return type diff --git a/docs/LogExplorerApi.md b/docs/LogExplorerApi.md new file mode 100644 index 00000000..7b721755 --- /dev/null +++ b/docs/LogExplorerApi.md @@ -0,0 +1,65 @@ +# Fastly::LogExplorerApi + + +```ruby +require 'fastly' +api_instance = Fastly::LogExplorerApi.new +``` + +## Methods + +> [!NOTE] +> All URIs are relative to `https://api.fastly.com` + +Method | HTTP request | Description +------ | ------------ | ----------- +[**get_log_records**](LogExplorerApi.md#get_log_records) | **GET** /observability/log-explorer | Retrieve log records + + +## `get_log_records()` + +```ruby +get_log_records(opts): # Retrieve log records +``` + +Retrieves log records. + +### Examples + +```ruby +api_instance = Fastly::LogExplorerApi.new +opts = { + service_id: 'service_id_example', # String | + start: 'start_example', # String | + _end: '_end_example', # String | + limit: 8.14, # Float | + next_cursor: 'next_cursor_example', # String | + filter: 'filter_example', # String | +} + +begin + # Retrieve log records + result = api_instance.get_log_records(opts) + p result +rescue Fastly::ApiError => e + puts "Error when calling LogExplorerApi->get_log_records: #{e}" +end +``` + +### Options + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **service_id** | **String** | | | +| **start** | **String** | | | +| **_end** | **String** | | | +| **limit** | **Float** | | [optional] | +| **next_cursor** | **String** | | [optional] | +| **filter** | **String** | | [optional] | + +### Return type + +[**GetLogRecordsResponse**](GetLogRecordsResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) diff --git a/docs/LogInsights.md b/docs/LogInsights.md new file mode 100644 index 00000000..ecdf473f --- /dev/null +++ b/docs/LogInsights.md @@ -0,0 +1,12 @@ +# Fastly::LogInsights + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **dimensions** | [**LogInsightsDimensions**](LogInsightsDimensions.md) | | [optional] | +| **dimension_attributes** | [**LogInsightsDimensionAttributes**](LogInsightsDimensionAttributes.md) | | [optional] | +| **values** | [**LogInsightsValues**](LogInsightsValues.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/LogInsightsDimensionAttributes.md b/docs/LogInsightsDimensionAttributes.md new file mode 100644 index 00000000..fb18d8d9 --- /dev/null +++ b/docs/LogInsightsDimensionAttributes.md @@ -0,0 +1,49 @@ +# Fastly::LogInsightsDimensionAttributes + +## Class instance methods + +### `fastly_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'fastly' + +Fastly::LogInsightsDimensionAttributes.fastly_one_of +# => +# [ +# :'DimensionAttributesCountryStats', +# :'DimensionAttributesRate' +# ] +``` + +### build + +Find the appropriate object from the `fastly_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'fastly' + +Fastly::LogInsightsDimensionAttributes.build(data) +# => # + +Fastly::LogInsightsDimensionAttributes.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `DimensionAttributesCountryStats` +- `DimensionAttributesRate` +- `nil` (if no type matches) + diff --git a/docs/LogInsightsDimensions.md b/docs/LogInsightsDimensions.md new file mode 100644 index 00000000..b6ff11b2 --- /dev/null +++ b/docs/LogInsightsDimensions.md @@ -0,0 +1,61 @@ +# Fastly::LogInsightsDimensions + +## Class instance methods + +### `fastly_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'fastly' + +Fastly::LogInsightsDimensions.fastly_one_of +# => +# [ +# :'DimensionBrowser', +# :'DimensionContentType', +# :'DimensionCountry', +# :'DimensionDevice', +# :'DimensionOs', +# :'DimensionResponse', +# :'DimensionStatusCode', +# :'DimensionUrl' +# ] +``` + +### build + +Find the appropriate object from the `fastly_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'fastly' + +Fastly::LogInsightsDimensions.build(data) +# => # + +Fastly::LogInsightsDimensions.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `DimensionBrowser` +- `DimensionContentType` +- `DimensionCountry` +- `DimensionDevice` +- `DimensionOs` +- `DimensionResponse` +- `DimensionStatusCode` +- `DimensionUrl` +- `nil` (if no type matches) + diff --git a/docs/LogInsightsMeta.md b/docs/LogInsightsMeta.md new file mode 100644 index 00000000..02790afa --- /dev/null +++ b/docs/LogInsightsMeta.md @@ -0,0 +1,10 @@ +# Fastly::LogInsightsMeta + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **filters** | [**LogInsightsMetaFilter**](LogInsightsMetaFilter.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/LogInsightsMetaFilter.md b/docs/LogInsightsMetaFilter.md new file mode 100644 index 00000000..df8b586d --- /dev/null +++ b/docs/LogInsightsMetaFilter.md @@ -0,0 +1,14 @@ +# Fastly::LogInsightsMetaFilter + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **service_id** | **String** | Specifies the ID of the service for which data should be returned. | [optional] | +| **start** | **String** | Start time for the query as supplied in the request. | [optional] | +| **_end** | **String** | End time for the query as supplied in the request. | [optional] | +| **domain_exact_match** | **Boolean** | Value of the `domain_exact_match` filter as supplied in the request. | [optional] | +| **limit** | **Integer** | Number of records per page. | [optional][default to 20] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/LogInsightsValues.md b/docs/LogInsightsValues.md new file mode 100644 index 00000000..a15ea513 --- /dev/null +++ b/docs/LogInsightsValues.md @@ -0,0 +1,65 @@ +# Fastly::LogInsightsValues + +## Class instance methods + +### `fastly_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'fastly' + +Fastly::LogInsightsValues.fastly_one_of +# => +# [ +# :'Values503Responses', +# :'ValuesBandwidth', +# :'ValuesBrowser', +# :'ValuesCacheHitRatio', +# :'ValuesCountryStats', +# :'ValuesDuration', +# :'ValuesMisses', +# :'ValuesRate', +# :'ValuesRequests', +# :'ValuesStatusCodes' +# ] +``` + +### build + +Find the appropriate object from the `fastly_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'fastly' + +Fastly::LogInsightsValues.build(data) +# => # + +Fastly::LogInsightsValues.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `Values503Responses` +- `ValuesBandwidth` +- `ValuesBrowser` +- `ValuesCacheHitRatio` +- `ValuesCountryStats` +- `ValuesDuration` +- `ValuesMisses` +- `ValuesRate` +- `ValuesRequests` +- `ValuesStatusCodes` +- `nil` (if no type matches) + diff --git a/docs/LogPropertyServiceId.md b/docs/LogPropertyServiceId.md new file mode 100644 index 00000000..12f1d609 --- /dev/null +++ b/docs/LogPropertyServiceId.md @@ -0,0 +1,9 @@ +# Fastly::LogPropertyServiceId + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/LogRecord.md b/docs/LogRecord.md new file mode 100644 index 00000000..3885e204 --- /dev/null +++ b/docs/LogRecord.md @@ -0,0 +1,37 @@ +# Fastly::LogRecord + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **customer_id** | **String** | The ID of the Fastly customer that owns the service. | [optional][readonly] | +| **service_id** | [**LogPropertyServiceId**](LogPropertyServiceId.md) | | [optional] | +| **timestamp** | **Time** | Timestamp of the request in ISO 8601 format. | [optional] | +| **client_as_number** | **Integer** | The autonomous system (AS) number of the client. | [optional][readonly] | +| **client_region** | **String** | The client's country subdivision code as found in ISO 3166-2. | [optional][readonly] | +| **client_country_code** | **String** | The two-letter ISO 3166-1 country code for the client. | [optional][readonly] | +| **client_os_name** | **String** | The name of the operating system installed on the client device. | [optional][readonly] | +| **client_device_type** | **String** | The type of the client's device. | [optional][readonly] | +| **client_browser_name** | **String** | The name of the browser in use on the client device. | [optional][readonly] | +| **client_browser_version** | **String** | The version of the browser in use on client device. | [optional][readonly] | +| **fastly_pop** | **String** | The name of the Fastly POP that served this request. | [optional][readonly] | +| **origin_host** | **String** | The name of the origin host that served this request. | [optional][readonly] | +| **request_protocol** | **String** | HTTP protocol version in use for this request. For example, HTTP/1.1. | [optional][readonly] | +| **request_host** | **String** | The name of the request host used for this request. | [optional][readonly] | +| **request_path** | **String** | The URL path supplied for this request. | [optional][readonly] | +| **request_method** | **String** | HTTP method sent by the client such as \"GET\" or \"POST\". | [optional][readonly] | +| **response_bytes_body** | **Integer** | Body bytes sent to the client in the response. | [optional][readonly] | +| **response_bytes_header** | **Integer** | Header bytes sent to the client in the response. | [optional][readonly] | +| **response_content_length** | **Integer** | Total bytes sent to the client in the response. | [optional][readonly] | +| **response_content_type** | **String** | The content type of the response sent to the client. | [optional][readonly] | +| **response_reason** | **String** | The HTTP reason phrase returned for this request, if any. | [optional][readonly] | +| **response_state** | **String** | The state of the request with optional suffixes describing special cases. | [optional][readonly] | +| **response_status** | **Integer** | The HTTP response code returned for this request. | [optional][readonly] | +| **response_time** | **Float** | The time since the request started in seconds. | [optional][readonly] | +| **response_x_cache** | **String** | Indicates whether the request was a HIT or a MISS. | [optional][readonly] | +| **is_cache_hit** | **Boolean** | Indicates whether this request was fulfilled from cache. | [optional][readonly] | +| **is_edge** | **Boolean** | Indicates whether the request was handled by a Fastly edge POP. | [optional][readonly] | +| **is_shield** | **Boolean** | Indicates whether the request was handled by a Fastly shield POP. | [optional][readonly] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/LoggingGrafanacloudlogsAdditional.md b/docs/LoggingGrafanacloudlogsAdditional.md new file mode 100644 index 00000000..90198521 --- /dev/null +++ b/docs/LoggingGrafanacloudlogsAdditional.md @@ -0,0 +1,14 @@ +# Fastly::LoggingGrafanacloudlogsAdditional + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **format** | **String** | A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). | [optional] | +| **user** | **String** | The Grafana Cloud Logs Dataset you want to log to. | [optional] | +| **url** | **String** | The URL of the Loki instance in your Grafana stack. | [optional] | +| **token** | **String** | The Grafana Access Policy token with `logs:write` access scoped to your Loki instance. | [optional] | +| **index** | **String** | The Stream Labels, a JSON string used to identify the stream. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/LoggingGrafanacloudlogsApi.md b/docs/LoggingGrafanacloudlogsApi.md new file mode 100644 index 00000000..d9252195 --- /dev/null +++ b/docs/LoggingGrafanacloudlogsApi.md @@ -0,0 +1,259 @@ +# Fastly::LoggingGrafanacloudlogsApi + + +```ruby +require 'fastly' +api_instance = Fastly::LoggingGrafanacloudlogsApi.new +``` + +## Methods + +> [!NOTE] +> All URIs are relative to `https://api.fastly.com` + +Method | HTTP request | Description +------ | ------------ | ----------- +[**create_log_grafanacloudlogs**](LoggingGrafanacloudlogsApi.md#create_log_grafanacloudlogs) | **POST** /service/{service_id}/version/{version_id}/logging/grafanacloudlogs | Create a Grafana Cloud Logs log endpoint +[**delete_log_grafanacloudlogs**](LoggingGrafanacloudlogsApi.md#delete_log_grafanacloudlogs) | **DELETE** /service/{service_id}/version/{version_id}/logging/grafanacloudlogs/{logging_grafanacloudlogs_name} | Delete the Grafana Cloud Logs log endpoint +[**get_log_grafanacloudlogs**](LoggingGrafanacloudlogsApi.md#get_log_grafanacloudlogs) | **GET** /service/{service_id}/version/{version_id}/logging/grafanacloudlogs/{logging_grafanacloudlogs_name} | Get a Grafana Cloud Logs log endpoint +[**list_log_grafanacloudlogs**](LoggingGrafanacloudlogsApi.md#list_log_grafanacloudlogs) | **GET** /service/{service_id}/version/{version_id}/logging/grafanacloudlogs | List Grafana Cloud Logs log endpoints +[**update_log_grafanacloudlogs**](LoggingGrafanacloudlogsApi.md#update_log_grafanacloudlogs) | **PUT** /service/{service_id}/version/{version_id}/logging/grafanacloudlogs/{logging_grafanacloudlogs_name} | Update a Grafana Cloud Logs log endpoint + + +## `create_log_grafanacloudlogs()` + +```ruby +create_log_grafanacloudlogs(opts): # Create a Grafana Cloud Logs log endpoint +``` + +Create a Grafana Cloud Logs logging object for a particular service and version. + +### Examples + +```ruby +api_instance = Fastly::LoggingGrafanacloudlogsApi.new +opts = { + service_id: 'service_id_example', # String | Alphanumeric string identifying the service. + version_id: 56, # Integer | Integer identifying a service version. + name: 'name_example', # String | The name for the real-time logging configuration. + placement: 'none', # String | Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. + response_condition: 'response_condition_example', # String | The name of an existing condition in the configured endpoint, or leave blank to always execute. + format: 'format_example', # String | A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). + format_version: 1, # Integer | The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. + user: 'user_example', # String | The Grafana Cloud Logs Dataset you want to log to. + url: 'url_example', # String | The URL of the Loki instance in your Grafana stack. + token: 'token_example', # String | The Grafana Access Policy token with `logs:write` access scoped to your Loki instance. + index: 'index_example', # String | The Stream Labels, a JSON string used to identify the stream. +} + +begin + # Create a Grafana Cloud Logs log endpoint + result = api_instance.create_log_grafanacloudlogs(opts) + p result +rescue Fastly::ApiError => e + puts "Error when calling LoggingGrafanacloudlogsApi->create_log_grafanacloudlogs: #{e}" +end +``` + +### Options + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **service_id** | **String** | Alphanumeric string identifying the service. | | +| **version_id** | **Integer** | Integer identifying a service version. | | +| **name** | **String** | The name for the real-time logging configuration. | [optional] | +| **placement** | **String** | Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. | [optional] | +| **response_condition** | **String** | The name of an existing condition in the configured endpoint, or leave blank to always execute. | [optional] | +| **format** | **String** | A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). | [optional] | +| **format_version** | **Integer** | The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. | [optional][default to FORMAT_VERSION::v2] | +| **user** | **String** | The Grafana Cloud Logs Dataset you want to log to. | [optional] | +| **url** | **String** | The URL of the Loki instance in your Grafana stack. | [optional] | +| **token** | **String** | The Grafana Access Policy token with `logs:write` access scoped to your Loki instance. | [optional] | +| **index** | **String** | The Stream Labels, a JSON string used to identify the stream. | [optional] | + +### Return type + +[**LoggingGrafanacloudlogsResponse**](LoggingGrafanacloudlogsResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) +## `delete_log_grafanacloudlogs()` + +```ruby +delete_log_grafanacloudlogs(opts): # Delete the Grafana Cloud Logs log endpoint +``` + +Delete the Grafana Cloud Logs logging object for a particular service and version. + +### Examples + +```ruby +api_instance = Fastly::LoggingGrafanacloudlogsApi.new +opts = { + service_id: 'service_id_example', # String | Alphanumeric string identifying the service. + version_id: 56, # Integer | Integer identifying a service version. + logging_grafanacloudlogs_name: 'logging_grafanacloudlogs_name_example', # String | The name for the real-time logging configuration. +} + +begin + # Delete the Grafana Cloud Logs log endpoint + result = api_instance.delete_log_grafanacloudlogs(opts) + p result +rescue Fastly::ApiError => e + puts "Error when calling LoggingGrafanacloudlogsApi->delete_log_grafanacloudlogs: #{e}" +end +``` + +### Options + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **service_id** | **String** | Alphanumeric string identifying the service. | | +| **version_id** | **Integer** | Integer identifying a service version. | | +| **logging_grafanacloudlogs_name** | **String** | The name for the real-time logging configuration. | | + +### Return type + +[**InlineResponse200**](InlineResponse200.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) +## `get_log_grafanacloudlogs()` + +```ruby +get_log_grafanacloudlogs(opts): # Get a Grafana Cloud Logs log endpoint +``` + +Get the details of a Grafana Cloud Logs logging object for a particular service and version. + +### Examples + +```ruby +api_instance = Fastly::LoggingGrafanacloudlogsApi.new +opts = { + service_id: 'service_id_example', # String | Alphanumeric string identifying the service. + version_id: 56, # Integer | Integer identifying a service version. + logging_grafanacloudlogs_name: 'logging_grafanacloudlogs_name_example', # String | The name for the real-time logging configuration. +} + +begin + # Get a Grafana Cloud Logs log endpoint + result = api_instance.get_log_grafanacloudlogs(opts) + p result +rescue Fastly::ApiError => e + puts "Error when calling LoggingGrafanacloudlogsApi->get_log_grafanacloudlogs: #{e}" +end +``` + +### Options + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **service_id** | **String** | Alphanumeric string identifying the service. | | +| **version_id** | **Integer** | Integer identifying a service version. | | +| **logging_grafanacloudlogs_name** | **String** | The name for the real-time logging configuration. | | + +### Return type + +[**LoggingGrafanacloudlogsResponse**](LoggingGrafanacloudlogsResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) +## `list_log_grafanacloudlogs()` + +```ruby +list_log_grafanacloudlogs(opts): > # List Grafana Cloud Logs log endpoints +``` + +List all of the Grafana Cloud Logs logging objects for a particular service and version. + +### Examples + +```ruby +api_instance = Fastly::LoggingGrafanacloudlogsApi.new +opts = { + service_id: 'service_id_example', # String | Alphanumeric string identifying the service. + version_id: 56, # Integer | Integer identifying a service version. +} + +begin + # List Grafana Cloud Logs log endpoints + result = api_instance.list_log_grafanacloudlogs(opts) + p result +rescue Fastly::ApiError => e + puts "Error when calling LoggingGrafanacloudlogsApi->list_log_grafanacloudlogs: #{e}" +end +``` + +### Options + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **service_id** | **String** | Alphanumeric string identifying the service. | | +| **version_id** | **Integer** | Integer identifying a service version. | | + +### Return type + +[**Array<LoggingGrafanacloudlogsResponse>**](LoggingGrafanacloudlogsResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) +## `update_log_grafanacloudlogs()` + +```ruby +update_log_grafanacloudlogs(opts): # Update a Grafana Cloud Logs log endpoint +``` + +Update a Grafana Cloud Logs logging object for a particular service and version. + +### Examples + +```ruby +api_instance = Fastly::LoggingGrafanacloudlogsApi.new +opts = { + service_id: 'service_id_example', # String | Alphanumeric string identifying the service. + version_id: 56, # Integer | Integer identifying a service version. + logging_grafanacloudlogs_name: 'logging_grafanacloudlogs_name_example', # String | The name for the real-time logging configuration. + name: 'name_example', # String | The name for the real-time logging configuration. + placement: 'none', # String | Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. + response_condition: 'response_condition_example', # String | The name of an existing condition in the configured endpoint, or leave blank to always execute. + format: 'format_example', # String | A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). + format_version: 1, # Integer | The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. + user: 'user_example', # String | The Grafana Cloud Logs Dataset you want to log to. + url: 'url_example', # String | The URL of the Loki instance in your Grafana stack. + token: 'token_example', # String | The Grafana Access Policy token with `logs:write` access scoped to your Loki instance. + index: 'index_example', # String | The Stream Labels, a JSON string used to identify the stream. +} + +begin + # Update a Grafana Cloud Logs log endpoint + result = api_instance.update_log_grafanacloudlogs(opts) + p result +rescue Fastly::ApiError => e + puts "Error when calling LoggingGrafanacloudlogsApi->update_log_grafanacloudlogs: #{e}" +end +``` + +### Options + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **service_id** | **String** | Alphanumeric string identifying the service. | | +| **version_id** | **Integer** | Integer identifying a service version. | | +| **logging_grafanacloudlogs_name** | **String** | The name for the real-time logging configuration. | | +| **name** | **String** | The name for the real-time logging configuration. | [optional] | +| **placement** | **String** | Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. | [optional] | +| **response_condition** | **String** | The name of an existing condition in the configured endpoint, or leave blank to always execute. | [optional] | +| **format** | **String** | A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). | [optional] | +| **format_version** | **Integer** | The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. | [optional][default to FORMAT_VERSION::v2] | +| **user** | **String** | The Grafana Cloud Logs Dataset you want to log to. | [optional] | +| **url** | **String** | The URL of the Loki instance in your Grafana stack. | [optional] | +| **token** | **String** | The Grafana Access Policy token with `logs:write` access scoped to your Loki instance. | [optional] | +| **index** | **String** | The Stream Labels, a JSON string used to identify the stream. | [optional] | + +### Return type + +[**LoggingGrafanacloudlogsResponse**](LoggingGrafanacloudlogsResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) diff --git a/docs/LoggingGrafanacloudlogsResponse.md b/docs/LoggingGrafanacloudlogsResponse.md new file mode 100644 index 00000000..3ddcad52 --- /dev/null +++ b/docs/LoggingGrafanacloudlogsResponse.md @@ -0,0 +1,23 @@ +# Fastly::LoggingGrafanacloudlogsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | The name for the real-time logging configuration. | [optional] | +| **placement** | **String** | Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. | [optional] | +| **response_condition** | **String** | The name of an existing condition in the configured endpoint, or leave blank to always execute. | [optional] | +| **format** | **String** | A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). | [optional] | +| **format_version** | **String** | The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. | [optional][default to '2'] | +| **user** | **String** | The Grafana Cloud Logs Dataset you want to log to. | [optional] | +| **url** | **String** | The URL of the Loki instance in your Grafana stack. | [optional] | +| **token** | **String** | The Grafana Access Policy token with `logs:write` access scoped to your Loki instance. | [optional] | +| **index** | **String** | The Stream Labels, a JSON string used to identify the stream. | [optional] | +| **created_at** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] | +| **deleted_at** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] | +| **updated_at** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] | +| **service_id** | **String** | | [optional][readonly] | +| **version** | **String** | | [optional][readonly] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/ObjectStorageAccessKeysApi.md b/docs/ObjectStorageAccessKeysApi.md new file mode 100644 index 00000000..6e090c88 --- /dev/null +++ b/docs/ObjectStorageAccessKeysApi.md @@ -0,0 +1,163 @@ +# Fastly::ObjectStorageAccessKeysApi + + +```ruby +require 'fastly' +api_instance = Fastly::ObjectStorageAccessKeysApi.new +``` + +## Methods + +> [!NOTE] +> All URIs are relative to `https://api.fastly.com` + +Method | HTTP request | Description +------ | ------------ | ----------- +[**create_access_key**](ObjectStorageAccessKeysApi.md#create_access_key) | **POST** /resources/object-storage/access-keys | Create an access key +[**delete_access_key**](ObjectStorageAccessKeysApi.md#delete_access_key) | **DELETE** /resources/object-storage/access-keys/{access_key} | Delete an access key +[**get_access_key**](ObjectStorageAccessKeysApi.md#get_access_key) | **GET** /resources/object-storage/access-keys/{access_key} | Get an access key +[**list_access_keys**](ObjectStorageAccessKeysApi.md#list_access_keys) | **GET** /resources/object-storage/access-keys | List access keys + + +## `create_access_key()` + +```ruby +create_access_key(opts): # Create an access key +``` + +Create an access key. + +### Examples + +```ruby +api_instance = Fastly::ObjectStorageAccessKeysApi.new +opts = { + access_key: Fastly::AccessKey.new({description: 'description_example', permission: 'permission_example'}), # AccessKey | +} + +begin + # Create an access key + result = api_instance.create_access_key(opts) + p result +rescue Fastly::ApiError => e + puts "Error when calling ObjectStorageAccessKeysApi->create_access_key: #{e}" +end +``` + +### Options + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **access_key** | [**AccessKey**](AccessKey.md) | | [optional] | + +### Return type + +[**AccessKeyResponse**](AccessKeyResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) +## `delete_access_key()` + +```ruby +delete_access_key(opts) # Delete an access key +``` + +Delete an access key. + +### Examples + +```ruby +api_instance = Fastly::ObjectStorageAccessKeysApi.new +opts = { + access_key: 'access_key_example', # String | +} + +begin + # Delete an access key + api_instance.delete_access_key(opts) +rescue Fastly::ApiError => e + puts "Error when calling ObjectStorageAccessKeysApi->delete_access_key: #{e}" +end +``` + +### Options + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **access_key** | **String** | | | + +### Return type + +nil (empty response body) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) +## `get_access_key()` + +```ruby +get_access_key(opts): # Get an access key +``` + +Get an access key by its identifier. + +### Examples + +```ruby +api_instance = Fastly::ObjectStorageAccessKeysApi.new +opts = { + access_key: 'access_key_example', # String | +} + +begin + # Get an access key + result = api_instance.get_access_key(opts) + p result +rescue Fastly::ApiError => e + puts "Error when calling ObjectStorageAccessKeysApi->get_access_key: #{e}" +end +``` + +### Options + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **access_key** | **String** | | | + +### Return type + +[**AccessKey**](AccessKey.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) +## `list_access_keys()` + +```ruby +list_access_keys: # List access keys +``` + +List access keys. + +### Examples + +```ruby +api_instance = Fastly::ObjectStorageAccessKeysApi.new + +begin + # List access keys + result = api_instance.list_access_keys + p result +rescue Fastly::ApiError => e + puts "Error when calling ObjectStorageAccessKeysApi->list_access_keys: #{e}" +end +``` + +### Options + +This endpoint does not need any parameter. + +### Return type + +[**AccessKeyResponse**](AccessKeyResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) diff --git a/docs/RealtimeEntryAggregated.md b/docs/RealtimeEntryAggregated.md index 2cff6781..bab728a1 100644 --- a/docs/RealtimeEntryAggregated.md +++ b/docs/RealtimeEntryAggregated.md @@ -233,13 +233,6 @@ | **bot_challenge_complete_tokens_issued** | **Integer** | The number of challenge-complete tokens issued. For example, issuing a challenge-complete token after a series of CAPTCHA challenges ending in success. | [optional] | | **ddos_action_downgrade** | **Integer** | The number of times the downgrade action was taken. The downgrade action restricts the client to http1. | [optional] | | **ddos_action_downgraded_connections** | **Integer** | The number of connections the downgrade action was applied to. The downgrade action restricts the connection to http1. | [optional] | -| **vcl_on_compute_hit_requests** | **Integer** | Number of cache hits for a VCL service running on Compute. | [optional] | -| **vcl_on_compute_miss_requests** | **Integer** | Number of cache misses for a VCL service running on Compute. | [optional] | -| **vcl_on_compute_pass_requests** | **Integer** | Number of requests that passed through the CDN without being cached for a VCL service running on Compute. | [optional] | -| **vcl_on_compute_error_requests** | **Integer** | Number of cache errors for a VCL service running on Compute. | [optional] | -| **vcl_on_compute_synth_requests** | **Integer** | Number of requests that returned a synthetic response (i.e., response objects created with the `synthetic` VCL statement) for a VCL service running on Compute. | [optional] | -| **vcl_on_compute_edge_hit_requests** | **Integer** | Number of requests sent by end users to Fastly that resulted in a hit at the edge for a VCL service running on Compute. | [optional] | -| **vcl_on_compute_edge_miss_requests** | **Integer** | Number of requests sent by end users to Fastly that resulted in a miss at the edge for a VCL service running on Compute. | [optional] | | **all_hit_requests** | **Integer** | Number of cache hits for a VCL service. | [optional] | | **all_miss_requests** | **Integer** | Number of cache misses for a VCL service. | [optional] | | **all_pass_requests** | **Integer** | Number of requests that passed through the CDN without being cached for a VCL service. | [optional] | @@ -254,6 +247,9 @@ | **all_status_5xx** | **Integer** | Number of \"Server Error\" codes delivered for all sources. | [optional] | | **origin_offload** | **Float** | Origin Offload measures the ratio of bytes served to end users that were cached by Fastly, over the bytes served to end users, between 0 and 1. ((`edge_resp_body_bytes` + `edge_resp_header_bytes`) - (`origin_fetch_resp_body_bytes` + `origin_fetch_resp_header_bytes`)) / (`edge_resp_body_bytes` + `edge_resp_header_bytes`). | [optional] | | **request_denied_get_head_body** | **Integer** | Number of requests where Fastly responded with 400 due to the request being a GET or HEAD request containing a body. | [optional] | +| **service_ddos_requests_detected** | **Integer** | Number of requests classified as a DDoS attack against a customer origin or service. | [optional] | +| **service_ddos_requests_mitigated** | **Integer** | Number of requests classified as a DDoS attack against a customer origin or service that were mitigated by the Fastly platform. | [optional] | +| **service_ddos_requests_allowed** | **Integer** | Number of requests analyzed for DDoS attacks against a customer origin or service, but with no DDoS detected. | [optional] | [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/RealtimeMeasurements.md b/docs/RealtimeMeasurements.md index 8b2c1969..ff0be116 100644 --- a/docs/RealtimeMeasurements.md +++ b/docs/RealtimeMeasurements.md @@ -233,13 +233,6 @@ | **bot_challenge_complete_tokens_issued** | **Integer** | The number of challenge-complete tokens issued. For example, issuing a challenge-complete token after a series of CAPTCHA challenges ending in success. | [optional] | | **ddos_action_downgrade** | **Integer** | The number of times the downgrade action was taken. The downgrade action restricts the client to http1. | [optional] | | **ddos_action_downgraded_connections** | **Integer** | The number of connections the downgrade action was applied to. The downgrade action restricts the connection to http1. | [optional] | -| **vcl_on_compute_hit_requests** | **Integer** | Number of cache hits for a VCL service running on Compute. | [optional] | -| **vcl_on_compute_miss_requests** | **Integer** | Number of cache misses for a VCL service running on Compute. | [optional] | -| **vcl_on_compute_pass_requests** | **Integer** | Number of requests that passed through the CDN without being cached for a VCL service running on Compute. | [optional] | -| **vcl_on_compute_error_requests** | **Integer** | Number of cache errors for a VCL service running on Compute. | [optional] | -| **vcl_on_compute_synth_requests** | **Integer** | Number of requests that returned a synthetic response (i.e., response objects created with the `synthetic` VCL statement) for a VCL service running on Compute. | [optional] | -| **vcl_on_compute_edge_hit_requests** | **Integer** | Number of requests sent by end users to Fastly that resulted in a hit at the edge for a VCL service running on Compute. | [optional] | -| **vcl_on_compute_edge_miss_requests** | **Integer** | Number of requests sent by end users to Fastly that resulted in a miss at the edge for a VCL service running on Compute. | [optional] | | **all_hit_requests** | **Integer** | Number of cache hits for a VCL service. | [optional] | | **all_miss_requests** | **Integer** | Number of cache misses for a VCL service. | [optional] | | **all_pass_requests** | **Integer** | Number of requests that passed through the CDN without being cached for a VCL service. | [optional] | @@ -254,6 +247,9 @@ | **all_status_5xx** | **Integer** | Number of \"Server Error\" codes delivered for all sources. | [optional] | | **origin_offload** | **Float** | Origin Offload measures the ratio of bytes served to end users that were cached by Fastly, over the bytes served to end users, between 0 and 1. ((`edge_resp_body_bytes` + `edge_resp_header_bytes`) - (`origin_fetch_resp_body_bytes` + `origin_fetch_resp_header_bytes`)) / (`edge_resp_body_bytes` + `edge_resp_header_bytes`). | [optional] | | **request_denied_get_head_body** | **Integer** | Number of requests where Fastly responded with 400 due to the request being a GET or HEAD request containing a body. | [optional] | +| **service_ddos_requests_detected** | **Integer** | Number of requests classified as a DDoS attack against a customer origin or service. | [optional] | +| **service_ddos_requests_mitigated** | **Integer** | Number of requests classified as a DDoS attack against a customer origin or service that were mitigated by the Fastly platform. | [optional] | +| **service_ddos_requests_allowed** | **Integer** | Number of requests analyzed for DDoS attacks against a customer origin or service, but with no DDoS detected. | [optional] | [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Results.md b/docs/Results.md index 32c41bc0..74e65751 100644 --- a/docs/Results.md +++ b/docs/Results.md @@ -233,13 +233,6 @@ | **bot_challenges_failed** | **Integer** | The number of failed challenge solutions processed. For example, an incorrect CAPTCHA solution. | [optional] | | **ddos_action_downgrade** | **Integer** | The number of times the downgrade action was taken. The downgrade action restricts the client to http1. | [optional] | | **ddos_action_downgraded_connections** | **Integer** | The number of connections the downgrade action was applied to. The downgrade action restricts the connection to http1. | [optional] | -| **vcl_on_compute_hit_requests** | **Integer** | Number of cache hits for a VCL service running on Compute. | [optional] | -| **vcl_on_compute_miss_requests** | **Integer** | Number of cache misses for a VCL service running on Compute. | [optional] | -| **vcl_on_compute_pass_requests** | **Integer** | Number of requests that passed through the CDN without being cached for a VCL service running on Compute. | [optional] | -| **vcl_on_compute_error_requests** | **Integer** | Number of cache errors for a VCL service running on Compute. | [optional] | -| **vcl_on_compute_synth_requests** | **Integer** | Number of requests that returned a synthetic response (i.e., response objects created with the `synthetic` VCL statement) for a VCL service running on Compute. | [optional] | -| **vcl_on_compute_edge_hit_requests** | **Integer** | Number of requests sent by end users to Fastly that resulted in a hit at the edge for a VCL service running on Compute. | [optional] | -| **vcl_on_compute_edge_miss_requests** | **Integer** | Number of requests sent by end users to Fastly that resulted in a miss at the edge for a VCL service running on Compute. | [optional] | | **all_hit_requests** | **Integer** | Number of cache hits for a VCL service. | [optional] | | **all_miss_requests** | **Integer** | Number of cache misses for a VCL service. | [optional] | | **all_pass_requests** | **Integer** | Number of requests that passed through the CDN without being cached for a VCL service. | [optional] | @@ -254,6 +247,9 @@ | **all_status_5xx** | **Integer** | Number of \"Server Error\" codes delivered for all sources. | [optional] | | **origin_offload** | **Float** | Origin Offload measures the ratio of bytes served to end users that were cached by Fastly, over the bytes served to end users, between 0 and 1. ((`edge_resp_body_bytes` + `edge_resp_header_bytes`) - (`origin_fetch_resp_body_bytes` + `origin_fetch_resp_header_bytes`)) / (`edge_resp_body_bytes` + `edge_resp_header_bytes`). | [optional] | | **request_denied_get_head_body** | **Integer** | Number of requests where Fastly responded with 400 due to the request being a GET or HEAD request containing a body. | [optional] | +| **service_ddos_requests_detected** | **Integer** | Number of requests classified as a DDoS attack against a customer origin or service. | [optional] | +| **service_ddos_requests_mitigated** | **Integer** | Number of requests classified as a DDoS attack against a customer origin or service that were mitigated by the Fastly platform. | [optional] | +| **service_ddos_requests_allowed** | **Integer** | Number of requests analyzed for DDoS attacks against a customer origin or service, but with no DDoS detected. | [optional] | | **service_id** | **String** | | [optional][readonly] | | **start_time** | **Integer** | Timestamp for the start of the time period being reported | [optional] | diff --git a/docs/SetConfiguration.md b/docs/SetConfiguration.md index 75981178..630d1e57 100644 --- a/docs/SetConfiguration.md +++ b/docs/SetConfiguration.md @@ -6,6 +6,7 @@ | ---- | ---- | ----------- | ----- | | **workspace_id** | **String** | The new workspace_id. Required in the `PUT` request body when `product_id` is `ngwaf`. Optional in the `PATCH` request body for `ngwaf`. | [optional] | | **traffic_ramp** | **String** | The new traffic ramp. Optional in the `PATCH` request body for `ngwaf`. | [optional] | +| **mode** | **String** | The new mode to run the product in. One of `block`, `log`, or `off`. Optional in the `PATCH` request body for `ddos_protection`. | [optional] | [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Usagemetric.md b/docs/Usagemetric.md new file mode 100644 index 00000000..900bf6a1 --- /dev/null +++ b/docs/Usagemetric.md @@ -0,0 +1,18 @@ +# Fastly::Usagemetric + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **month** | **String** | The year and month of the usage element. | [optional] | +| **usage_type** | **String** | The usage type identifier for the usage. This is a single, billable metric for the product. | [optional] | +| **name** | **String** | Full name of the product usage type as it might appear on a customer's invoice. | [optional] | +| **region** | **String** | The geographical area applicable for regionally based products. | [optional] | +| **unit** | **String** | The unit for the usage as shown on an invoice. If there is no explicit unit, this field will be \"unit\" (e.g., a request with `product_id` of 'cdn_usage' and `usage_type` of 'North America Requests' has no unit, and will return \"unit\"). | [optional] | +| **quantity** | **Float** | The quantity of the usage for the product. | [optional] | +| **raw_quantity** | **Float** | The raw units measured for the product. | [optional] | +| **product_id** | **String** | The product identifier associated with the usage type. This corresponds to a Fastly product offering. | [optional] | +| **last_updated_at** | **String** | The date when the usage metric was last updated. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/Usagemetrics.md b/docs/Usagemetrics.md new file mode 100644 index 00000000..1e2971e2 --- /dev/null +++ b/docs/Usagemetrics.md @@ -0,0 +1,10 @@ +# Fastly::Usagemetrics + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<Usagemetric>**](Usagemetric.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/ValueField.md b/docs/ValueField.md new file mode 100644 index 00000000..99367751 --- /dev/null +++ b/docs/ValueField.md @@ -0,0 +1,59 @@ +# Fastly::ValueField + +## Class instance methods + +### `fastly_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'fastly' + +Fastly::ValueField.fastly_one_of +# => +# [ +# :'Array', +# :'Array', +# :'Array', +# :'Boolean', +# :'Float', +# :'Integer', +# :'String' +# ] +``` + +### build + +Find the appropriate object from the `fastly_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'fastly' + +Fastly::ValueField.build(data) +# => #:0x00007fdd4aab02a0> + +Fastly::ValueField.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `Array` +- `Array` +- `Array` +- `Boolean` +- `Float` +- `Integer` +- `String` +- `nil` (if no type matches) + diff --git a/docs/Values503Responses.md b/docs/Values503Responses.md new file mode 100644 index 00000000..8fc671b6 --- /dev/null +++ b/docs/Values503Responses.md @@ -0,0 +1,12 @@ +# Fastly::Values503Responses + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **url** | **String** | The HTTP request path. | [optional] | +| **rate_per_url** | **Float** | The rate at which the reason in this dimension occurs among responses to this URL with a 503 status code. | [optional] | +| **_503_rate_per_url** | **Float** | The rate at which 503 status codes are returned for this URL. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/ValuesBandwidth.md b/docs/ValuesBandwidth.md new file mode 100644 index 00000000..b89621e8 --- /dev/null +++ b/docs/ValuesBandwidth.md @@ -0,0 +1,11 @@ +# Fastly::ValuesBandwidth + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **average_bandwidth_bytes** | **Float** | The average bandwidth in bytes for responses to requests to the URL in the current dimension. | [optional] | +| **bandwidth_percentage** | **Float** | The total bandwidth percentage for all responses to requests to the URL in the current dimension. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/ValuesBrowser.md b/docs/ValuesBrowser.md new file mode 100644 index 00000000..fc94f966 --- /dev/null +++ b/docs/ValuesBrowser.md @@ -0,0 +1,11 @@ +# Fastly::ValuesBrowser + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **browser_version** | **String** | The version of the client's browser. | [optional] | +| **rate** | **Float** | The percentage of requests by this version of the browser specified in the dimension. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/ValuesCacheHitRatio.md b/docs/ValuesCacheHitRatio.md new file mode 100644 index 00000000..69ec38eb --- /dev/null +++ b/docs/ValuesCacheHitRatio.md @@ -0,0 +1,10 @@ +# Fastly::ValuesCacheHitRatio + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **cache_hit_ratio** | **Float** | The cache hit ratio for the URL specified in the dimension. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/ValuesCountryStats.md b/docs/ValuesCountryStats.md new file mode 100644 index 00000000..530f69bc --- /dev/null +++ b/docs/ValuesCountryStats.md @@ -0,0 +1,12 @@ +# Fastly::ValuesCountryStats + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **region** | **String** | The client's country subdivision code as defined by ISO 3166-2. | [optional] | +| **region_chr** | **Float** | The cache hit ratio for the region. | [optional] | +| **region_error_rate** | **Float** | The error rate for the region. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/ValuesDuration.md b/docs/ValuesDuration.md new file mode 100644 index 00000000..b56816f9 --- /dev/null +++ b/docs/ValuesDuration.md @@ -0,0 +1,12 @@ +# Fastly::ValuesDuration + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **average_response_time** | **Float** | The average time in seconds to respond to requests to the URL in the current dimension. | [optional] | +| **p95_response_time** | **Float** | The P95 time in seconds to respond to requests to the URL in the current dimension. | [optional] | +| **response_time_percentage** | **Float** | The total percentage of time to respond to all requests to the URL in the current dimension. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/ValuesMisses.md b/docs/ValuesMisses.md new file mode 100644 index 00000000..43f26e45 --- /dev/null +++ b/docs/ValuesMisses.md @@ -0,0 +1,10 @@ +# Fastly::ValuesMisses + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **miss_rate** | **Float** | The miss rate for requests to the URL in the current dimension. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/ValuesRate.md b/docs/ValuesRate.md new file mode 100644 index 00000000..5a49af55 --- /dev/null +++ b/docs/ValuesRate.md @@ -0,0 +1,10 @@ +# Fastly::ValuesRate + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rate** | **Float** | The percentage of requests matching the value in the current dimension. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/ValuesRequests.md b/docs/ValuesRequests.md new file mode 100644 index 00000000..15e881cf --- /dev/null +++ b/docs/ValuesRequests.md @@ -0,0 +1,10 @@ +# Fastly::ValuesRequests + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **request_percentage** | **Float** | The percentage of all requests made to the URL in the current dimension. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/ValuesStatusCodes.md b/docs/ValuesStatusCodes.md new file mode 100644 index 00000000..ac8689f3 --- /dev/null +++ b/docs/ValuesStatusCodes.md @@ -0,0 +1,12 @@ +# Fastly::ValuesStatusCodes + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **url** | **String** | The HTTP request path. | [optional] | +| **rate_per_status** | **Float** | The URL accounts for this percentage of the status code in this dimension. | [optional] | +| **rate_per_url** | **Float** | The rate at which the status code in this dimension occurs for this URL. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/lib/fastly.rb b/lib/fastly.rb index 698ae8c2..0d4e36ab 100644 --- a/lib/fastly.rb +++ b/lib/fastly.rb @@ -15,6 +15,8 @@ require 'fastly/configuration' # Models +require 'fastly/models/access_key' +require 'fastly/models/access_key_response' require 'fastly/models/acl' require 'fastly/models/acl_entry' require 'fastly/models/acl_entry_response' @@ -78,6 +80,7 @@ require 'fastly/models/compute_acl_list_entries_item' require 'fastly/models/compute_acl_list_entries_meta' require 'fastly/models/compute_acl_lookup' +require 'fastly/models/compute_acl_update' require 'fastly/models/compute_acl_update_entry' require 'fastly/models/condition' require 'fastly/models/condition_response' @@ -121,6 +124,16 @@ require 'fastly/models/dictionary_response' require 'fastly/models/dictionary_response_all_of' require 'fastly/models/diff_response' +require 'fastly/models/dimension_attributes_country_stats' +require 'fastly/models/dimension_attributes_rate' +require 'fastly/models/dimension_browser' +require 'fastly/models/dimension_content_type' +require 'fastly/models/dimension_country' +require 'fastly/models/dimension_device' +require 'fastly/models/dimension_os' +require 'fastly/models/dimension_response' +require 'fastly/models/dimension_status_code' +require 'fastly/models/dimension_url' require 'fastly/models/director' require 'fastly/models/director_backend' require 'fastly/models/director_backend_all_of' @@ -146,7 +159,12 @@ require 'fastly/models/event_data' require 'fastly/models/event_response' require 'fastly/models/events_response' +require 'fastly/models/filter_field_item' require 'fastly/models/generic_token_error' +require 'fastly/models/get_log_insights_response' +require 'fastly/models/get_log_records_response' +require 'fastly/models/get_log_records_response_meta' +require 'fastly/models/get_log_records_response_meta_filters' require 'fastly/models/get_service_level_usage_response' require 'fastly/models/get_service_level_usage_types_response' require 'fastly/models/gzip' @@ -238,6 +256,14 @@ require 'fastly/models/list_dashboards_response' require 'fastly/models/list_eom_invoices_response' require 'fastly/models/listinvoices' +require 'fastly/models/log_insights' +require 'fastly/models/log_insights_dimension_attributes' +require 'fastly/models/log_insights_dimensions' +require 'fastly/models/log_insights_meta' +require 'fastly/models/log_insights_meta_filter' +require 'fastly/models/log_insights_values' +require 'fastly/models/log_property_service_id' +require 'fastly/models/log_record' require 'fastly/models/logging_address_and_port' require 'fastly/models/logging_azureblob_additional' require 'fastly/models/logging_azureblob_response' @@ -269,6 +295,8 @@ require 'fastly/models/logging_generic_common_response_all_of1' require 'fastly/models/logging_google_pubsub_additional' require 'fastly/models/logging_google_pubsub_response' +require 'fastly/models/logging_grafanacloudlogs_additional' +require 'fastly/models/logging_grafanacloudlogs_response' require 'fastly/models/logging_heroku_additional' require 'fastly/models/logging_heroku_response' require 'fastly/models/logging_honeycomb_additional' @@ -670,6 +698,8 @@ require 'fastly/models/update_billing_address_request' require 'fastly/models/update_billing_address_request_data' require 'fastly/models/update_dashboard_request' +require 'fastly/models/usagemetric' +require 'fastly/models/usagemetrics' require 'fastly/models/user' require 'fastly/models/user_response' require 'fastly/models/user_response_read_only' @@ -677,8 +707,19 @@ require 'fastly/models/validator_result_data' require 'fastly/models/validator_result_data_attributes' require 'fastly/models/validator_result_data_attributes_messages' +require 'fastly/models/value_field' require 'fastly/models/values' +require 'fastly/models/values503_responses' +require 'fastly/models/values_bandwidth' +require 'fastly/models/values_browser' +require 'fastly/models/values_cache_hit_ratio' +require 'fastly/models/values_country_stats' require 'fastly/models/values_ddos' +require 'fastly/models/values_duration' +require 'fastly/models/values_misses' +require 'fastly/models/values_rate' +require 'fastly/models/values_requests' +require 'fastly/models/values_status_codes' require 'fastly/models/vcl' require 'fastly/models/vcl_diff' require 'fastly/models/vcl_response' @@ -795,6 +836,7 @@ require 'fastly/api/iam_service_groups_api' require 'fastly/api/iam_user_groups_api' require 'fastly/api/image_optimizer_default_settings_api' +require 'fastly/api/insights_api' require 'fastly/api/invitations_api' require 'fastly/api/kv_store_api' require 'fastly/api/kv_store_item_api' @@ -806,6 +848,7 @@ require 'fastly/api/legacy_waf_ruleset_api' require 'fastly/api/legacy_waf_tag_api' require 'fastly/api/legacy_waf_update_status_api' +require 'fastly/api/log_explorer_api' require 'fastly/api/logging_azureblob_api' require 'fastly/api/logging_bigquery_api' require 'fastly/api/logging_cloudfiles_api' @@ -814,6 +857,7 @@ require 'fastly/api/logging_elasticsearch_api' require 'fastly/api/logging_ftp_api' require 'fastly/api/logging_gcs_api' +require 'fastly/api/logging_grafanacloudlogs_api' require 'fastly/api/logging_heroku_api' require 'fastly/api/logging_honeycomb_api' require 'fastly/api/logging_https_api' @@ -834,6 +878,7 @@ require 'fastly/api/logging_sumologic_api' require 'fastly/api/logging_syslog_api' require 'fastly/api/mutual_authentication_api' +require 'fastly/api/object_storage_access_keys_api' require 'fastly/api/observability_custom_dashboards_api' require 'fastly/api/origin_inspector_historical_api' require 'fastly/api/origin_inspector_realtime_api' diff --git a/lib/fastly/api/acls_in_compute_api.rb b/lib/fastly/api/acls_in_compute_api.rb index 568af2c8..c7e5a166 100644 --- a/lib/fastly/api/acls_in_compute_api.rb +++ b/lib/fastly/api/acls_in_compute_api.rb @@ -402,7 +402,7 @@ def compute_acl_lookup_acls_with_http_info(opts = {}) # Update an ACL # Update an ACL. # @option opts [String] :acl_id (required) - # @option opts [Array] :compute_acl_update_entry + # @option opts [ComputeAclUpdate] :compute_acl_update # @return [nil] def compute_acl_update_acls(opts = {}) compute_acl_update_acls_with_http_info(opts) @@ -412,7 +412,7 @@ def compute_acl_update_acls(opts = {}) # Update an ACL # Update an ACL. # @option opts [String] :acl_id (required) - # @option opts [Array] :compute_acl_update_entry + # @option opts [ComputeAclUpdate] :compute_acl_update # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def compute_acl_update_acls_with_http_info(opts = {}) if @api_client.config.debugging @@ -442,7 +442,7 @@ def compute_acl_update_acls_with_http_info(opts = {}) form_params = opts[:form_params] || {} # http body (model) - post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'compute_acl_update_entry']) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'compute_acl_update']) # return_type return_type = opts[:debug_return_type] diff --git a/lib/fastly/api/backend_api.rb b/lib/fastly/api/backend_api.rb index c843bc17..73283cd9 100644 --- a/lib/fastly/api/backend_api.rb +++ b/lib/fastly/api/backend_api.rb @@ -26,8 +26,8 @@ def initialize(api_client = ApiClient.default) # @option opts [Integer] :between_bytes_timeout Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using `bereq.between_bytes_timeout`. # @option opts [String] :client_cert Unused. # @option opts [String] :comment A freeform descriptive note. - # @option opts [Integer] :connect_timeout Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. - # @option opts [Integer] :first_byte_timeout Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. + # @option opts [Integer] :connect_timeout Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. + # @option opts [Integer] :first_byte_timeout Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. # @option opts [String] :healthcheck The name of the healthcheck to use with this backend. # @option opts [String] :hostname The hostname of the backend. May be used as an alternative to `address` to set the backend location. # @option opts [String] :ipv4 IPv4 address of the backend. May be used as an alternative to `address` to set the backend location. @@ -71,8 +71,8 @@ def create_backend(opts = {}) # @option opts [Integer] :between_bytes_timeout Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using `bereq.between_bytes_timeout`. # @option opts [String] :client_cert Unused. # @option opts [String] :comment A freeform descriptive note. - # @option opts [Integer] :connect_timeout Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. - # @option opts [Integer] :first_byte_timeout Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. + # @option opts [Integer] :connect_timeout Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. + # @option opts [Integer] :first_byte_timeout Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. # @option opts [String] :healthcheck The name of the healthcheck to use with this backend. # @option opts [String] :hostname The hostname of the backend. May be used as an alternative to `address` to set the backend location. # @option opts [String] :ipv4 IPv4 address of the backend. May be used as an alternative to `address` to set the backend location. @@ -436,8 +436,8 @@ def list_backends_with_http_info(opts = {}) # @option opts [Integer] :between_bytes_timeout Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using `bereq.between_bytes_timeout`. # @option opts [String] :client_cert Unused. # @option opts [String] :comment A freeform descriptive note. - # @option opts [Integer] :connect_timeout Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. - # @option opts [Integer] :first_byte_timeout Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. + # @option opts [Integer] :connect_timeout Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. + # @option opts [Integer] :first_byte_timeout Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. # @option opts [String] :healthcheck The name of the healthcheck to use with this backend. # @option opts [String] :hostname The hostname of the backend. May be used as an alternative to `address` to set the backend location. # @option opts [String] :ipv4 IPv4 address of the backend. May be used as an alternative to `address` to set the backend location. @@ -482,8 +482,8 @@ def update_backend(opts = {}) # @option opts [Integer] :between_bytes_timeout Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using `bereq.between_bytes_timeout`. # @option opts [String] :client_cert Unused. # @option opts [String] :comment A freeform descriptive note. - # @option opts [Integer] :connect_timeout Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. - # @option opts [Integer] :first_byte_timeout Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. + # @option opts [Integer] :connect_timeout Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. + # @option opts [Integer] :first_byte_timeout Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. # @option opts [String] :healthcheck The name of the healthcheck to use with this backend. # @option opts [String] :hostname The hostname of the backend. May be used as an alternative to `address` to set the backend location. # @option opts [String] :ipv4 IPv4 address of the backend. May be used as an alternative to `address` to set the backend location. diff --git a/lib/fastly/api/billing_usage_metrics_api.rb b/lib/fastly/api/billing_usage_metrics_api.rb index aeaff9c8..6b62d312 100644 --- a/lib/fastly/api/billing_usage_metrics_api.rb +++ b/lib/fastly/api/billing_usage_metrics_api.rb @@ -19,12 +19,8 @@ def initialize(api_client = ApiClient.default) end # Retrieve service-level usage metrics for a product. # Returns product usage, broken down by service. - # @option opts [String] :customer_id Alphanumeric string identifying the customer. (required) # @option opts [String] :product_id The product identifier for the metrics returned (e.g., `cdn_usage`). This field is not required for CSV requests. (required) # @option opts [String] :usage_type_name The usage type name for the metrics returned (e.g., `North America Requests`). This field is not required for CSV requests. (required) - # @option opts [String] :time_granularity (required) - # @option opts [String] :start_date - # @option opts [String] :end_date # @option opts [String] :start_month # @option opts [String] :end_month # @option opts [String] :limit Number of results per page. The maximum is 100. (default to '5') @@ -37,12 +33,8 @@ def get_service_level_usage(opts = {}) # Retrieve service-level usage metrics for a product. # Returns product usage, broken down by service. - # @option opts [String] :customer_id Alphanumeric string identifying the customer. (required) # @option opts [String] :product_id The product identifier for the metrics returned (e.g., `cdn_usage`). This field is not required for CSV requests. (required) # @option opts [String] :usage_type_name The usage type name for the metrics returned (e.g., `North America Requests`). This field is not required for CSV requests. (required) - # @option opts [String] :time_granularity (required) - # @option opts [String] :start_date - # @option opts [String] :end_date # @option opts [String] :start_month # @option opts [String] :end_month # @option opts [String] :limit Number of results per page. The maximum is 100. (default to '5') @@ -53,14 +45,8 @@ def get_service_level_usage_with_http_info(opts = {}) @api_client.config.logger.debug 'Calling API: BillingUsageMetricsApi.get_service_level_usage ...' end # unbox the parameters from the hash - customer_id = opts[:'customer_id'] product_id = opts[:'product_id'] usage_type_name = opts[:'usage_type_name'] - time_granularity = opts[:'time_granularity'] - # verify the required parameter 'customer_id' is set - if @api_client.config.client_side_validation && customer_id.nil? - fail ArgumentError, "Missing the required parameter 'customer_id' when calling BillingUsageMetricsApi.get_service_level_usage" - end # verify the required parameter 'product_id' is set if @api_client.config.client_side_validation && product_id.nil? fail ArgumentError, "Missing the required parameter 'product_id' when calling BillingUsageMetricsApi.get_service_level_usage" @@ -69,25 +55,6 @@ def get_service_level_usage_with_http_info(opts = {}) if @api_client.config.client_side_validation && usage_type_name.nil? fail ArgumentError, "Missing the required parameter 'usage_type_name' when calling BillingUsageMetricsApi.get_service_level_usage" end - # verify the required parameter 'time_granularity' is set - if @api_client.config.client_side_validation && time_granularity.nil? - fail ArgumentError, "Missing the required parameter 'time_granularity' when calling BillingUsageMetricsApi.get_service_level_usage" - end - pattern = Regexp.new(/^day$|^month$/) - if @api_client.config.client_side_validation && time_granularity !~ pattern - fail ArgumentError, "invalid value for 'time_granularity' when calling BillingUsageMetricsApi.get_service_level_usage, must conform to the pattern #{pattern}." - end - - pattern = Regexp.new(/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/) - if @api_client.config.client_side_validation && !opts[:'start_date'].nil? && opts[:'start_date'] !~ pattern - fail ArgumentError, "invalid value for 'opts[:\"start_date\"]' when calling BillingUsageMetricsApi.get_service_level_usage, must conform to the pattern #{pattern}." - end - - pattern = Regexp.new(/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/) - if @api_client.config.client_side_validation && !opts[:'end_date'].nil? && opts[:'end_date'] !~ pattern - fail ArgumentError, "invalid value for 'opts[:\"end_date\"]' when calling BillingUsageMetricsApi.get_service_level_usage, must conform to the pattern #{pattern}." - end - pattern = Regexp.new(/^[0-9]{4}-[0-9]{2}$/) if @api_client.config.client_side_validation && !opts[:'start_month'].nil? && opts[:'start_month'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"start_month\"]' when calling BillingUsageMetricsApi.get_service_level_usage, must conform to the pattern #{pattern}." @@ -99,15 +66,12 @@ def get_service_level_usage_with_http_info(opts = {}) end # resource path - local_var_path = '/billing/v2/account_customers/{customer_id}/service-usage-metrics'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s)) + local_var_path = '/billing/v3/service-usage-metrics' # query parameters query_params = opts[:query_params] || {} query_params[:'product_id'] = product_id query_params[:'usage_type_name'] = usage_type_name - query_params[:'time_granularity'] = time_granularity - query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil? - query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil? query_params[:'start_month'] = opts[:'start_month'] if !opts[:'start_month'].nil? query_params[:'end_month'] = opts[:'end_month'] if !opts[:'end_month'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? @@ -147,34 +111,43 @@ def get_service_level_usage_with_http_info(opts = {}) return data, status_code, headers end - # Retrieve product usage types for a customer. - # Returns product usage types reported by the customer's services. - # @option opts [String] :customer_id Alphanumeric string identifying the customer. (required) - # @return [Serviceusagetypes] - def get_service_level_usage_types(opts = {}) - data, _status_code, _headers = get_service_level_usage_types_with_http_info(opts) + # Get monthly usage metrics + # Returns monthly usage metrics for customer by product. + # @option opts [String] :start_month + # @option opts [String] :end_month + # @return [Usagemetric] + def get_usage_metrics(opts = {}) + data, _status_code, _headers = get_usage_metrics_with_http_info(opts) data end - # Retrieve product usage types for a customer. - # Returns product usage types reported by the customer's services. - # @option opts [String] :customer_id Alphanumeric string identifying the customer. (required) - # @return [Array<(Serviceusagetypes, Integer, Hash)>] Serviceusagetypes data, response status code and response headers - def get_service_level_usage_types_with_http_info(opts = {}) + # Get monthly usage metrics + # Returns monthly usage metrics for customer by product. + # @option opts [String] :start_month + # @option opts [String] :end_month + # @return [Array<(Usagemetric, Integer, Hash)>] Usagemetric data, response status code and response headers + def get_usage_metrics_with_http_info(opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: BillingUsageMetricsApi.get_service_level_usage_types ...' + @api_client.config.logger.debug 'Calling API: BillingUsageMetricsApi.get_usage_metrics ...' end # unbox the parameters from the hash - customer_id = opts[:'customer_id'] - # verify the required parameter 'customer_id' is set - if @api_client.config.client_side_validation && customer_id.nil? - fail ArgumentError, "Missing the required parameter 'customer_id' when calling BillingUsageMetricsApi.get_service_level_usage_types" + pattern = Regexp.new(/^[0-9]{4}-[0-9]{2}$/) + if @api_client.config.client_side_validation && !opts[:'start_month'].nil? && opts[:'start_month'] !~ pattern + fail ArgumentError, "invalid value for 'opts[:\"start_month\"]' when calling BillingUsageMetricsApi.get_usage_metrics, must conform to the pattern #{pattern}." + end + + pattern = Regexp.new(/^[0-9]{4}-[0-9]{2}$/) + if @api_client.config.client_side_validation && !opts[:'end_month'].nil? && opts[:'end_month'] !~ pattern + fail ArgumentError, "invalid value for 'opts[:\"end_month\"]' when calling BillingUsageMetricsApi.get_usage_metrics, must conform to the pattern #{pattern}." end + # resource path - local_var_path = '/billing/v2/account_customers/{customer_id}/service-usage-types'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s)) + local_var_path = '/billing/v3/usage-metrics' # query parameters query_params = opts[:query_params] || {} + query_params[:'start_month'] = opts[:'start_month'] if !opts[:'start_month'].nil? + query_params[:'end_month'] = opts[:'end_month'] if !opts[:'end_month'].nil? # header parameters header_params = opts[:header_params] || {} @@ -188,13 +161,13 @@ def get_service_level_usage_types_with_http_info(opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'Serviceusagetypes' + return_type = opts[:debug_return_type] || 'Usagemetric' # auth_names auth_names = opts[:debug_auth_names] || ['token'] new_options = opts.merge( - :operation => :"BillingUsageMetricsApi.get_service_level_usage_types", + :operation => :"BillingUsageMetricsApi.get_usage_metrics", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -205,7 +178,7 @@ def get_service_level_usage_types_with_http_info(opts = {}) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: BillingUsageMetricsApi#get_service_level_usage_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: BillingUsageMetricsApi#get_usage_metrics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end diff --git a/lib/fastly/api/enabled_products_api.rb b/lib/fastly/api/enabled_products_api.rb index 5dfab789..5efbca38 100644 --- a/lib/fastly/api/enabled_products_api.rb +++ b/lib/fastly/api/enabled_products_api.rb @@ -18,7 +18,7 @@ def initialize(api_client = ApiClient.default) @api_client = api_client end # Disable a product - # Disable a product on a service. Supported product IDs: `brotli_compression`,`domain_inspector`,`fanout`,`image_optimizer`,`origin_inspector`, `websockets`, `bot_management`, and `ngwaf`. + # Disable a product on a service. Supported product IDs: `brotli_compression`,`domain_inspector`,`fanout`,`image_optimizer`,`origin_inspector`, `websockets`, `bot_management`, `ngwaf`, `ddos_protection`, and `log_explorer_insights`. # @option opts [String] :product_id (required) # @option opts [String] :service_id Alphanumeric string identifying the service. (required) # @return [nil] @@ -28,7 +28,7 @@ def disable_product(opts = {}) end # Disable a product - # Disable a product on a service. Supported product IDs: `brotli_compression`,`domain_inspector`,`fanout`,`image_optimizer`,`origin_inspector`, `websockets`, `bot_management`, and `ngwaf`. + # Disable a product on a service. Supported product IDs: `brotli_compression`,`domain_inspector`,`fanout`,`image_optimizer`,`origin_inspector`, `websockets`, `bot_management`, `ngwaf`, `ddos_protection`, and `log_explorer_insights`. # @option opts [String] :product_id (required) # @option opts [String] :service_id Alphanumeric string identifying the service. (required) # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers @@ -86,7 +86,7 @@ def disable_product_with_http_info(opts = {}) end # Enable a product - # Enable a product on a service. Supported product IDs: `brotli_compression`,`domain_inspector`,`fanout`,`image_optimizer`,`origin_inspector`, `websockets`, `bot_management`, and `ngwaf`. + # Enable a product on a service. Supported product IDs: `brotli_compression`,`domain_inspector`,`fanout`,`image_optimizer`,`origin_inspector`, `websockets`, `bot_management`, `ngwaf`, `ddos_protection`, and `log_explorer_insights`. # @option opts [String] :product_id (required) # @option opts [String] :service_id Alphanumeric string identifying the service. (required) # @option opts [SetWorkspaceId] :set_workspace_id @@ -97,7 +97,7 @@ def enable_product(opts = {}) end # Enable a product - # Enable a product on a service. Supported product IDs: `brotli_compression`,`domain_inspector`,`fanout`,`image_optimizer`,`origin_inspector`, `websockets`, `bot_management`, and `ngwaf`. + # Enable a product on a service. Supported product IDs: `brotli_compression`,`domain_inspector`,`fanout`,`image_optimizer`,`origin_inspector`, `websockets`, `bot_management`, `ngwaf`, `ddos_protection`, and `log_explorer_insights`. # @option opts [String] :product_id (required) # @option opts [String] :service_id Alphanumeric string identifying the service. (required) # @option opts [SetWorkspaceId] :set_workspace_id @@ -163,7 +163,7 @@ def enable_product_with_http_info(opts = {}) end # Get enabled product - # Get enabled product on a service. Supported product IDs: `brotli_compression`,`domain_inspector`,`fanout`,`image_optimizer`,`origin_inspector`, `websockets`, `bot_management`, and `ngwaf`. + # Get enabled product on a service. Supported product IDs: `brotli_compression`,`domain_inspector`,`fanout`,`image_optimizer`,`origin_inspector`, `websockets`, `bot_management`, `ngwaf`, `ddos_protection`, and `log_explorer_insights`. # @option opts [String] :product_id (required) # @option opts [String] :service_id Alphanumeric string identifying the service. (required) # @return [EnabledProductResponse] @@ -173,7 +173,7 @@ def get_enabled_product(opts = {}) end # Get enabled product - # Get enabled product on a service. Supported product IDs: `brotli_compression`,`domain_inspector`,`fanout`,`image_optimizer`,`origin_inspector`, `websockets`, `bot_management`, and `ngwaf`. + # Get enabled product on a service. Supported product IDs: `brotli_compression`,`domain_inspector`,`fanout`,`image_optimizer`,`origin_inspector`, `websockets`, `bot_management`, `ngwaf`, `ddos_protection`, and `log_explorer_insights`. # @option opts [String] :product_id (required) # @option opts [String] :service_id Alphanumeric string identifying the service. (required) # @return [Array<(EnabledProductResponse, Integer, Hash)>] EnabledProductResponse data, response status code and response headers @@ -233,7 +233,7 @@ def get_enabled_product_with_http_info(opts = {}) end # Get configuration for a product - # Get configuration for an enabled product on a service. Supported product IDs: `ngwaf`. + # Get configuration for an enabled product on a service. Supported product IDs: `ngwaf` and `ddos_protection`. # @option opts [String] :product_id (required) # @option opts [String] :service_id Alphanumeric string identifying the service. (required) # @return [ConfiguredProductResponse] @@ -243,7 +243,7 @@ def get_product_configuration(opts = {}) end # Get configuration for a product - # Get configuration for an enabled product on a service. Supported product IDs: `ngwaf`. + # Get configuration for an enabled product on a service. Supported product IDs: `ngwaf` and `ddos_protection`. # @option opts [String] :product_id (required) # @option opts [String] :service_id Alphanumeric string identifying the service. (required) # @return [Array<(ConfiguredProductResponse, Integer, Hash)>] ConfiguredProductResponse data, response status code and response headers @@ -303,7 +303,7 @@ def get_product_configuration_with_http_info(opts = {}) end # Update configuration for a product - # Update configuration for an enabled product on a service. Supported product IDs: `ngwaf`. + # Update configuration for an enabled product on a service. Supported product IDs: `ngwaf` and `ddos_protection`. # @option opts [String] :product_id (required) # @option opts [String] :service_id Alphanumeric string identifying the service. (required) # @option opts [SetConfiguration] :set_configuration @@ -314,7 +314,7 @@ def set_product_configuration(opts = {}) end # Update configuration for a product - # Update configuration for an enabled product on a service. Supported product IDs: `ngwaf`. + # Update configuration for an enabled product on a service. Supported product IDs: `ngwaf` and `ddos_protection`. # @option opts [String] :product_id (required) # @option opts [String] :service_id Alphanumeric string identifying the service. (required) # @option opts [SetConfiguration] :set_configuration diff --git a/lib/fastly/api/insights_api.rb b/lib/fastly/api/insights_api.rb new file mode 100644 index 00000000..fb050eb7 --- /dev/null +++ b/lib/fastly/api/insights_api.rb @@ -0,0 +1,125 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'cgi' + +module Fastly + class InsightsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Retrieve log insights + # Retrieves statistics from sampled log records. + # @option opts [String] :visualization (required) + # @option opts [String] :service_id (required) + # @option opts [String] :start (required) + # @option opts [String] :_end (required) + # @option opts [String] :pops + # @option opts [String] :domain + # @option opts [Boolean] :domain_exact_match + # @option opts [Float] :limit + # @return [GetLogInsightsResponse] + def get_log_insights(opts = {}) + data, _status_code, _headers = get_log_insights_with_http_info(opts) + data + end + + # Retrieve log insights + # Retrieves statistics from sampled log records. + # @option opts [String] :visualization (required) + # @option opts [String] :service_id (required) + # @option opts [String] :start (required) + # @option opts [String] :_end (required) + # @option opts [String] :pops + # @option opts [String] :domain + # @option opts [Boolean] :domain_exact_match + # @option opts [Float] :limit + # @return [Array<(GetLogInsightsResponse, Integer, Hash)>] GetLogInsightsResponse data, response status code and response headers + def get_log_insights_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: InsightsApi.get_log_insights ...' + end + # unbox the parameters from the hash + visualization = opts[:'visualization'] + service_id = opts[:'service_id'] + start = opts[:'start'] + _end = opts[:'_end'] + # verify the required parameter 'visualization' is set + if @api_client.config.client_side_validation && visualization.nil? + fail ArgumentError, "Missing the required parameter 'visualization' when calling InsightsApi.get_log_insights" + end + # verify enum value + allowable_values = ["top-url-by-bandwidth", "bottom-url-by-cache-hit-ratio", "top-url-by-cache-hit-ratio", "country-statistics", "top-url-by-duration-sum", "top-4xx-urls", "top-5xx-urls", "top-url-by-misses", "top-url-by-requests", "top-browser-by-requests", "top-content-type-by-requests", "top-device-by-requests", "top-os-by-requests", "response-status-codes", "top-503-responses"] + if @api_client.config.client_side_validation && !allowable_values.include?(visualization) + fail ArgumentError, "invalid value for \"visualization\", must be one of #{allowable_values}" + end + # verify the required parameter 'service_id' is set + if @api_client.config.client_side_validation && service_id.nil? + fail ArgumentError, "Missing the required parameter 'service_id' when calling InsightsApi.get_log_insights" + end + # verify the required parameter 'start' is set + if @api_client.config.client_side_validation && start.nil? + fail ArgumentError, "Missing the required parameter 'start' when calling InsightsApi.get_log_insights" + end + # verify the required parameter '_end' is set + if @api_client.config.client_side_validation && _end.nil? + fail ArgumentError, "Missing the required parameter '_end' when calling InsightsApi.get_log_insights" + end + # resource path + local_var_path = '/observability/log-insights' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'visualization'] = visualization + query_params[:'service_id'] = service_id + query_params[:'start'] = start + query_params[:'end'] = _end + query_params[:'pops'] = opts[:'pops'] if !opts[:'pops'].nil? + query_params[:'domain'] = opts[:'domain'] if !opts[:'domain'].nil? + query_params[:'domain_exact_match'] = opts[:'domain_exact_match'] if !opts[:'domain_exact_match'].nil? + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetLogInsightsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"InsightsApi.get_log_insights", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: InsightsApi#get_log_insights\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/fastly/api/kv_store_item_api.rb b/lib/fastly/api/kv_store_item_api.rb index bfbe611b..6e53b8d2 100644 --- a/lib/fastly/api/kv_store_item_api.rb +++ b/lib/fastly/api/kv_store_item_api.rb @@ -91,6 +91,7 @@ def delete_key_from_store_with_http_info(opts = {}) # @option opts [String] :cursor # @option opts [Integer] :limit (default to 100) # @option opts [String] :prefix + # @option opts [String] :consistency # @return [InlineResponse2004] def get_keys(opts = {}) data, _status_code, _headers = get_keys_with_http_info(opts) @@ -103,6 +104,7 @@ def get_keys(opts = {}) # @option opts [String] :cursor # @option opts [Integer] :limit (default to 100) # @option opts [String] :prefix + # @option opts [String] :consistency # @return [Array<(InlineResponse2004, Integer, Hash)>] InlineResponse2004 data, response status code and response headers def get_keys_with_http_info(opts = {}) if @api_client.config.debugging @@ -122,6 +124,7 @@ def get_keys_with_http_info(opts = {}) query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'prefix'] = opts[:'prefix'] if !opts[:'prefix'].nil? + query_params[:'consistency'] = opts[:'consistency'] if !opts[:'consistency'].nil? # header parameters header_params = opts[:header_params] || {} diff --git a/lib/fastly/api/log_explorer_api.rb b/lib/fastly/api/log_explorer_api.rb new file mode 100644 index 00000000..532a182f --- /dev/null +++ b/lib/fastly/api/log_explorer_api.rb @@ -0,0 +1,109 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'cgi' + +module Fastly + class LogExplorerApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Retrieve log records + # Retrieves log records. + # @option opts [String] :service_id (required) + # @option opts [String] :start (required) + # @option opts [String] :_end (required) + # @option opts [Float] :limit + # @option opts [String] :next_cursor + # @option opts [String] :filter + # @return [GetLogRecordsResponse] + def get_log_records(opts = {}) + data, _status_code, _headers = get_log_records_with_http_info(opts) + data + end + + # Retrieve log records + # Retrieves log records. + # @option opts [String] :service_id (required) + # @option opts [String] :start (required) + # @option opts [String] :_end (required) + # @option opts [Float] :limit + # @option opts [String] :next_cursor + # @option opts [String] :filter + # @return [Array<(GetLogRecordsResponse, Integer, Hash)>] GetLogRecordsResponse data, response status code and response headers + def get_log_records_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LogExplorerApi.get_log_records ...' + end + # unbox the parameters from the hash + service_id = opts[:'service_id'] + start = opts[:'start'] + _end = opts[:'_end'] + # verify the required parameter 'service_id' is set + if @api_client.config.client_side_validation && service_id.nil? + fail ArgumentError, "Missing the required parameter 'service_id' when calling LogExplorerApi.get_log_records" + end + # verify the required parameter 'start' is set + if @api_client.config.client_side_validation && start.nil? + fail ArgumentError, "Missing the required parameter 'start' when calling LogExplorerApi.get_log_records" + end + # verify the required parameter '_end' is set + if @api_client.config.client_side_validation && _end.nil? + fail ArgumentError, "Missing the required parameter '_end' when calling LogExplorerApi.get_log_records" + end + # resource path + local_var_path = '/observability/log-explorer' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'service_id'] = service_id + query_params[:'start'] = start + query_params[:'end'] = _end + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'next_cursor'] = opts[:'next_cursor'] if !opts[:'next_cursor'].nil? + query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetLogRecordsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"LogExplorerApi.get_log_records", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LogExplorerApi#get_log_records\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/fastly/api/logging_grafanacloudlogs_api.rb b/lib/fastly/api/logging_grafanacloudlogs_api.rb new file mode 100644 index 00000000..68ac70fd --- /dev/null +++ b/lib/fastly/api/logging_grafanacloudlogs_api.rb @@ -0,0 +1,471 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'cgi' + +module Fastly + class LoggingGrafanacloudlogsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a Grafana Cloud Logs log endpoint + # Create a Grafana Cloud Logs logging object for a particular service and version. + # @option opts [String] :service_id Alphanumeric string identifying the service. (required) + # @option opts [Integer] :version_id Integer identifying a service version. (required) + # @option opts [String] :name The name for the real-time logging configuration. + # @option opts [String] :placement Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. + # @option opts [String] :response_condition The name of an existing condition in the configured endpoint, or leave blank to always execute. + # @option opts [String] :format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). + # @option opts [Integer] :format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. (default to FORMAT_VERSION::v2) + # @option opts [String] :user The Grafana Cloud Logs Dataset you want to log to. + # @option opts [String] :url The URL of the Loki instance in your Grafana stack. + # @option opts [String] :token The Grafana Access Policy token with `logs:write` access scoped to your Loki instance. + # @option opts [String] :index The Stream Labels, a JSON string used to identify the stream. + # @return [LoggingGrafanacloudlogsResponse] + def create_log_grafanacloudlogs(opts = {}) + data, _status_code, _headers = create_log_grafanacloudlogs_with_http_info(opts) + data + end + + # Create a Grafana Cloud Logs log endpoint + # Create a Grafana Cloud Logs logging object for a particular service and version. + # @option opts [String] :service_id Alphanumeric string identifying the service. (required) + # @option opts [Integer] :version_id Integer identifying a service version. (required) + # @option opts [String] :name The name for the real-time logging configuration. + # @option opts [String] :placement Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. + # @option opts [String] :response_condition The name of an existing condition in the configured endpoint, or leave blank to always execute. + # @option opts [String] :format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). + # @option opts [Integer] :format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. (default to FORMAT_VERSION::v2) + # @option opts [String] :user The Grafana Cloud Logs Dataset you want to log to. + # @option opts [String] :url The URL of the Loki instance in your Grafana stack. + # @option opts [String] :token The Grafana Access Policy token with `logs:write` access scoped to your Loki instance. + # @option opts [String] :index The Stream Labels, a JSON string used to identify the stream. + # @return [Array<(LoggingGrafanacloudlogsResponse, Integer, Hash)>] LoggingGrafanacloudlogsResponse data, response status code and response headers + def create_log_grafanacloudlogs_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoggingGrafanacloudlogsApi.create_log_grafanacloudlogs ...' + end + # unbox the parameters from the hash + service_id = opts[:'service_id'] + version_id = opts[:'version_id'] + # verify the required parameter 'service_id' is set + if @api_client.config.client_side_validation && service_id.nil? + fail ArgumentError, "Missing the required parameter 'service_id' when calling LoggingGrafanacloudlogsApi.create_log_grafanacloudlogs" + end + # verify the required parameter 'version_id' is set + if @api_client.config.client_side_validation && version_id.nil? + fail ArgumentError, "Missing the required parameter 'version_id' when calling LoggingGrafanacloudlogsApi.create_log_grafanacloudlogs" + end + allowable_values = ["none", "waf_debug", "null"] + if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement']) + fail ArgumentError, "invalid value for \"placement\", must be one of #{allowable_values}" + end + allowable_values = [1, 2] + if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version']) + fail ArgumentError, "invalid value for \"format_version\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/service/{service_id}/version/{version_id}/logging/grafanacloudlogs'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['name'] = opts[:'name'] if !opts[:'name'].nil? + form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil? + form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil? + form_params['format'] = opts[:'format'] if !opts[:'format'].nil? + form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil? + form_params['user'] = opts[:'user'] if !opts[:'user'].nil? + form_params['url'] = opts[:'url'] if !opts[:'url'].nil? + form_params['token'] = opts[:'token'] if !opts[:'token'].nil? + form_params['index'] = opts[:'index'] if !opts[:'index'].nil? + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LoggingGrafanacloudlogsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"LoggingGrafanacloudlogsApi.create_log_grafanacloudlogs", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoggingGrafanacloudlogsApi#create_log_grafanacloudlogs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete the Grafana Cloud Logs log endpoint + # Delete the Grafana Cloud Logs logging object for a particular service and version. + # @option opts [String] :service_id Alphanumeric string identifying the service. (required) + # @option opts [Integer] :version_id Integer identifying a service version. (required) + # @option opts [String] :logging_grafanacloudlogs_name The name for the real-time logging configuration. (required) + # @return [InlineResponse200] + def delete_log_grafanacloudlogs(opts = {}) + data, _status_code, _headers = delete_log_grafanacloudlogs_with_http_info(opts) + data + end + + # Delete the Grafana Cloud Logs log endpoint + # Delete the Grafana Cloud Logs logging object for a particular service and version. + # @option opts [String] :service_id Alphanumeric string identifying the service. (required) + # @option opts [Integer] :version_id Integer identifying a service version. (required) + # @option opts [String] :logging_grafanacloudlogs_name The name for the real-time logging configuration. (required) + # @return [Array<(InlineResponse200, Integer, Hash)>] InlineResponse200 data, response status code and response headers + def delete_log_grafanacloudlogs_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoggingGrafanacloudlogsApi.delete_log_grafanacloudlogs ...' + end + # unbox the parameters from the hash + service_id = opts[:'service_id'] + version_id = opts[:'version_id'] + logging_grafanacloudlogs_name = opts[:'logging_grafanacloudlogs_name'] + # verify the required parameter 'service_id' is set + if @api_client.config.client_side_validation && service_id.nil? + fail ArgumentError, "Missing the required parameter 'service_id' when calling LoggingGrafanacloudlogsApi.delete_log_grafanacloudlogs" + end + # verify the required parameter 'version_id' is set + if @api_client.config.client_side_validation && version_id.nil? + fail ArgumentError, "Missing the required parameter 'version_id' when calling LoggingGrafanacloudlogsApi.delete_log_grafanacloudlogs" + end + # verify the required parameter 'logging_grafanacloudlogs_name' is set + if @api_client.config.client_side_validation && logging_grafanacloudlogs_name.nil? + fail ArgumentError, "Missing the required parameter 'logging_grafanacloudlogs_name' when calling LoggingGrafanacloudlogsApi.delete_log_grafanacloudlogs" + end + # resource path + local_var_path = '/service/{service_id}/version/{version_id}/logging/grafanacloudlogs/{logging_grafanacloudlogs_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_grafanacloudlogs_name' + '}', CGI.escape(logging_grafanacloudlogs_name.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'InlineResponse200' + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"LoggingGrafanacloudlogsApi.delete_log_grafanacloudlogs", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoggingGrafanacloudlogsApi#delete_log_grafanacloudlogs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a Grafana Cloud Logs log endpoint + # Get the details of a Grafana Cloud Logs logging object for a particular service and version. + # @option opts [String] :service_id Alphanumeric string identifying the service. (required) + # @option opts [Integer] :version_id Integer identifying a service version. (required) + # @option opts [String] :logging_grafanacloudlogs_name The name for the real-time logging configuration. (required) + # @return [LoggingGrafanacloudlogsResponse] + def get_log_grafanacloudlogs(opts = {}) + data, _status_code, _headers = get_log_grafanacloudlogs_with_http_info(opts) + data + end + + # Get a Grafana Cloud Logs log endpoint + # Get the details of a Grafana Cloud Logs logging object for a particular service and version. + # @option opts [String] :service_id Alphanumeric string identifying the service. (required) + # @option opts [Integer] :version_id Integer identifying a service version. (required) + # @option opts [String] :logging_grafanacloudlogs_name The name for the real-time logging configuration. (required) + # @return [Array<(LoggingGrafanacloudlogsResponse, Integer, Hash)>] LoggingGrafanacloudlogsResponse data, response status code and response headers + def get_log_grafanacloudlogs_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoggingGrafanacloudlogsApi.get_log_grafanacloudlogs ...' + end + # unbox the parameters from the hash + service_id = opts[:'service_id'] + version_id = opts[:'version_id'] + logging_grafanacloudlogs_name = opts[:'logging_grafanacloudlogs_name'] + # verify the required parameter 'service_id' is set + if @api_client.config.client_side_validation && service_id.nil? + fail ArgumentError, "Missing the required parameter 'service_id' when calling LoggingGrafanacloudlogsApi.get_log_grafanacloudlogs" + end + # verify the required parameter 'version_id' is set + if @api_client.config.client_side_validation && version_id.nil? + fail ArgumentError, "Missing the required parameter 'version_id' when calling LoggingGrafanacloudlogsApi.get_log_grafanacloudlogs" + end + # verify the required parameter 'logging_grafanacloudlogs_name' is set + if @api_client.config.client_side_validation && logging_grafanacloudlogs_name.nil? + fail ArgumentError, "Missing the required parameter 'logging_grafanacloudlogs_name' when calling LoggingGrafanacloudlogsApi.get_log_grafanacloudlogs" + end + # resource path + local_var_path = '/service/{service_id}/version/{version_id}/logging/grafanacloudlogs/{logging_grafanacloudlogs_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_grafanacloudlogs_name' + '}', CGI.escape(logging_grafanacloudlogs_name.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LoggingGrafanacloudlogsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"LoggingGrafanacloudlogsApi.get_log_grafanacloudlogs", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoggingGrafanacloudlogsApi#get_log_grafanacloudlogs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List Grafana Cloud Logs log endpoints + # List all of the Grafana Cloud Logs logging objects for a particular service and version. + # @option opts [String] :service_id Alphanumeric string identifying the service. (required) + # @option opts [Integer] :version_id Integer identifying a service version. (required) + # @return [Array] + def list_log_grafanacloudlogs(opts = {}) + data, _status_code, _headers = list_log_grafanacloudlogs_with_http_info(opts) + data + end + + # List Grafana Cloud Logs log endpoints + # List all of the Grafana Cloud Logs logging objects for a particular service and version. + # @option opts [String] :service_id Alphanumeric string identifying the service. (required) + # @option opts [Integer] :version_id Integer identifying a service version. (required) + # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers + def list_log_grafanacloudlogs_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoggingGrafanacloudlogsApi.list_log_grafanacloudlogs ...' + end + # unbox the parameters from the hash + service_id = opts[:'service_id'] + version_id = opts[:'version_id'] + # verify the required parameter 'service_id' is set + if @api_client.config.client_side_validation && service_id.nil? + fail ArgumentError, "Missing the required parameter 'service_id' when calling LoggingGrafanacloudlogsApi.list_log_grafanacloudlogs" + end + # verify the required parameter 'version_id' is set + if @api_client.config.client_side_validation && version_id.nil? + fail ArgumentError, "Missing the required parameter 'version_id' when calling LoggingGrafanacloudlogsApi.list_log_grafanacloudlogs" + end + # resource path + local_var_path = '/service/{service_id}/version/{version_id}/logging/grafanacloudlogs'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Array' + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"LoggingGrafanacloudlogsApi.list_log_grafanacloudlogs", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoggingGrafanacloudlogsApi#list_log_grafanacloudlogs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update a Grafana Cloud Logs log endpoint + # Update a Grafana Cloud Logs logging object for a particular service and version. + # @option opts [String] :service_id Alphanumeric string identifying the service. (required) + # @option opts [Integer] :version_id Integer identifying a service version. (required) + # @option opts [String] :logging_grafanacloudlogs_name The name for the real-time logging configuration. (required) + # @option opts [String] :name The name for the real-time logging configuration. + # @option opts [String] :placement Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. + # @option opts [String] :response_condition The name of an existing condition in the configured endpoint, or leave blank to always execute. + # @option opts [String] :format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). + # @option opts [Integer] :format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. (default to FORMAT_VERSION::v2) + # @option opts [String] :user The Grafana Cloud Logs Dataset you want to log to. + # @option opts [String] :url The URL of the Loki instance in your Grafana stack. + # @option opts [String] :token The Grafana Access Policy token with `logs:write` access scoped to your Loki instance. + # @option opts [String] :index The Stream Labels, a JSON string used to identify the stream. + # @return [LoggingGrafanacloudlogsResponse] + def update_log_grafanacloudlogs(opts = {}) + data, _status_code, _headers = update_log_grafanacloudlogs_with_http_info(opts) + data + end + + # Update a Grafana Cloud Logs log endpoint + # Update a Grafana Cloud Logs logging object for a particular service and version. + # @option opts [String] :service_id Alphanumeric string identifying the service. (required) + # @option opts [Integer] :version_id Integer identifying a service version. (required) + # @option opts [String] :logging_grafanacloudlogs_name The name for the real-time logging configuration. (required) + # @option opts [String] :name The name for the real-time logging configuration. + # @option opts [String] :placement Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. + # @option opts [String] :response_condition The name of an existing condition in the configured endpoint, or leave blank to always execute. + # @option opts [String] :format A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). + # @option opts [Integer] :format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. (default to FORMAT_VERSION::v2) + # @option opts [String] :user The Grafana Cloud Logs Dataset you want to log to. + # @option opts [String] :url The URL of the Loki instance in your Grafana stack. + # @option opts [String] :token The Grafana Access Policy token with `logs:write` access scoped to your Loki instance. + # @option opts [String] :index The Stream Labels, a JSON string used to identify the stream. + # @return [Array<(LoggingGrafanacloudlogsResponse, Integer, Hash)>] LoggingGrafanacloudlogsResponse data, response status code and response headers + def update_log_grafanacloudlogs_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LoggingGrafanacloudlogsApi.update_log_grafanacloudlogs ...' + end + # unbox the parameters from the hash + service_id = opts[:'service_id'] + version_id = opts[:'version_id'] + logging_grafanacloudlogs_name = opts[:'logging_grafanacloudlogs_name'] + # verify the required parameter 'service_id' is set + if @api_client.config.client_side_validation && service_id.nil? + fail ArgumentError, "Missing the required parameter 'service_id' when calling LoggingGrafanacloudlogsApi.update_log_grafanacloudlogs" + end + # verify the required parameter 'version_id' is set + if @api_client.config.client_side_validation && version_id.nil? + fail ArgumentError, "Missing the required parameter 'version_id' when calling LoggingGrafanacloudlogsApi.update_log_grafanacloudlogs" + end + # verify the required parameter 'logging_grafanacloudlogs_name' is set + if @api_client.config.client_side_validation && logging_grafanacloudlogs_name.nil? + fail ArgumentError, "Missing the required parameter 'logging_grafanacloudlogs_name' when calling LoggingGrafanacloudlogsApi.update_log_grafanacloudlogs" + end + allowable_values = ["none", "waf_debug", "null"] + if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement']) + fail ArgumentError, "invalid value for \"placement\", must be one of #{allowable_values}" + end + allowable_values = [1, 2] + if @api_client.config.client_side_validation && opts[:'format_version'] && !allowable_values.include?(opts[:'format_version']) + fail ArgumentError, "invalid value for \"format_version\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/service/{service_id}/version/{version_id}/logging/grafanacloudlogs/{logging_grafanacloudlogs_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'logging_grafanacloudlogs_name' + '}', CGI.escape(logging_grafanacloudlogs_name.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['name'] = opts[:'name'] if !opts[:'name'].nil? + form_params['placement'] = opts[:'placement'] if !opts[:'placement'].nil? + form_params['response_condition'] = opts[:'response_condition'] if !opts[:'response_condition'].nil? + form_params['format'] = opts[:'format'] if !opts[:'format'].nil? + form_params['format_version'] = opts[:'format_version'] if !opts[:'format_version'].nil? + form_params['user'] = opts[:'user'] if !opts[:'user'].nil? + form_params['url'] = opts[:'url'] if !opts[:'url'].nil? + form_params['token'] = opts[:'token'] if !opts[:'token'].nil? + form_params['index'] = opts[:'index'] if !opts[:'index'].nil? + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LoggingGrafanacloudlogsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"LoggingGrafanacloudlogsApi.update_log_grafanacloudlogs", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LoggingGrafanacloudlogsApi#update_log_grafanacloudlogs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/fastly/api/object_storage_access_keys_api.rb b/lib/fastly/api/object_storage_access_keys_api.rb new file mode 100644 index 00000000..c15f3743 --- /dev/null +++ b/lib/fastly/api/object_storage_access_keys_api.rb @@ -0,0 +1,263 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'cgi' + +module Fastly + class ObjectStorageAccessKeysApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create an access key + # Create an access key. + # @option opts [AccessKey] :access_key + # @return [AccessKeyResponse] + def create_access_key(opts = {}) + data, _status_code, _headers = create_access_key_with_http_info(opts) + data + end + + # Create an access key + # Create an access key. + # @option opts [AccessKey] :access_key + # @return [Array<(AccessKeyResponse, Integer, Hash)>] AccessKeyResponse data, response status code and response headers + def create_access_key_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ObjectStorageAccessKeysApi.create_access_key ...' + end + # unbox the parameters from the hash + # resource path + local_var_path = '/resources/object-storage/access-keys' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'access_key']) + + # return_type + return_type = opts[:debug_return_type] || 'AccessKeyResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"ObjectStorageAccessKeysApi.create_access_key", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ObjectStorageAccessKeysApi#create_access_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete an access key + # Delete an access key. + # @option opts [String] :access_key (required) + # @return [nil] + def delete_access_key(opts = {}) + delete_access_key_with_http_info(opts) + nil + end + + # Delete an access key + # Delete an access key. + # @option opts [String] :access_key (required) + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_access_key_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ObjectStorageAccessKeysApi.delete_access_key ...' + end + # unbox the parameters from the hash + access_key = opts[:'access_key'] + # verify the required parameter 'access_key' is set + if @api_client.config.client_side_validation && access_key.nil? + fail ArgumentError, "Missing the required parameter 'access_key' when calling ObjectStorageAccessKeysApi.delete_access_key" + end + # resource path + local_var_path = '/resources/object-storage/access-keys/{access_key}'.sub('{' + 'access_key' + '}', CGI.escape(access_key.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"ObjectStorageAccessKeysApi.delete_access_key", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ObjectStorageAccessKeysApi#delete_access_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get an access key + # Get an access key by its identifier. + # @option opts [String] :access_key (required) + # @return [AccessKey] + def get_access_key(opts = {}) + data, _status_code, _headers = get_access_key_with_http_info(opts) + data + end + + # Get an access key + # Get an access key by its identifier. + # @option opts [String] :access_key (required) + # @return [Array<(AccessKey, Integer, Hash)>] AccessKey data, response status code and response headers + def get_access_key_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ObjectStorageAccessKeysApi.get_access_key ...' + end + # unbox the parameters from the hash + access_key = opts[:'access_key'] + # verify the required parameter 'access_key' is set + if @api_client.config.client_side_validation && access_key.nil? + fail ArgumentError, "Missing the required parameter 'access_key' when calling ObjectStorageAccessKeysApi.get_access_key" + end + # resource path + local_var_path = '/resources/object-storage/access-keys/{access_key}'.sub('{' + 'access_key' + '}', CGI.escape(access_key.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'AccessKey' + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"ObjectStorageAccessKeysApi.get_access_key", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ObjectStorageAccessKeysApi#get_access_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List access keys + # List access keys. + # @return [AccessKeyResponse] + def list_access_keys(opts = {}) + data, _status_code, _headers = list_access_keys_with_http_info(opts) + data + end + + # List access keys + # List access keys. + # @return [Array<(AccessKeyResponse, Integer, Hash)>] AccessKeyResponse data, response status code and response headers + def list_access_keys_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ObjectStorageAccessKeysApi.list_access_keys ...' + end + # unbox the parameters from the hash + # resource path + local_var_path = '/resources/object-storage/access-keys' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'AccessKeyResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"ObjectStorageAccessKeysApi.list_access_keys", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ObjectStorageAccessKeysApi#list_access_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/fastly/configuration.rb b/lib/fastly/configuration.rb index b93410db..d1f4b283 100644 --- a/lib/fastly/configuration.rb +++ b/lib/fastly/configuration.rb @@ -542,7 +542,7 @@ def operation_server_settings description: "No description provided", } ], - "BillingUsageMetricsApi.get_service_level_usage_types": [ + "BillingUsageMetricsApi.get_usage_metrics": [ { url: "https://api.fastly.com", description: "No description provided", @@ -1370,6 +1370,12 @@ def operation_server_settings description: "No description provided", } ], + "InsightsApi.get_log_insights": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], "InvitationsApi.create_invitation": [ { url: "https://api.fastly.com", @@ -1604,6 +1610,12 @@ def operation_server_settings description: "No description provided", } ], + "LogExplorerApi.get_log_records": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], "LoggingAzureblobApi.create_log_azure": [ { url: "https://api.fastly.com", @@ -1844,6 +1856,36 @@ def operation_server_settings description: "No description provided", } ], + "LoggingGrafanacloudlogsApi.create_log_grafanacloudlogs": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], + "LoggingGrafanacloudlogsApi.delete_log_grafanacloudlogs": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], + "LoggingGrafanacloudlogsApi.get_log_grafanacloudlogs": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], + "LoggingGrafanacloudlogsApi.list_log_grafanacloudlogs": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], + "LoggingGrafanacloudlogsApi.update_log_grafanacloudlogs": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], "LoggingHerokuApi.create_log_heroku": [ { url: "https://api.fastly.com", @@ -2444,6 +2486,30 @@ def operation_server_settings description: "No description provided", } ], + "ObjectStorageAccessKeysApi.create_access_key": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], + "ObjectStorageAccessKeysApi.delete_access_key": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], + "ObjectStorageAccessKeysApi.get_access_key": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], + "ObjectStorageAccessKeysApi.list_access_keys": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], "ObservabilityCustomDashboardsApi.create_dashboard": [ { url: "https://api.fastly.com", diff --git a/lib/fastly/models/access_key.rb b/lib/fastly/models/access_key.rb new file mode 100644 index 00000000..88cf906f --- /dev/null +++ b/lib/fastly/models/access_key.rb @@ -0,0 +1,248 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class AccessKey + # A description of the access key. + attr_accessor :description + + # The permissions granted to an access key. + attr_accessor :permission + + attr_accessor :buckets + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'description' => :'description', + :'permission' => :'permission', + :'buckets' => :'buckets' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'description' => :'String', + :'permission' => :'String', + :'buckets' => :'Array' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::AccessKey` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::AccessKey`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'permission') + self.permission = attributes[:'permission'] + end + + if attributes.key?(:'buckets') + if (value = attributes[:'buckets']).is_a?(Array) + self.buckets = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @description.nil? + invalid_properties.push('invalid value for "description", description cannot be nil.') + end + + if @permission.nil? + invalid_properties.push('invalid value for "permission", permission cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @description.nil? + return false if @permission.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + permission == o.permission && + buckets == o.buckets + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [description, permission, buckets].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/access_key_response.rb b/lib/fastly/models/access_key_response.rb new file mode 100644 index 00000000..4525f7a4 --- /dev/null +++ b/lib/fastly/models/access_key_response.rb @@ -0,0 +1,269 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class AccessKeyResponse + # Generated access key. + attr_accessor :access_key + + # Generated secret key. + attr_accessor :secret_key + + # Description for the access key. + attr_accessor :description + + # Permissions granted to an access key. + attr_accessor :permission + + attr_accessor :buckets + + # Date and time in ISO 8601 format. + attr_accessor :created_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'access_key' => :'access_key', + :'secret_key' => :'secret_key', + :'description' => :'description', + :'permission' => :'permission', + :'buckets' => :'buckets', + :'created_at' => :'created_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'access_key' => :'String', + :'secret_key' => :'String', + :'description' => :'String', + :'permission' => :'String', + :'buckets' => :'Array', + :'created_at' => :'Time' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + :'created_at' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::AccessKeyResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::AccessKeyResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'access_key') + self.access_key = attributes[:'access_key'] + end + + if attributes.key?(:'secret_key') + self.secret_key = attributes[:'secret_key'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'permission') + self.permission = attributes[:'permission'] + end + + if attributes.key?(:'buckets') + if (value = attributes[:'buckets']).is_a?(Array) + self.buckets = value + end + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + access_key == o.access_key && + secret_key == o.secret_key && + description == o.description && + permission == o.permission && + buckets == o.buckets && + created_at == o.created_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [access_key, secret_key, description, permission, buckets, created_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/backend.rb b/lib/fastly/models/backend.rb index 0330f280..d564c9d0 100644 --- a/lib/fastly/models/backend.rb +++ b/lib/fastly/models/backend.rb @@ -28,10 +28,10 @@ class Backend # A freeform descriptive note. attr_accessor :comment - # Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. + # Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. attr_accessor :connect_timeout - # Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. + # Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. attr_accessor :first_byte_timeout # The name of the healthcheck to use with this backend. diff --git a/lib/fastly/models/backend_response.rb b/lib/fastly/models/backend_response.rb index 561d8071..21459edc 100644 --- a/lib/fastly/models/backend_response.rb +++ b/lib/fastly/models/backend_response.rb @@ -28,10 +28,10 @@ class BackendResponse # A freeform descriptive note. attr_accessor :comment - # Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. + # Maximum duration in milliseconds to wait for a connection to this backend to be established. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.connect_timeout`. attr_accessor :connect_timeout - # Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthethic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. + # Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent. If exceeded, the connection is aborted and a synthetic `503` response will be presented instead. May be set at runtime using `bereq.first_byte_timeout`. attr_accessor :first_byte_timeout # The name of the healthcheck to use with this backend. diff --git a/lib/fastly/models/compute_acl_list_entries.rb b/lib/fastly/models/compute_acl_list_entries.rb index d8caa6b3..76dc5ee2 100644 --- a/lib/fastly/models/compute_acl_list_entries.rb +++ b/lib/fastly/models/compute_acl_list_entries.rb @@ -12,7 +12,7 @@ require 'time' module Fastly - # An example of an ACL List Response. + # Defines the structure of what the ACL List endpoint returns. class ComputeAclListEntries attr_accessor :meta diff --git a/lib/fastly/models/compute_acl_lookup.rb b/lib/fastly/models/compute_acl_lookup.rb index a10463b8..710bfee3 100644 --- a/lib/fastly/models/compute_acl_lookup.rb +++ b/lib/fastly/models/compute_acl_lookup.rb @@ -12,7 +12,7 @@ require 'time' module Fastly - # An example of an ACL Lookup response. + # Defines the structure of an ACL Lookup response. class ComputeAclLookup # A valid IPv4 or IPv6 address. attr_accessor :prefix diff --git a/lib/fastly/models/compute_acl_update.rb b/lib/fastly/models/compute_acl_update.rb new file mode 100644 index 00000000..9c937ece --- /dev/null +++ b/lib/fastly/models/compute_acl_update.rb @@ -0,0 +1,219 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + # Defines the structure of an ACL update request array. + class ComputeAclUpdate + attr_accessor :entries + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'entries' => :'entries' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'entries' => :'Array' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::ComputeAclUpdate` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ComputeAclUpdate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'entries') + if (value = attributes[:'entries']).is_a?(Array) + self.entries = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + entries == o.entries + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [entries].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/compute_acl_update_entry.rb b/lib/fastly/models/compute_acl_update_entry.rb index 71b160fb..afeded55 100644 --- a/lib/fastly/models/compute_acl_update_entry.rb +++ b/lib/fastly/models/compute_acl_update_entry.rb @@ -12,7 +12,7 @@ require 'time' module Fastly - # An example of an ACL update request entry. + # Defines the structure of an ACL update request entry. class ComputeAclUpdateEntry # One of \"create\" or \"update\", indicating that the rest of this entry is to be added to/updated in the ACL. attr_accessor :op diff --git a/lib/fastly/models/dimension_attributes_country_stats.rb b/lib/fastly/models/dimension_attributes_country_stats.rb new file mode 100644 index 00000000..8408dfd0 --- /dev/null +++ b/lib/fastly/models/dimension_attributes_country_stats.rb @@ -0,0 +1,237 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class DimensionAttributesCountryStats + # The cache hit ratio for the country. + attr_accessor :country_chr + + # The error rate for the country. + attr_accessor :country_error_rate + + # This country's percentage of the total requests. + attr_accessor :country_request_rate + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'country_chr' => :'country_chr', + :'country_error_rate' => :'country_error_rate', + :'country_request_rate' => :'country_request_rate' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'country_chr' => :'Float', + :'country_error_rate' => :'Float', + :'country_request_rate' => :'Float' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::DimensionAttributesCountryStats` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::DimensionAttributesCountryStats`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'country_chr') + self.country_chr = attributes[:'country_chr'] + end + + if attributes.key?(:'country_error_rate') + self.country_error_rate = attributes[:'country_error_rate'] + end + + if attributes.key?(:'country_request_rate') + self.country_request_rate = attributes[:'country_request_rate'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + country_chr == o.country_chr && + country_error_rate == o.country_error_rate && + country_request_rate == o.country_request_rate + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [country_chr, country_error_rate, country_request_rate].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/dimension_attributes_rate.rb b/lib/fastly/models/dimension_attributes_rate.rb new file mode 100644 index 00000000..b9c38e9d --- /dev/null +++ b/lib/fastly/models/dimension_attributes_rate.rb @@ -0,0 +1,217 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class DimensionAttributesRate + # The rate at which the value in the current dimension occurs. + attr_accessor :rate + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'rate' => :'rate' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'rate' => :'Float' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::DimensionAttributesRate` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::DimensionAttributesRate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'rate') + self.rate = attributes[:'rate'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rate == o.rate + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [rate].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/dimension_browser.rb b/lib/fastly/models/dimension_browser.rb new file mode 100644 index 00000000..d7614a62 --- /dev/null +++ b/lib/fastly/models/dimension_browser.rb @@ -0,0 +1,217 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class DimensionBrowser + # The client's browser for this dimension. + attr_accessor :browser + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'browser' => :'browser' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'browser' => :'String' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::DimensionBrowser` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::DimensionBrowser`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'browser') + self.browser = attributes[:'browser'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + browser == o.browser + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [browser].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/dimension_content_type.rb b/lib/fastly/models/dimension_content_type.rb new file mode 100644 index 00000000..b43479fd --- /dev/null +++ b/lib/fastly/models/dimension_content_type.rb @@ -0,0 +1,217 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class DimensionContentType + # The content type of the response for this dimension. + attr_accessor :content_type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'content_type' => :'content_type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'content_type' => :'String' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::DimensionContentType` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::DimensionContentType`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'content_type') + self.content_type = attributes[:'content_type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + content_type == o.content_type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [content_type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/dimension_country.rb b/lib/fastly/models/dimension_country.rb new file mode 100644 index 00000000..07cccedf --- /dev/null +++ b/lib/fastly/models/dimension_country.rb @@ -0,0 +1,217 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class DimensionCountry + # The client's country for this dimension. + attr_accessor :country + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'country' => :'country' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'country' => :'String' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::DimensionCountry` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::DimensionCountry`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + country == o.country + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [country].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/dimension_device.rb b/lib/fastly/models/dimension_device.rb new file mode 100644 index 00000000..87242da2 --- /dev/null +++ b/lib/fastly/models/dimension_device.rb @@ -0,0 +1,217 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class DimensionDevice + # The client's device type for this dimension. + attr_accessor :device + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'device' => :'device' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'device' => :'String' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::DimensionDevice` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::DimensionDevice`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'device') + self.device = attributes[:'device'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + device == o.device + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [device].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/dimension_os.rb b/lib/fastly/models/dimension_os.rb new file mode 100644 index 00000000..5b714fc2 --- /dev/null +++ b/lib/fastly/models/dimension_os.rb @@ -0,0 +1,217 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class DimensionOs + # The client's operating system for this dimension. + attr_accessor :os + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'os' => :'os' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'os' => :'String' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::DimensionOs` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::DimensionOs`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'os') + self.os = attributes[:'os'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + os == o.os + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [os].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/dimension_response.rb b/lib/fastly/models/dimension_response.rb new file mode 100644 index 00000000..f969580e --- /dev/null +++ b/lib/fastly/models/dimension_response.rb @@ -0,0 +1,217 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class DimensionResponse + # The HTTP reason phrase for this dimension. + attr_accessor :response + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'response' => :'response' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'response' => :'String' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::DimensionResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::DimensionResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'response') + self.response = attributes[:'response'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + response == o.response + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [response].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/dimension_status_code.rb b/lib/fastly/models/dimension_status_code.rb new file mode 100644 index 00000000..658c3d59 --- /dev/null +++ b/lib/fastly/models/dimension_status_code.rb @@ -0,0 +1,217 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class DimensionStatusCode + # The HTTP response code for this dimension. + attr_accessor :status_code + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'status_code' => :'status-code' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'status_code' => :'String' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::DimensionStatusCode` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::DimensionStatusCode`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'status_code') + self.status_code = attributes[:'status_code'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + status_code == o.status_code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [status_code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/dimension_url.rb b/lib/fastly/models/dimension_url.rb new file mode 100644 index 00000000..4b91bea2 --- /dev/null +++ b/lib/fastly/models/dimension_url.rb @@ -0,0 +1,217 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class DimensionUrl + # The URL path for this dimension. + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::DimensionUrl` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::DimensionUrl`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/filter_field_item.rb b/lib/fastly/models/filter_field_item.rb new file mode 100644 index 00000000..f5061ac6 --- /dev/null +++ b/lib/fastly/models/filter_field_item.rb @@ -0,0 +1,271 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + # A filtering parameter. + class FilterFieldItem + # The log field to which this filter should be applied. + attr_accessor :field + + # The comparison operator used for this filter. + attr_accessor :operator + + attr_accessor :value + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'field' => :'field', + :'operator' => :'operator', + :'value' => :'value' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'field' => :'String', + :'operator' => :'String', + :'value' => :'ValueField' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::FilterFieldItem` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::FilterFieldItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'field') + self.field = attributes[:'field'] + end + + if attributes.key?(:'operator') + self.operator = attributes[:'operator'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + operator_validator = EnumAttributeValidator.new('String', ["eq", "ends-with", "in", "not_in", "gt", "gte", "lt", "lte"]) + return false unless operator_validator.valid?(@operator) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] operator Object to be assigned + def operator=(operator) + validator = EnumAttributeValidator.new('String', ["eq", "ends-with", "in", "not_in", "gt", "gte", "lt", "lte"]) + unless validator.valid?(operator) + fail ArgumentError, "invalid value for \"operator\", must be one of #{validator.allowable_values}." + end + @operator = operator + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + field == o.field && + operator == o.operator && + value == o.value + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [field, operator, value].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/get_log_insights_response.rb b/lib/fastly/models/get_log_insights_response.rb new file mode 100644 index 00000000..3ef350a6 --- /dev/null +++ b/lib/fastly/models/get_log_insights_response.rb @@ -0,0 +1,227 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class GetLogInsightsResponse + attr_accessor :data + + attr_accessor :meta + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data', + :'meta' => :'meta' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'data' => :'Array', + :'meta' => :'LogInsightsMeta' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::GetLogInsightsResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::GetLogInsightsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + meta == o.meta + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data, meta].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/get_log_records_response.rb b/lib/fastly/models/get_log_records_response.rb new file mode 100644 index 00000000..b4f3aac0 --- /dev/null +++ b/lib/fastly/models/get_log_records_response.rb @@ -0,0 +1,227 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class GetLogRecordsResponse + attr_accessor :data + + attr_accessor :meta + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data', + :'meta' => :'meta' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'data' => :'Array', + :'meta' => :'GetLogRecordsResponseMeta' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::GetLogRecordsResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::GetLogRecordsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + meta == o.meta + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data, meta].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/get_log_records_response_meta.rb b/lib/fastly/models/get_log_records_response_meta.rb new file mode 100644 index 00000000..cc8b39b3 --- /dev/null +++ b/lib/fastly/models/get_log_records_response_meta.rb @@ -0,0 +1,216 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class GetLogRecordsResponseMeta + attr_accessor :filters + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'filters' => :'filters' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'filters' => :'GetLogRecordsResponseMetaFilters' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::GetLogRecordsResponseMeta` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::GetLogRecordsResponseMeta`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'filters') + self.filters = attributes[:'filters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + filters == o.filters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [filters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/get_log_records_response_meta_filters.rb b/lib/fastly/models/get_log_records_response_meta_filters.rb new file mode 100644 index 00000000..b8ea0036 --- /dev/null +++ b/lib/fastly/models/get_log_records_response_meta_filters.rb @@ -0,0 +1,307 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + # Echoes the filters that were supplied in the request. + class GetLogRecordsResponseMetaFilters + # Specifies the ID of the service for which data should be returned. + attr_accessor :service_id + + # Start time for the query as supplied in the request. + attr_accessor :start + + # End time for the query as supplied in the request. + attr_accessor :_end + + # Value of the `domain_exact_match` filter as supplied in the request. + attr_accessor :domain_exact_match + + # Number of records per page. + attr_accessor :limit + + # A cursor to specify the next page of results, if any. + attr_accessor :next_cursor + + attr_accessor :filter_fields + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'service_id' => :'service_id', + :'start' => :'start', + :'_end' => :'end', + :'domain_exact_match' => :'domain_exact_match', + :'limit' => :'limit', + :'next_cursor' => :'next_cursor', + :'filter_fields' => :'filter_fields' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'service_id' => :'String', + :'start' => :'String', + :'_end' => :'String', + :'domain_exact_match' => :'Boolean', + :'limit' => :'Integer', + :'next_cursor' => :'String', + :'filter_fields' => :'Array' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + :'next_cursor', + :'filter_fields' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::GetLogRecordsResponseMetaFilters` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::GetLogRecordsResponseMetaFilters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'service_id') + self.service_id = attributes[:'service_id'] + end + + if attributes.key?(:'start') + self.start = attributes[:'start'] + end + + if attributes.key?(:'_end') + self._end = attributes[:'_end'] + end + + if attributes.key?(:'domain_exact_match') + self.domain_exact_match = attributes[:'domain_exact_match'] + end + + if attributes.key?(:'limit') + self.limit = attributes[:'limit'] + else + self.limit = 20 + end + + if attributes.key?(:'next_cursor') + self.next_cursor = attributes[:'next_cursor'] + end + + if attributes.key?(:'filter_fields') + if (value = attributes[:'filter_fields']).is_a?(Array) + self.filter_fields = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@limit.nil? && @limit > 100 + invalid_properties.push('invalid value for "limit", must be smaller than or equal to 100.') + end + + if !@limit.nil? && @limit < 1 + invalid_properties.push('invalid value for "limit", must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@limit.nil? && @limit > 100 + return false if !@limit.nil? && @limit < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] limit Value to be assigned + def limit=(limit) + if !limit.nil? && limit > 100 + fail ArgumentError, 'invalid value for "limit", must be smaller than or equal to 100.' + end + + if !limit.nil? && limit < 1 + fail ArgumentError, 'invalid value for "limit", must be greater than or equal to 1.' + end + + @limit = limit + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + service_id == o.service_id && + start == o.start && + _end == o._end && + domain_exact_match == o.domain_exact_match && + limit == o.limit && + next_cursor == o.next_cursor && + filter_fields == o.filter_fields + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [service_id, start, _end, domain_exact_match, limit, next_cursor, filter_fields].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/log_insights.rb b/lib/fastly/models/log_insights.rb new file mode 100644 index 00000000..7edd712b --- /dev/null +++ b/lib/fastly/models/log_insights.rb @@ -0,0 +1,234 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class LogInsights + attr_accessor :dimensions + + attr_accessor :dimension_attributes + + attr_accessor :values + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'dimensions' => :'dimensions', + :'dimension_attributes' => :'dimension_attributes', + :'values' => :'values' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'dimensions' => :'LogInsightsDimensions', + :'dimension_attributes' => :'LogInsightsDimensionAttributes', + :'values' => :'LogInsightsValues' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::LogInsights` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::LogInsights`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'dimensions') + self.dimensions = attributes[:'dimensions'] + end + + if attributes.key?(:'dimension_attributes') + self.dimension_attributes = attributes[:'dimension_attributes'] + end + + if attributes.key?(:'values') + self.values = attributes[:'values'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + dimensions == o.dimensions && + dimension_attributes == o.dimension_attributes && + values == o.values + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [dimensions, dimension_attributes, values].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/log_insights_dimension_attributes.rb b/lib/fastly/models/log_insights_dimension_attributes.rb new file mode 100644 index 00000000..8dacb2e6 --- /dev/null +++ b/lib/fastly/models/log_insights_dimension_attributes.rb @@ -0,0 +1,103 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + module LogInsightsDimensionAttributes + class << self + # List of class defined in oneOf (OpenAPI v3) + def fastly_one_of + [ + :'DimensionAttributesCountryStats', + :'DimensionAttributesRate' + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + fastly_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + fastly_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when 'Boolean' + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when 'Float' + return data if data.instance_of?(Float) + when 'Integer' + return data if data.instance_of?(Integer) + when 'Time' + return Time.parse(data) + when 'Date' + return Date.parse(data) + when 'String' + return data if data.instance_of?(String) + when 'Object' # "type: object" + return data if data.instance_of?(Hash) + when /\AArray<(?.+)>\z/ # "type: array" + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + else # model + const = Fastly.const_get(klass) + if const + if const.respond_to?(:fastly_one_of) # nested oneOf model + model = const.build(data) + return model if model + else + # raise if data contains keys that are not known to the model + raise unless (data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + return model if model && model.valid? + end + end + end + + raise # if no match by now, raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + +end diff --git a/lib/fastly/models/log_insights_dimensions.rb b/lib/fastly/models/log_insights_dimensions.rb new file mode 100644 index 00000000..e7565772 --- /dev/null +++ b/lib/fastly/models/log_insights_dimensions.rb @@ -0,0 +1,109 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + module LogInsightsDimensions + class << self + # List of class defined in oneOf (OpenAPI v3) + def fastly_one_of + [ + :'DimensionBrowser', + :'DimensionContentType', + :'DimensionCountry', + :'DimensionDevice', + :'DimensionOs', + :'DimensionResponse', + :'DimensionStatusCode', + :'DimensionUrl' + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + fastly_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + fastly_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when 'Boolean' + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when 'Float' + return data if data.instance_of?(Float) + when 'Integer' + return data if data.instance_of?(Integer) + when 'Time' + return Time.parse(data) + when 'Date' + return Date.parse(data) + when 'String' + return data if data.instance_of?(String) + when 'Object' # "type: object" + return data if data.instance_of?(Hash) + when /\AArray<(?.+)>\z/ # "type: array" + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + else # model + const = Fastly.const_get(klass) + if const + if const.respond_to?(:fastly_one_of) # nested oneOf model + model = const.build(data) + return model if model + else + # raise if data contains keys that are not known to the model + raise unless (data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + return model if model && model.valid? + end + end + end + + raise # if no match by now, raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + +end diff --git a/lib/fastly/models/log_insights_meta.rb b/lib/fastly/models/log_insights_meta.rb new file mode 100644 index 00000000..46a10888 --- /dev/null +++ b/lib/fastly/models/log_insights_meta.rb @@ -0,0 +1,217 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + # Echoes the filters that were supplied in the request. + class LogInsightsMeta + attr_accessor :filters + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'filters' => :'filters' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'filters' => :'LogInsightsMetaFilter' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::LogInsightsMeta` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::LogInsightsMeta`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'filters') + self.filters = attributes[:'filters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + filters == o.filters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [filters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/log_insights_meta_filter.rb b/lib/fastly/models/log_insights_meta_filter.rb new file mode 100644 index 00000000..4e37ae9e --- /dev/null +++ b/lib/fastly/models/log_insights_meta_filter.rb @@ -0,0 +1,284 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + # The filters that were supplied in the request. + class LogInsightsMetaFilter + # Specifies the ID of the service for which data should be returned. + attr_accessor :service_id + + # Start time for the query as supplied in the request. + attr_accessor :start + + # End time for the query as supplied in the request. + attr_accessor :_end + + # Value of the `domain_exact_match` filter as supplied in the request. + attr_accessor :domain_exact_match + + # Number of records per page. + attr_accessor :limit + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'service_id' => :'service_id', + :'start' => :'start', + :'_end' => :'end', + :'domain_exact_match' => :'domain_exact_match', + :'limit' => :'limit' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'service_id' => :'String', + :'start' => :'String', + :'_end' => :'String', + :'domain_exact_match' => :'Boolean', + :'limit' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::LogInsightsMetaFilter` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::LogInsightsMetaFilter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'service_id') + self.service_id = attributes[:'service_id'] + end + + if attributes.key?(:'start') + self.start = attributes[:'start'] + end + + if attributes.key?(:'_end') + self._end = attributes[:'_end'] + end + + if attributes.key?(:'domain_exact_match') + self.domain_exact_match = attributes[:'domain_exact_match'] + end + + if attributes.key?(:'limit') + self.limit = attributes[:'limit'] + else + self.limit = 20 + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@limit.nil? && @limit > 100 + invalid_properties.push('invalid value for "limit", must be smaller than or equal to 100.') + end + + if !@limit.nil? && @limit < 1 + invalid_properties.push('invalid value for "limit", must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@limit.nil? && @limit > 100 + return false if !@limit.nil? && @limit < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] limit Value to be assigned + def limit=(limit) + if !limit.nil? && limit > 100 + fail ArgumentError, 'invalid value for "limit", must be smaller than or equal to 100.' + end + + if !limit.nil? && limit < 1 + fail ArgumentError, 'invalid value for "limit", must be greater than or equal to 1.' + end + + @limit = limit + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + service_id == o.service_id && + start == o.start && + _end == o._end && + domain_exact_match == o.domain_exact_match && + limit == o.limit + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [service_id, start, _end, domain_exact_match, limit].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/log_insights_values.rb b/lib/fastly/models/log_insights_values.rb new file mode 100644 index 00000000..868a0668 --- /dev/null +++ b/lib/fastly/models/log_insights_values.rb @@ -0,0 +1,111 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + module LogInsightsValues + class << self + # List of class defined in oneOf (OpenAPI v3) + def fastly_one_of + [ + :'Values503Responses', + :'ValuesBandwidth', + :'ValuesBrowser', + :'ValuesCacheHitRatio', + :'ValuesCountryStats', + :'ValuesDuration', + :'ValuesMisses', + :'ValuesRate', + :'ValuesRequests', + :'ValuesStatusCodes' + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + fastly_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + fastly_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when 'Boolean' + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when 'Float' + return data if data.instance_of?(Float) + when 'Integer' + return data if data.instance_of?(Integer) + when 'Time' + return Time.parse(data) + when 'Date' + return Date.parse(data) + when 'String' + return data if data.instance_of?(String) + when 'Object' # "type: object" + return data if data.instance_of?(Hash) + when /\AArray<(?.+)>\z/ # "type: array" + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + else # model + const = Fastly.const_get(klass) + if const + if const.respond_to?(:fastly_one_of) # nested oneOf model + model = const.build(data) + return model if model + else + # raise if data contains keys that are not known to the model + raise unless (data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + return model if model && model.valid? + end + end + end + + raise # if no match by now, raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + +end diff --git a/lib/fastly/models/log_property_service_id.rb b/lib/fastly/models/log_property_service_id.rb new file mode 100644 index 00000000..8ca026a6 --- /dev/null +++ b/lib/fastly/models/log_property_service_id.rb @@ -0,0 +1,208 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + # The ID of the service that received the request. + class LogPropertyServiceId + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::LogPropertyServiceId` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::LogPropertyServiceId`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/log_record.rb b/lib/fastly/models/log_record.rb new file mode 100644 index 00000000..37610039 --- /dev/null +++ b/lib/fastly/models/log_record.rb @@ -0,0 +1,486 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class LogRecord + # The ID of the Fastly customer that owns the service. + attr_accessor :customer_id + + attr_accessor :service_id + + # Timestamp of the request in ISO 8601 format. + attr_accessor :timestamp + + # The autonomous system (AS) number of the client. + attr_accessor :client_as_number + + # The client's country subdivision code as found in ISO 3166-2. + attr_accessor :client_region + + # The two-letter ISO 3166-1 country code for the client. + attr_accessor :client_country_code + + # The name of the operating system installed on the client device. + attr_accessor :client_os_name + + # The type of the client's device. + attr_accessor :client_device_type + + # The name of the browser in use on the client device. + attr_accessor :client_browser_name + + # The version of the browser in use on client device. + attr_accessor :client_browser_version + + # The name of the Fastly POP that served this request. + attr_accessor :fastly_pop + + # The name of the origin host that served this request. + attr_accessor :origin_host + + # HTTP protocol version in use for this request. For example, HTTP/1.1. + attr_accessor :request_protocol + + # The name of the request host used for this request. + attr_accessor :request_host + + # The URL path supplied for this request. + attr_accessor :request_path + + # HTTP method sent by the client such as \"GET\" or \"POST\". + attr_accessor :request_method + + # Body bytes sent to the client in the response. + attr_accessor :response_bytes_body + + # Header bytes sent to the client in the response. + attr_accessor :response_bytes_header + + # Total bytes sent to the client in the response. + attr_accessor :response_content_length + + # The content type of the response sent to the client. + attr_accessor :response_content_type + + # The HTTP reason phrase returned for this request, if any. + attr_accessor :response_reason + + # The state of the request with optional suffixes describing special cases. + attr_accessor :response_state + + # The HTTP response code returned for this request. + attr_accessor :response_status + + # The time since the request started in seconds. + attr_accessor :response_time + + # Indicates whether the request was a HIT or a MISS. + attr_accessor :response_x_cache + + # Indicates whether this request was fulfilled from cache. + attr_accessor :is_cache_hit + + # Indicates whether the request was handled by a Fastly edge POP. + attr_accessor :is_edge + + # Indicates whether the request was handled by a Fastly shield POP. + attr_accessor :is_shield + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'customer_id' => :'customer_id', + :'service_id' => :'service_id', + :'timestamp' => :'timestamp', + :'client_as_number' => :'client_as_number', + :'client_region' => :'client_region', + :'client_country_code' => :'client_country_code', + :'client_os_name' => :'client_os_name', + :'client_device_type' => :'client_device_type', + :'client_browser_name' => :'client_browser_name', + :'client_browser_version' => :'client_browser_version', + :'fastly_pop' => :'fastly_pop', + :'origin_host' => :'origin_host', + :'request_protocol' => :'request_protocol', + :'request_host' => :'request_host', + :'request_path' => :'request_path', + :'request_method' => :'request_method', + :'response_bytes_body' => :'response_bytes_body', + :'response_bytes_header' => :'response_bytes_header', + :'response_content_length' => :'response_content_length', + :'response_content_type' => :'response_content_type', + :'response_reason' => :'response_reason', + :'response_state' => :'response_state', + :'response_status' => :'response_status', + :'response_time' => :'response_time', + :'response_x_cache' => :'response_x_cache', + :'is_cache_hit' => :'is_cache_hit', + :'is_edge' => :'is_edge', + :'is_shield' => :'is_shield' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'customer_id' => :'String', + :'service_id' => :'LogPropertyServiceId', + :'timestamp' => :'Time', + :'client_as_number' => :'Integer', + :'client_region' => :'String', + :'client_country_code' => :'String', + :'client_os_name' => :'String', + :'client_device_type' => :'String', + :'client_browser_name' => :'String', + :'client_browser_version' => :'String', + :'fastly_pop' => :'String', + :'origin_host' => :'String', + :'request_protocol' => :'String', + :'request_host' => :'String', + :'request_path' => :'String', + :'request_method' => :'String', + :'response_bytes_body' => :'Integer', + :'response_bytes_header' => :'Integer', + :'response_content_length' => :'Integer', + :'response_content_type' => :'String', + :'response_reason' => :'String', + :'response_state' => :'String', + :'response_status' => :'Integer', + :'response_time' => :'Float', + :'response_x_cache' => :'String', + :'is_cache_hit' => :'Boolean', + :'is_edge' => :'Boolean', + :'is_shield' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::LogRecord` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::LogRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'service_id') + self.service_id = attributes[:'service_id'] + end + + if attributes.key?(:'timestamp') + self.timestamp = attributes[:'timestamp'] + end + + if attributes.key?(:'client_as_number') + self.client_as_number = attributes[:'client_as_number'] + end + + if attributes.key?(:'client_region') + self.client_region = attributes[:'client_region'] + end + + if attributes.key?(:'client_country_code') + self.client_country_code = attributes[:'client_country_code'] + end + + if attributes.key?(:'client_os_name') + self.client_os_name = attributes[:'client_os_name'] + end + + if attributes.key?(:'client_device_type') + self.client_device_type = attributes[:'client_device_type'] + end + + if attributes.key?(:'client_browser_name') + self.client_browser_name = attributes[:'client_browser_name'] + end + + if attributes.key?(:'client_browser_version') + self.client_browser_version = attributes[:'client_browser_version'] + end + + if attributes.key?(:'fastly_pop') + self.fastly_pop = attributes[:'fastly_pop'] + end + + if attributes.key?(:'origin_host') + self.origin_host = attributes[:'origin_host'] + end + + if attributes.key?(:'request_protocol') + self.request_protocol = attributes[:'request_protocol'] + end + + if attributes.key?(:'request_host') + self.request_host = attributes[:'request_host'] + end + + if attributes.key?(:'request_path') + self.request_path = attributes[:'request_path'] + end + + if attributes.key?(:'request_method') + self.request_method = attributes[:'request_method'] + end + + if attributes.key?(:'response_bytes_body') + self.response_bytes_body = attributes[:'response_bytes_body'] + end + + if attributes.key?(:'response_bytes_header') + self.response_bytes_header = attributes[:'response_bytes_header'] + end + + if attributes.key?(:'response_content_length') + self.response_content_length = attributes[:'response_content_length'] + end + + if attributes.key?(:'response_content_type') + self.response_content_type = attributes[:'response_content_type'] + end + + if attributes.key?(:'response_reason') + self.response_reason = attributes[:'response_reason'] + end + + if attributes.key?(:'response_state') + self.response_state = attributes[:'response_state'] + end + + if attributes.key?(:'response_status') + self.response_status = attributes[:'response_status'] + end + + if attributes.key?(:'response_time') + self.response_time = attributes[:'response_time'] + end + + if attributes.key?(:'response_x_cache') + self.response_x_cache = attributes[:'response_x_cache'] + end + + if attributes.key?(:'is_cache_hit') + self.is_cache_hit = attributes[:'is_cache_hit'] + end + + if attributes.key?(:'is_edge') + self.is_edge = attributes[:'is_edge'] + end + + if attributes.key?(:'is_shield') + self.is_shield = attributes[:'is_shield'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + customer_id == o.customer_id && + service_id == o.service_id && + timestamp == o.timestamp && + client_as_number == o.client_as_number && + client_region == o.client_region && + client_country_code == o.client_country_code && + client_os_name == o.client_os_name && + client_device_type == o.client_device_type && + client_browser_name == o.client_browser_name && + client_browser_version == o.client_browser_version && + fastly_pop == o.fastly_pop && + origin_host == o.origin_host && + request_protocol == o.request_protocol && + request_host == o.request_host && + request_path == o.request_path && + request_method == o.request_method && + response_bytes_body == o.response_bytes_body && + response_bytes_header == o.response_bytes_header && + response_content_length == o.response_content_length && + response_content_type == o.response_content_type && + response_reason == o.response_reason && + response_state == o.response_state && + response_status == o.response_status && + response_time == o.response_time && + response_x_cache == o.response_x_cache && + is_cache_hit == o.is_cache_hit && + is_edge == o.is_edge && + is_shield == o.is_shield + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [customer_id, service_id, timestamp, client_as_number, client_region, client_country_code, client_os_name, client_device_type, client_browser_name, client_browser_version, fastly_pop, origin_host, request_protocol, request_host, request_path, request_method, response_bytes_body, response_bytes_header, response_content_length, response_content_type, response_reason, response_state, response_status, response_time, response_x_cache, is_cache_hit, is_edge, is_shield].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/logging_grafanacloudlogs_additional.rb b/lib/fastly/models/logging_grafanacloudlogs_additional.rb new file mode 100644 index 00000000..3f218003 --- /dev/null +++ b/lib/fastly/models/logging_grafanacloudlogs_additional.rb @@ -0,0 +1,257 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class LoggingGrafanacloudlogsAdditional + # A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). + attr_accessor :format + + # The Grafana Cloud Logs Dataset you want to log to. + attr_accessor :user + + # The URL of the Loki instance in your Grafana stack. + attr_accessor :url + + # The Grafana Access Policy token with `logs:write` access scoped to your Loki instance. + attr_accessor :token + + # The Stream Labels, a JSON string used to identify the stream. + attr_accessor :index + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'format' => :'format', + :'user' => :'user', + :'url' => :'url', + :'token' => :'token', + :'index' => :'index' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'format' => :'String', + :'user' => :'String', + :'url' => :'String', + :'token' => :'String', + :'index' => :'String' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::LoggingGrafanacloudlogsAdditional` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::LoggingGrafanacloudlogsAdditional`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'format') + self.format = attributes[:'format'] + end + + if attributes.key?(:'user') + self.user = attributes[:'user'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + + if attributes.key?(:'token') + self.token = attributes[:'token'] + end + + if attributes.key?(:'index') + self.index = attributes[:'index'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + format == o.format && + user == o.user && + url == o.url && + token == o.token && + index == o.index + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [format, user, url, token, index].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/logging_grafanacloudlogs_response.rb b/lib/fastly/models/logging_grafanacloudlogs_response.rb new file mode 100644 index 00000000..83374e6f --- /dev/null +++ b/lib/fastly/models/logging_grafanacloudlogs_response.rb @@ -0,0 +1,408 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class LoggingGrafanacloudlogsResponse + # The name for the real-time logging configuration. + attr_accessor :name + + # Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. + attr_accessor :placement + + # The name of an existing condition in the configured endpoint, or leave blank to always execute. + attr_accessor :response_condition + + # A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). + attr_accessor :format + + # The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. + attr_accessor :format_version + + # The Grafana Cloud Logs Dataset you want to log to. + attr_accessor :user + + # The URL of the Loki instance in your Grafana stack. + attr_accessor :url + + # The Grafana Access Policy token with `logs:write` access scoped to your Loki instance. + attr_accessor :token + + # The Stream Labels, a JSON string used to identify the stream. + attr_accessor :index + + # Date and time in ISO 8601 format. + attr_accessor :created_at + + # Date and time in ISO 8601 format. + attr_accessor :deleted_at + + # Date and time in ISO 8601 format. + attr_accessor :updated_at + + attr_accessor :service_id + + attr_accessor :version + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'placement' => :'placement', + :'response_condition' => :'response_condition', + :'format' => :'format', + :'format_version' => :'format_version', + :'user' => :'user', + :'url' => :'url', + :'token' => :'token', + :'index' => :'index', + :'created_at' => :'created_at', + :'deleted_at' => :'deleted_at', + :'updated_at' => :'updated_at', + :'service_id' => :'service_id', + :'version' => :'version' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'name' => :'String', + :'placement' => :'String', + :'response_condition' => :'String', + :'format' => :'String', + :'format_version' => :'String', + :'user' => :'String', + :'url' => :'String', + :'token' => :'String', + :'index' => :'String', + :'created_at' => :'Time', + :'deleted_at' => :'Time', + :'updated_at' => :'Time', + :'service_id' => :'String', + :'version' => :'String' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + :'placement', + :'response_condition', + :'created_at', + :'deleted_at', + :'updated_at', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.fastly_all_of + [ + :'LoggingCommonResponse', + :'LoggingGrafanacloudlogsAdditional', + :'ServiceIdAndVersionString', + :'Timestamps' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::LoggingGrafanacloudlogsResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::LoggingGrafanacloudlogsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'placement') + self.placement = attributes[:'placement'] + end + + if attributes.key?(:'response_condition') + self.response_condition = attributes[:'response_condition'] + end + + if attributes.key?(:'format') + self.format = attributes[:'format'] + end + + if attributes.key?(:'format_version') + self.format_version = attributes[:'format_version'] + else + self.format_version = '2' + end + + if attributes.key?(:'user') + self.user = attributes[:'user'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + + if attributes.key?(:'token') + self.token = attributes[:'token'] + end + + if attributes.key?(:'index') + self.index = attributes[:'index'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'deleted_at') + self.deleted_at = attributes[:'deleted_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'service_id') + self.service_id = attributes[:'service_id'] + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + placement_validator = EnumAttributeValidator.new('String', ["none", "waf_debug", "null"]) + return false unless placement_validator.valid?(@placement) + format_version_validator = EnumAttributeValidator.new('String', ["1", "2"]) + return false unless format_version_validator.valid?(@format_version) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] placement Object to be assigned + def placement=(placement) + validator = EnumAttributeValidator.new('String', ["none", "waf_debug", "null"]) + unless validator.valid?(placement) + fail ArgumentError, "invalid value for \"placement\", must be one of #{validator.allowable_values}." + end + @placement = placement + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] format_version Object to be assigned + def format_version=(format_version) + validator = EnumAttributeValidator.new('String', ["1", "2"]) + unless validator.valid?(format_version) + fail ArgumentError, "invalid value for \"format_version\", must be one of #{validator.allowable_values}." + end + @format_version = format_version + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + placement == o.placement && + response_condition == o.response_condition && + format == o.format && + format_version == o.format_version && + user == o.user && + url == o.url && + token == o.token && + index == o.index && + created_at == o.created_at && + deleted_at == o.deleted_at && + updated_at == o.updated_at && + service_id == o.service_id && + version == o.version + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, placement, response_condition, format, format_version, user, url, token, index, created_at, deleted_at, updated_at, service_id, version].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/realtime_entry_aggregated.rb b/lib/fastly/models/realtime_entry_aggregated.rb index 59d5bf80..72465a95 100644 --- a/lib/fastly/models/realtime_entry_aggregated.rb +++ b/lib/fastly/models/realtime_entry_aggregated.rb @@ -701,27 +701,6 @@ class RealtimeEntryAggregated # The number of connections the downgrade action was applied to. The downgrade action restricts the connection to http1. attr_accessor :ddos_action_downgraded_connections - # Number of cache hits for a VCL service running on Compute. - attr_accessor :vcl_on_compute_hit_requests - - # Number of cache misses for a VCL service running on Compute. - attr_accessor :vcl_on_compute_miss_requests - - # Number of requests that passed through the CDN without being cached for a VCL service running on Compute. - attr_accessor :vcl_on_compute_pass_requests - - # Number of cache errors for a VCL service running on Compute. - attr_accessor :vcl_on_compute_error_requests - - # Number of requests that returned a synthetic response (i.e., response objects created with the `synthetic` VCL statement) for a VCL service running on Compute. - attr_accessor :vcl_on_compute_synth_requests - - # Number of requests sent by end users to Fastly that resulted in a hit at the edge for a VCL service running on Compute. - attr_accessor :vcl_on_compute_edge_hit_requests - - # Number of requests sent by end users to Fastly that resulted in a miss at the edge for a VCL service running on Compute. - attr_accessor :vcl_on_compute_edge_miss_requests - # Number of cache hits for a VCL service. attr_accessor :all_hit_requests @@ -764,6 +743,15 @@ class RealtimeEntryAggregated # Number of requests where Fastly responded with 400 due to the request being a GET or HEAD request containing a body. attr_accessor :request_denied_get_head_body + # Number of requests classified as a DDoS attack against a customer origin or service. + attr_accessor :service_ddos_requests_detected + + # Number of requests classified as a DDoS attack against a customer origin or service that were mitigated by the Fastly platform. + attr_accessor :service_ddos_requests_mitigated + + # Number of requests analyzed for DDoS attacks against a customer origin or service, but with no DDoS detected. + attr_accessor :service_ddos_requests_allowed + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -996,13 +984,6 @@ def self.attribute_map :'bot_challenge_complete_tokens_issued' => :'bot_challenge_complete_tokens_issued', :'ddos_action_downgrade' => :'ddos_action_downgrade', :'ddos_action_downgraded_connections' => :'ddos_action_downgraded_connections', - :'vcl_on_compute_hit_requests' => :'vcl_on_compute_hit_requests', - :'vcl_on_compute_miss_requests' => :'vcl_on_compute_miss_requests', - :'vcl_on_compute_pass_requests' => :'vcl_on_compute_pass_requests', - :'vcl_on_compute_error_requests' => :'vcl_on_compute_error_requests', - :'vcl_on_compute_synth_requests' => :'vcl_on_compute_synth_requests', - :'vcl_on_compute_edge_hit_requests' => :'vcl_on_compute_edge_hit_requests', - :'vcl_on_compute_edge_miss_requests' => :'vcl_on_compute_edge_miss_requests', :'all_hit_requests' => :'all_hit_requests', :'all_miss_requests' => :'all_miss_requests', :'all_pass_requests' => :'all_pass_requests', @@ -1016,7 +997,10 @@ def self.attribute_map :'all_status_4xx' => :'all_status_4xx', :'all_status_5xx' => :'all_status_5xx', :'origin_offload' => :'origin_offload', - :'request_denied_get_head_body' => :'request_denied_get_head_body' + :'request_denied_get_head_body' => :'request_denied_get_head_body', + :'service_ddos_requests_detected' => :'service_ddos_requests_detected', + :'service_ddos_requests_mitigated' => :'service_ddos_requests_mitigated', + :'service_ddos_requests_allowed' => :'service_ddos_requests_allowed' } end @@ -1257,13 +1241,6 @@ def self.fastly_types :'bot_challenge_complete_tokens_issued' => :'Integer', :'ddos_action_downgrade' => :'Integer', :'ddos_action_downgraded_connections' => :'Integer', - :'vcl_on_compute_hit_requests' => :'Integer', - :'vcl_on_compute_miss_requests' => :'Integer', - :'vcl_on_compute_pass_requests' => :'Integer', - :'vcl_on_compute_error_requests' => :'Integer', - :'vcl_on_compute_synth_requests' => :'Integer', - :'vcl_on_compute_edge_hit_requests' => :'Integer', - :'vcl_on_compute_edge_miss_requests' => :'Integer', :'all_hit_requests' => :'Integer', :'all_miss_requests' => :'Integer', :'all_pass_requests' => :'Integer', @@ -1277,7 +1254,10 @@ def self.fastly_types :'all_status_4xx' => :'Integer', :'all_status_5xx' => :'Integer', :'origin_offload' => :'Float', - :'request_denied_get_head_body' => :'Integer' + :'request_denied_get_head_body' => :'Integer', + :'service_ddos_requests_detected' => :'Integer', + :'service_ddos_requests_mitigated' => :'Integer', + :'service_ddos_requests_allowed' => :'Integer' } end @@ -2227,34 +2207,6 @@ def initialize(attributes = {}) self.ddos_action_downgraded_connections = attributes[:'ddos_action_downgraded_connections'] end - if attributes.key?(:'vcl_on_compute_hit_requests') - self.vcl_on_compute_hit_requests = attributes[:'vcl_on_compute_hit_requests'] - end - - if attributes.key?(:'vcl_on_compute_miss_requests') - self.vcl_on_compute_miss_requests = attributes[:'vcl_on_compute_miss_requests'] - end - - if attributes.key?(:'vcl_on_compute_pass_requests') - self.vcl_on_compute_pass_requests = attributes[:'vcl_on_compute_pass_requests'] - end - - if attributes.key?(:'vcl_on_compute_error_requests') - self.vcl_on_compute_error_requests = attributes[:'vcl_on_compute_error_requests'] - end - - if attributes.key?(:'vcl_on_compute_synth_requests') - self.vcl_on_compute_synth_requests = attributes[:'vcl_on_compute_synth_requests'] - end - - if attributes.key?(:'vcl_on_compute_edge_hit_requests') - self.vcl_on_compute_edge_hit_requests = attributes[:'vcl_on_compute_edge_hit_requests'] - end - - if attributes.key?(:'vcl_on_compute_edge_miss_requests') - self.vcl_on_compute_edge_miss_requests = attributes[:'vcl_on_compute_edge_miss_requests'] - end - if attributes.key?(:'all_hit_requests') self.all_hit_requests = attributes[:'all_hit_requests'] end @@ -2310,6 +2262,18 @@ def initialize(attributes = {}) if attributes.key?(:'request_denied_get_head_body') self.request_denied_get_head_body = attributes[:'request_denied_get_head_body'] end + + if attributes.key?(:'service_ddos_requests_detected') + self.service_ddos_requests_detected = attributes[:'service_ddos_requests_detected'] + end + + if attributes.key?(:'service_ddos_requests_mitigated') + self.service_ddos_requests_mitigated = attributes[:'service_ddos_requests_mitigated'] + end + + if attributes.key?(:'service_ddos_requests_allowed') + self.service_ddos_requests_allowed = attributes[:'service_ddos_requests_allowed'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -2559,13 +2523,6 @@ def ==(o) bot_challenge_complete_tokens_issued == o.bot_challenge_complete_tokens_issued && ddos_action_downgrade == o.ddos_action_downgrade && ddos_action_downgraded_connections == o.ddos_action_downgraded_connections && - vcl_on_compute_hit_requests == o.vcl_on_compute_hit_requests && - vcl_on_compute_miss_requests == o.vcl_on_compute_miss_requests && - vcl_on_compute_pass_requests == o.vcl_on_compute_pass_requests && - vcl_on_compute_error_requests == o.vcl_on_compute_error_requests && - vcl_on_compute_synth_requests == o.vcl_on_compute_synth_requests && - vcl_on_compute_edge_hit_requests == o.vcl_on_compute_edge_hit_requests && - vcl_on_compute_edge_miss_requests == o.vcl_on_compute_edge_miss_requests && all_hit_requests == o.all_hit_requests && all_miss_requests == o.all_miss_requests && all_pass_requests == o.all_pass_requests && @@ -2579,7 +2536,10 @@ def ==(o) all_status_4xx == o.all_status_4xx && all_status_5xx == o.all_status_5xx && origin_offload == o.origin_offload && - request_denied_get_head_body == o.request_denied_get_head_body + request_denied_get_head_body == o.request_denied_get_head_body && + service_ddos_requests_detected == o.service_ddos_requests_detected && + service_ddos_requests_mitigated == o.service_ddos_requests_mitigated && + service_ddos_requests_allowed == o.service_ddos_requests_allowed end # @see the `==` method @@ -2591,7 +2551,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [requests, logging, log, resp_header_bytes, header_size, resp_body_bytes, body_size, hits, miss, pass, synth, errors, hits_time, miss_time, miss_histogram, compute_requests, compute_execution_time_ms, compute_ram_used, compute_request_time_ms, compute_request_time_billed_ms, shield, ipv6, imgopto, imgopto_shield, imgopto_transforms, otfp, otfp_shield, otfp_manifests, video, pci, http2, http3, restarts, req_header_bytes, req_body_bytes, bereq_header_bytes, bereq_body_bytes, waf_blocked, waf_logged, waf_passed, attack_req_header_bytes, attack_req_body_bytes, attack_resp_synth_bytes, attack_logged_req_header_bytes, attack_logged_req_body_bytes, attack_blocked_req_header_bytes, attack_blocked_req_body_bytes, attack_passed_req_header_bytes, attack_passed_req_body_bytes, shield_resp_header_bytes, shield_resp_body_bytes, otfp_resp_header_bytes, otfp_resp_body_bytes, otfp_shield_resp_header_bytes, otfp_shield_resp_body_bytes, otfp_shield_time, otfp_deliver_time, imgopto_resp_header_bytes, imgopto_resp_body_bytes, imgopto_shield_resp_header_bytes, imgopto_shield_resp_body_bytes, status_1xx, status_2xx, status_3xx, status_4xx, status_5xx, status_200, status_204, status_206, status_301, status_302, status_304, status_400, status_401, status_403, status_404, status_406, status_416, status_429, status_500, status_501, status_502, status_503, status_504, status_505, uncacheable, pass_time, tls, tls_v10, tls_v11, tls_v12, tls_v13, object_size_1k, object_size_10k, object_size_100k, object_size_1m, object_size_10m, object_size_100m, object_size_1g, object_size_other, recv_sub_time, recv_sub_count, hash_sub_time, hash_sub_count, miss_sub_time, miss_sub_count, fetch_sub_time, fetch_sub_count, pass_sub_time, pass_sub_count, pipe_sub_time, pipe_sub_count, deliver_sub_time, deliver_sub_count, error_sub_time, error_sub_count, hit_sub_time, hit_sub_count, prehash_sub_time, prehash_sub_count, predeliver_sub_time, predeliver_sub_count, hit_resp_body_bytes, miss_resp_body_bytes, pass_resp_body_bytes, compute_req_header_bytes, compute_req_body_bytes, compute_resp_header_bytes, compute_resp_body_bytes, imgvideo, imgvideo_frames, imgvideo_resp_header_bytes, imgvideo_resp_body_bytes, imgvideo_shield, imgvideo_shield_frames, imgvideo_shield_resp_header_bytes, imgvideo_shield_resp_body_bytes, log_bytes, edge_requests, edge_resp_header_bytes, edge_resp_body_bytes, origin_revalidations, origin_fetches, origin_fetch_header_bytes, origin_fetch_body_bytes, origin_fetch_resp_header_bytes, origin_fetch_resp_body_bytes, shield_revalidations, shield_fetches, shield_fetch_header_bytes, shield_fetch_body_bytes, shield_fetch_resp_header_bytes, shield_fetch_resp_body_bytes, segblock_origin_fetches, segblock_shield_fetches, compute_resp_status_1xx, compute_resp_status_2xx, compute_resp_status_3xx, compute_resp_status_4xx, compute_resp_status_5xx, edge_hit_requests, edge_miss_requests, compute_bereq_header_bytes, compute_bereq_body_bytes, compute_beresp_header_bytes, compute_beresp_body_bytes, origin_cache_fetches, shield_cache_fetches, compute_bereqs, compute_bereq_errors, compute_resource_limit_exceeded, compute_heap_limit_exceeded, compute_stack_limit_exceeded, compute_globals_limit_exceeded, compute_guest_errors, compute_runtime_errors, edge_hit_resp_body_bytes, edge_hit_resp_header_bytes, edge_miss_resp_body_bytes, edge_miss_resp_header_bytes, origin_cache_fetch_resp_body_bytes, origin_cache_fetch_resp_header_bytes, shield_hit_requests, shield_miss_requests, shield_hit_resp_header_bytes, shield_hit_resp_body_bytes, shield_miss_resp_header_bytes, shield_miss_resp_body_bytes, websocket_req_header_bytes, websocket_req_body_bytes, websocket_resp_header_bytes, websocket_bereq_header_bytes, websocket_bereq_body_bytes, websocket_beresp_header_bytes, websocket_beresp_body_bytes, websocket_conn_time_ms, websocket_resp_body_bytes, fanout_recv_publishes, fanout_send_publishes, kv_store_class_a_operations, kv_store_class_b_operations, object_store_class_a_operations, object_store_class_b_operations, fanout_req_header_bytes, fanout_req_body_bytes, fanout_resp_header_bytes, fanout_resp_body_bytes, fanout_bereq_header_bytes, fanout_bereq_body_bytes, fanout_beresp_header_bytes, fanout_beresp_body_bytes, fanout_conn_time_ms, ddos_action_limit_streams_connections, ddos_action_limit_streams_requests, ddos_action_tarpit_accept, ddos_action_tarpit, ddos_action_close, ddos_action_blackhole, bot_challenge_starts, bot_challenge_complete_tokens_passed, bot_challenge_complete_tokens_failed, bot_challenge_complete_tokens_checked, bot_challenge_complete_tokens_disabled, bot_challenges_issued, bot_challenges_succeeded, bot_challenges_failed, bot_challenge_complete_tokens_issued, ddos_action_downgrade, ddos_action_downgraded_connections, vcl_on_compute_hit_requests, vcl_on_compute_miss_requests, vcl_on_compute_pass_requests, vcl_on_compute_error_requests, vcl_on_compute_synth_requests, vcl_on_compute_edge_hit_requests, vcl_on_compute_edge_miss_requests, all_hit_requests, all_miss_requests, all_pass_requests, all_error_requests, all_synth_requests, all_edge_hit_requests, all_edge_miss_requests, all_status_1xx, all_status_2xx, all_status_3xx, all_status_4xx, all_status_5xx, origin_offload, request_denied_get_head_body].hash + [requests, logging, log, resp_header_bytes, header_size, resp_body_bytes, body_size, hits, miss, pass, synth, errors, hits_time, miss_time, miss_histogram, compute_requests, compute_execution_time_ms, compute_ram_used, compute_request_time_ms, compute_request_time_billed_ms, shield, ipv6, imgopto, imgopto_shield, imgopto_transforms, otfp, otfp_shield, otfp_manifests, video, pci, http2, http3, restarts, req_header_bytes, req_body_bytes, bereq_header_bytes, bereq_body_bytes, waf_blocked, waf_logged, waf_passed, attack_req_header_bytes, attack_req_body_bytes, attack_resp_synth_bytes, attack_logged_req_header_bytes, attack_logged_req_body_bytes, attack_blocked_req_header_bytes, attack_blocked_req_body_bytes, attack_passed_req_header_bytes, attack_passed_req_body_bytes, shield_resp_header_bytes, shield_resp_body_bytes, otfp_resp_header_bytes, otfp_resp_body_bytes, otfp_shield_resp_header_bytes, otfp_shield_resp_body_bytes, otfp_shield_time, otfp_deliver_time, imgopto_resp_header_bytes, imgopto_resp_body_bytes, imgopto_shield_resp_header_bytes, imgopto_shield_resp_body_bytes, status_1xx, status_2xx, status_3xx, status_4xx, status_5xx, status_200, status_204, status_206, status_301, status_302, status_304, status_400, status_401, status_403, status_404, status_406, status_416, status_429, status_500, status_501, status_502, status_503, status_504, status_505, uncacheable, pass_time, tls, tls_v10, tls_v11, tls_v12, tls_v13, object_size_1k, object_size_10k, object_size_100k, object_size_1m, object_size_10m, object_size_100m, object_size_1g, object_size_other, recv_sub_time, recv_sub_count, hash_sub_time, hash_sub_count, miss_sub_time, miss_sub_count, fetch_sub_time, fetch_sub_count, pass_sub_time, pass_sub_count, pipe_sub_time, pipe_sub_count, deliver_sub_time, deliver_sub_count, error_sub_time, error_sub_count, hit_sub_time, hit_sub_count, prehash_sub_time, prehash_sub_count, predeliver_sub_time, predeliver_sub_count, hit_resp_body_bytes, miss_resp_body_bytes, pass_resp_body_bytes, compute_req_header_bytes, compute_req_body_bytes, compute_resp_header_bytes, compute_resp_body_bytes, imgvideo, imgvideo_frames, imgvideo_resp_header_bytes, imgvideo_resp_body_bytes, imgvideo_shield, imgvideo_shield_frames, imgvideo_shield_resp_header_bytes, imgvideo_shield_resp_body_bytes, log_bytes, edge_requests, edge_resp_header_bytes, edge_resp_body_bytes, origin_revalidations, origin_fetches, origin_fetch_header_bytes, origin_fetch_body_bytes, origin_fetch_resp_header_bytes, origin_fetch_resp_body_bytes, shield_revalidations, shield_fetches, shield_fetch_header_bytes, shield_fetch_body_bytes, shield_fetch_resp_header_bytes, shield_fetch_resp_body_bytes, segblock_origin_fetches, segblock_shield_fetches, compute_resp_status_1xx, compute_resp_status_2xx, compute_resp_status_3xx, compute_resp_status_4xx, compute_resp_status_5xx, edge_hit_requests, edge_miss_requests, compute_bereq_header_bytes, compute_bereq_body_bytes, compute_beresp_header_bytes, compute_beresp_body_bytes, origin_cache_fetches, shield_cache_fetches, compute_bereqs, compute_bereq_errors, compute_resource_limit_exceeded, compute_heap_limit_exceeded, compute_stack_limit_exceeded, compute_globals_limit_exceeded, compute_guest_errors, compute_runtime_errors, edge_hit_resp_body_bytes, edge_hit_resp_header_bytes, edge_miss_resp_body_bytes, edge_miss_resp_header_bytes, origin_cache_fetch_resp_body_bytes, origin_cache_fetch_resp_header_bytes, shield_hit_requests, shield_miss_requests, shield_hit_resp_header_bytes, shield_hit_resp_body_bytes, shield_miss_resp_header_bytes, shield_miss_resp_body_bytes, websocket_req_header_bytes, websocket_req_body_bytes, websocket_resp_header_bytes, websocket_bereq_header_bytes, websocket_bereq_body_bytes, websocket_beresp_header_bytes, websocket_beresp_body_bytes, websocket_conn_time_ms, websocket_resp_body_bytes, fanout_recv_publishes, fanout_send_publishes, kv_store_class_a_operations, kv_store_class_b_operations, object_store_class_a_operations, object_store_class_b_operations, fanout_req_header_bytes, fanout_req_body_bytes, fanout_resp_header_bytes, fanout_resp_body_bytes, fanout_bereq_header_bytes, fanout_bereq_body_bytes, fanout_beresp_header_bytes, fanout_beresp_body_bytes, fanout_conn_time_ms, ddos_action_limit_streams_connections, ddos_action_limit_streams_requests, ddos_action_tarpit_accept, ddos_action_tarpit, ddos_action_close, ddos_action_blackhole, bot_challenge_starts, bot_challenge_complete_tokens_passed, bot_challenge_complete_tokens_failed, bot_challenge_complete_tokens_checked, bot_challenge_complete_tokens_disabled, bot_challenges_issued, bot_challenges_succeeded, bot_challenges_failed, bot_challenge_complete_tokens_issued, ddos_action_downgrade, ddos_action_downgraded_connections, all_hit_requests, all_miss_requests, all_pass_requests, all_error_requests, all_synth_requests, all_edge_hit_requests, all_edge_miss_requests, all_status_1xx, all_status_2xx, all_status_3xx, all_status_4xx, all_status_5xx, origin_offload, request_denied_get_head_body, service_ddos_requests_detected, service_ddos_requests_mitigated, service_ddos_requests_allowed].hash end # Builds the object from hash diff --git a/lib/fastly/models/realtime_measurements.rb b/lib/fastly/models/realtime_measurements.rb index 14a3eca0..cff5abba 100644 --- a/lib/fastly/models/realtime_measurements.rb +++ b/lib/fastly/models/realtime_measurements.rb @@ -701,27 +701,6 @@ class RealtimeMeasurements # The number of connections the downgrade action was applied to. The downgrade action restricts the connection to http1. attr_accessor :ddos_action_downgraded_connections - # Number of cache hits for a VCL service running on Compute. - attr_accessor :vcl_on_compute_hit_requests - - # Number of cache misses for a VCL service running on Compute. - attr_accessor :vcl_on_compute_miss_requests - - # Number of requests that passed through the CDN without being cached for a VCL service running on Compute. - attr_accessor :vcl_on_compute_pass_requests - - # Number of cache errors for a VCL service running on Compute. - attr_accessor :vcl_on_compute_error_requests - - # Number of requests that returned a synthetic response (i.e., response objects created with the `synthetic` VCL statement) for a VCL service running on Compute. - attr_accessor :vcl_on_compute_synth_requests - - # Number of requests sent by end users to Fastly that resulted in a hit at the edge for a VCL service running on Compute. - attr_accessor :vcl_on_compute_edge_hit_requests - - # Number of requests sent by end users to Fastly that resulted in a miss at the edge for a VCL service running on Compute. - attr_accessor :vcl_on_compute_edge_miss_requests - # Number of cache hits for a VCL service. attr_accessor :all_hit_requests @@ -764,6 +743,15 @@ class RealtimeMeasurements # Number of requests where Fastly responded with 400 due to the request being a GET or HEAD request containing a body. attr_accessor :request_denied_get_head_body + # Number of requests classified as a DDoS attack against a customer origin or service. + attr_accessor :service_ddos_requests_detected + + # Number of requests classified as a DDoS attack against a customer origin or service that were mitigated by the Fastly platform. + attr_accessor :service_ddos_requests_mitigated + + # Number of requests analyzed for DDoS attacks against a customer origin or service, but with no DDoS detected. + attr_accessor :service_ddos_requests_allowed + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -996,13 +984,6 @@ def self.attribute_map :'bot_challenge_complete_tokens_issued' => :'bot_challenge_complete_tokens_issued', :'ddos_action_downgrade' => :'ddos_action_downgrade', :'ddos_action_downgraded_connections' => :'ddos_action_downgraded_connections', - :'vcl_on_compute_hit_requests' => :'vcl_on_compute_hit_requests', - :'vcl_on_compute_miss_requests' => :'vcl_on_compute_miss_requests', - :'vcl_on_compute_pass_requests' => :'vcl_on_compute_pass_requests', - :'vcl_on_compute_error_requests' => :'vcl_on_compute_error_requests', - :'vcl_on_compute_synth_requests' => :'vcl_on_compute_synth_requests', - :'vcl_on_compute_edge_hit_requests' => :'vcl_on_compute_edge_hit_requests', - :'vcl_on_compute_edge_miss_requests' => :'vcl_on_compute_edge_miss_requests', :'all_hit_requests' => :'all_hit_requests', :'all_miss_requests' => :'all_miss_requests', :'all_pass_requests' => :'all_pass_requests', @@ -1016,7 +997,10 @@ def self.attribute_map :'all_status_4xx' => :'all_status_4xx', :'all_status_5xx' => :'all_status_5xx', :'origin_offload' => :'origin_offload', - :'request_denied_get_head_body' => :'request_denied_get_head_body' + :'request_denied_get_head_body' => :'request_denied_get_head_body', + :'service_ddos_requests_detected' => :'service_ddos_requests_detected', + :'service_ddos_requests_mitigated' => :'service_ddos_requests_mitigated', + :'service_ddos_requests_allowed' => :'service_ddos_requests_allowed' } end @@ -1257,13 +1241,6 @@ def self.fastly_types :'bot_challenge_complete_tokens_issued' => :'Integer', :'ddos_action_downgrade' => :'Integer', :'ddos_action_downgraded_connections' => :'Integer', - :'vcl_on_compute_hit_requests' => :'Integer', - :'vcl_on_compute_miss_requests' => :'Integer', - :'vcl_on_compute_pass_requests' => :'Integer', - :'vcl_on_compute_error_requests' => :'Integer', - :'vcl_on_compute_synth_requests' => :'Integer', - :'vcl_on_compute_edge_hit_requests' => :'Integer', - :'vcl_on_compute_edge_miss_requests' => :'Integer', :'all_hit_requests' => :'Integer', :'all_miss_requests' => :'Integer', :'all_pass_requests' => :'Integer', @@ -1277,7 +1254,10 @@ def self.fastly_types :'all_status_4xx' => :'Integer', :'all_status_5xx' => :'Integer', :'origin_offload' => :'Float', - :'request_denied_get_head_body' => :'Integer' + :'request_denied_get_head_body' => :'Integer', + :'service_ddos_requests_detected' => :'Integer', + :'service_ddos_requests_mitigated' => :'Integer', + :'service_ddos_requests_allowed' => :'Integer' } end @@ -2220,34 +2200,6 @@ def initialize(attributes = {}) self.ddos_action_downgraded_connections = attributes[:'ddos_action_downgraded_connections'] end - if attributes.key?(:'vcl_on_compute_hit_requests') - self.vcl_on_compute_hit_requests = attributes[:'vcl_on_compute_hit_requests'] - end - - if attributes.key?(:'vcl_on_compute_miss_requests') - self.vcl_on_compute_miss_requests = attributes[:'vcl_on_compute_miss_requests'] - end - - if attributes.key?(:'vcl_on_compute_pass_requests') - self.vcl_on_compute_pass_requests = attributes[:'vcl_on_compute_pass_requests'] - end - - if attributes.key?(:'vcl_on_compute_error_requests') - self.vcl_on_compute_error_requests = attributes[:'vcl_on_compute_error_requests'] - end - - if attributes.key?(:'vcl_on_compute_synth_requests') - self.vcl_on_compute_synth_requests = attributes[:'vcl_on_compute_synth_requests'] - end - - if attributes.key?(:'vcl_on_compute_edge_hit_requests') - self.vcl_on_compute_edge_hit_requests = attributes[:'vcl_on_compute_edge_hit_requests'] - end - - if attributes.key?(:'vcl_on_compute_edge_miss_requests') - self.vcl_on_compute_edge_miss_requests = attributes[:'vcl_on_compute_edge_miss_requests'] - end - if attributes.key?(:'all_hit_requests') self.all_hit_requests = attributes[:'all_hit_requests'] end @@ -2303,6 +2255,18 @@ def initialize(attributes = {}) if attributes.key?(:'request_denied_get_head_body') self.request_denied_get_head_body = attributes[:'request_denied_get_head_body'] end + + if attributes.key?(:'service_ddos_requests_detected') + self.service_ddos_requests_detected = attributes[:'service_ddos_requests_detected'] + end + + if attributes.key?(:'service_ddos_requests_mitigated') + self.service_ddos_requests_mitigated = attributes[:'service_ddos_requests_mitigated'] + end + + if attributes.key?(:'service_ddos_requests_allowed') + self.service_ddos_requests_allowed = attributes[:'service_ddos_requests_allowed'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -2552,13 +2516,6 @@ def ==(o) bot_challenge_complete_tokens_issued == o.bot_challenge_complete_tokens_issued && ddos_action_downgrade == o.ddos_action_downgrade && ddos_action_downgraded_connections == o.ddos_action_downgraded_connections && - vcl_on_compute_hit_requests == o.vcl_on_compute_hit_requests && - vcl_on_compute_miss_requests == o.vcl_on_compute_miss_requests && - vcl_on_compute_pass_requests == o.vcl_on_compute_pass_requests && - vcl_on_compute_error_requests == o.vcl_on_compute_error_requests && - vcl_on_compute_synth_requests == o.vcl_on_compute_synth_requests && - vcl_on_compute_edge_hit_requests == o.vcl_on_compute_edge_hit_requests && - vcl_on_compute_edge_miss_requests == o.vcl_on_compute_edge_miss_requests && all_hit_requests == o.all_hit_requests && all_miss_requests == o.all_miss_requests && all_pass_requests == o.all_pass_requests && @@ -2572,7 +2529,10 @@ def ==(o) all_status_4xx == o.all_status_4xx && all_status_5xx == o.all_status_5xx && origin_offload == o.origin_offload && - request_denied_get_head_body == o.request_denied_get_head_body + request_denied_get_head_body == o.request_denied_get_head_body && + service_ddos_requests_detected == o.service_ddos_requests_detected && + service_ddos_requests_mitigated == o.service_ddos_requests_mitigated && + service_ddos_requests_allowed == o.service_ddos_requests_allowed end # @see the `==` method @@ -2584,7 +2544,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [requests, logging, log, resp_header_bytes, header_size, resp_body_bytes, body_size, hits, miss, pass, synth, errors, hits_time, miss_time, miss_histogram, compute_requests, compute_execution_time_ms, compute_ram_used, compute_request_time_ms, compute_request_time_billed_ms, shield, ipv6, imgopto, imgopto_shield, imgopto_transforms, otfp, otfp_shield, otfp_manifests, video, pci, http2, http3, restarts, req_header_bytes, req_body_bytes, bereq_header_bytes, bereq_body_bytes, waf_blocked, waf_logged, waf_passed, attack_req_header_bytes, attack_req_body_bytes, attack_resp_synth_bytes, attack_logged_req_header_bytes, attack_logged_req_body_bytes, attack_blocked_req_header_bytes, attack_blocked_req_body_bytes, attack_passed_req_header_bytes, attack_passed_req_body_bytes, shield_resp_header_bytes, shield_resp_body_bytes, otfp_resp_header_bytes, otfp_resp_body_bytes, otfp_shield_resp_header_bytes, otfp_shield_resp_body_bytes, otfp_shield_time, otfp_deliver_time, imgopto_resp_header_bytes, imgopto_resp_body_bytes, imgopto_shield_resp_header_bytes, imgopto_shield_resp_body_bytes, status_1xx, status_2xx, status_3xx, status_4xx, status_5xx, status_200, status_204, status_206, status_301, status_302, status_304, status_400, status_401, status_403, status_404, status_406, status_416, status_429, status_500, status_501, status_502, status_503, status_504, status_505, uncacheable, pass_time, tls, tls_v10, tls_v11, tls_v12, tls_v13, object_size_1k, object_size_10k, object_size_100k, object_size_1m, object_size_10m, object_size_100m, object_size_1g, object_size_other, recv_sub_time, recv_sub_count, hash_sub_time, hash_sub_count, miss_sub_time, miss_sub_count, fetch_sub_time, fetch_sub_count, pass_sub_time, pass_sub_count, pipe_sub_time, pipe_sub_count, deliver_sub_time, deliver_sub_count, error_sub_time, error_sub_count, hit_sub_time, hit_sub_count, prehash_sub_time, prehash_sub_count, predeliver_sub_time, predeliver_sub_count, hit_resp_body_bytes, miss_resp_body_bytes, pass_resp_body_bytes, compute_req_header_bytes, compute_req_body_bytes, compute_resp_header_bytes, compute_resp_body_bytes, imgvideo, imgvideo_frames, imgvideo_resp_header_bytes, imgvideo_resp_body_bytes, imgvideo_shield, imgvideo_shield_frames, imgvideo_shield_resp_header_bytes, imgvideo_shield_resp_body_bytes, log_bytes, edge_requests, edge_resp_header_bytes, edge_resp_body_bytes, origin_revalidations, origin_fetches, origin_fetch_header_bytes, origin_fetch_body_bytes, origin_fetch_resp_header_bytes, origin_fetch_resp_body_bytes, shield_revalidations, shield_fetches, shield_fetch_header_bytes, shield_fetch_body_bytes, shield_fetch_resp_header_bytes, shield_fetch_resp_body_bytes, segblock_origin_fetches, segblock_shield_fetches, compute_resp_status_1xx, compute_resp_status_2xx, compute_resp_status_3xx, compute_resp_status_4xx, compute_resp_status_5xx, edge_hit_requests, edge_miss_requests, compute_bereq_header_bytes, compute_bereq_body_bytes, compute_beresp_header_bytes, compute_beresp_body_bytes, origin_cache_fetches, shield_cache_fetches, compute_bereqs, compute_bereq_errors, compute_resource_limit_exceeded, compute_heap_limit_exceeded, compute_stack_limit_exceeded, compute_globals_limit_exceeded, compute_guest_errors, compute_runtime_errors, edge_hit_resp_body_bytes, edge_hit_resp_header_bytes, edge_miss_resp_body_bytes, edge_miss_resp_header_bytes, origin_cache_fetch_resp_body_bytes, origin_cache_fetch_resp_header_bytes, shield_hit_requests, shield_miss_requests, shield_hit_resp_header_bytes, shield_hit_resp_body_bytes, shield_miss_resp_header_bytes, shield_miss_resp_body_bytes, websocket_req_header_bytes, websocket_req_body_bytes, websocket_resp_header_bytes, websocket_bereq_header_bytes, websocket_bereq_body_bytes, websocket_beresp_header_bytes, websocket_beresp_body_bytes, websocket_conn_time_ms, websocket_resp_body_bytes, fanout_recv_publishes, fanout_send_publishes, kv_store_class_a_operations, kv_store_class_b_operations, object_store_class_a_operations, object_store_class_b_operations, fanout_req_header_bytes, fanout_req_body_bytes, fanout_resp_header_bytes, fanout_resp_body_bytes, fanout_bereq_header_bytes, fanout_bereq_body_bytes, fanout_beresp_header_bytes, fanout_beresp_body_bytes, fanout_conn_time_ms, ddos_action_limit_streams_connections, ddos_action_limit_streams_requests, ddos_action_tarpit_accept, ddos_action_tarpit, ddos_action_close, ddos_action_blackhole, bot_challenge_starts, bot_challenge_complete_tokens_passed, bot_challenge_complete_tokens_failed, bot_challenge_complete_tokens_checked, bot_challenge_complete_tokens_disabled, bot_challenges_issued, bot_challenges_succeeded, bot_challenges_failed, bot_challenge_complete_tokens_issued, ddos_action_downgrade, ddos_action_downgraded_connections, vcl_on_compute_hit_requests, vcl_on_compute_miss_requests, vcl_on_compute_pass_requests, vcl_on_compute_error_requests, vcl_on_compute_synth_requests, vcl_on_compute_edge_hit_requests, vcl_on_compute_edge_miss_requests, all_hit_requests, all_miss_requests, all_pass_requests, all_error_requests, all_synth_requests, all_edge_hit_requests, all_edge_miss_requests, all_status_1xx, all_status_2xx, all_status_3xx, all_status_4xx, all_status_5xx, origin_offload, request_denied_get_head_body].hash + [requests, logging, log, resp_header_bytes, header_size, resp_body_bytes, body_size, hits, miss, pass, synth, errors, hits_time, miss_time, miss_histogram, compute_requests, compute_execution_time_ms, compute_ram_used, compute_request_time_ms, compute_request_time_billed_ms, shield, ipv6, imgopto, imgopto_shield, imgopto_transforms, otfp, otfp_shield, otfp_manifests, video, pci, http2, http3, restarts, req_header_bytes, req_body_bytes, bereq_header_bytes, bereq_body_bytes, waf_blocked, waf_logged, waf_passed, attack_req_header_bytes, attack_req_body_bytes, attack_resp_synth_bytes, attack_logged_req_header_bytes, attack_logged_req_body_bytes, attack_blocked_req_header_bytes, attack_blocked_req_body_bytes, attack_passed_req_header_bytes, attack_passed_req_body_bytes, shield_resp_header_bytes, shield_resp_body_bytes, otfp_resp_header_bytes, otfp_resp_body_bytes, otfp_shield_resp_header_bytes, otfp_shield_resp_body_bytes, otfp_shield_time, otfp_deliver_time, imgopto_resp_header_bytes, imgopto_resp_body_bytes, imgopto_shield_resp_header_bytes, imgopto_shield_resp_body_bytes, status_1xx, status_2xx, status_3xx, status_4xx, status_5xx, status_200, status_204, status_206, status_301, status_302, status_304, status_400, status_401, status_403, status_404, status_406, status_416, status_429, status_500, status_501, status_502, status_503, status_504, status_505, uncacheable, pass_time, tls, tls_v10, tls_v11, tls_v12, tls_v13, object_size_1k, object_size_10k, object_size_100k, object_size_1m, object_size_10m, object_size_100m, object_size_1g, object_size_other, recv_sub_time, recv_sub_count, hash_sub_time, hash_sub_count, miss_sub_time, miss_sub_count, fetch_sub_time, fetch_sub_count, pass_sub_time, pass_sub_count, pipe_sub_time, pipe_sub_count, deliver_sub_time, deliver_sub_count, error_sub_time, error_sub_count, hit_sub_time, hit_sub_count, prehash_sub_time, prehash_sub_count, predeliver_sub_time, predeliver_sub_count, hit_resp_body_bytes, miss_resp_body_bytes, pass_resp_body_bytes, compute_req_header_bytes, compute_req_body_bytes, compute_resp_header_bytes, compute_resp_body_bytes, imgvideo, imgvideo_frames, imgvideo_resp_header_bytes, imgvideo_resp_body_bytes, imgvideo_shield, imgvideo_shield_frames, imgvideo_shield_resp_header_bytes, imgvideo_shield_resp_body_bytes, log_bytes, edge_requests, edge_resp_header_bytes, edge_resp_body_bytes, origin_revalidations, origin_fetches, origin_fetch_header_bytes, origin_fetch_body_bytes, origin_fetch_resp_header_bytes, origin_fetch_resp_body_bytes, shield_revalidations, shield_fetches, shield_fetch_header_bytes, shield_fetch_body_bytes, shield_fetch_resp_header_bytes, shield_fetch_resp_body_bytes, segblock_origin_fetches, segblock_shield_fetches, compute_resp_status_1xx, compute_resp_status_2xx, compute_resp_status_3xx, compute_resp_status_4xx, compute_resp_status_5xx, edge_hit_requests, edge_miss_requests, compute_bereq_header_bytes, compute_bereq_body_bytes, compute_beresp_header_bytes, compute_beresp_body_bytes, origin_cache_fetches, shield_cache_fetches, compute_bereqs, compute_bereq_errors, compute_resource_limit_exceeded, compute_heap_limit_exceeded, compute_stack_limit_exceeded, compute_globals_limit_exceeded, compute_guest_errors, compute_runtime_errors, edge_hit_resp_body_bytes, edge_hit_resp_header_bytes, edge_miss_resp_body_bytes, edge_miss_resp_header_bytes, origin_cache_fetch_resp_body_bytes, origin_cache_fetch_resp_header_bytes, shield_hit_requests, shield_miss_requests, shield_hit_resp_header_bytes, shield_hit_resp_body_bytes, shield_miss_resp_header_bytes, shield_miss_resp_body_bytes, websocket_req_header_bytes, websocket_req_body_bytes, websocket_resp_header_bytes, websocket_bereq_header_bytes, websocket_bereq_body_bytes, websocket_beresp_header_bytes, websocket_beresp_body_bytes, websocket_conn_time_ms, websocket_resp_body_bytes, fanout_recv_publishes, fanout_send_publishes, kv_store_class_a_operations, kv_store_class_b_operations, object_store_class_a_operations, object_store_class_b_operations, fanout_req_header_bytes, fanout_req_body_bytes, fanout_resp_header_bytes, fanout_resp_body_bytes, fanout_bereq_header_bytes, fanout_bereq_body_bytes, fanout_beresp_header_bytes, fanout_beresp_body_bytes, fanout_conn_time_ms, ddos_action_limit_streams_connections, ddos_action_limit_streams_requests, ddos_action_tarpit_accept, ddos_action_tarpit, ddos_action_close, ddos_action_blackhole, bot_challenge_starts, bot_challenge_complete_tokens_passed, bot_challenge_complete_tokens_failed, bot_challenge_complete_tokens_checked, bot_challenge_complete_tokens_disabled, bot_challenges_issued, bot_challenges_succeeded, bot_challenges_failed, bot_challenge_complete_tokens_issued, ddos_action_downgrade, ddos_action_downgraded_connections, all_hit_requests, all_miss_requests, all_pass_requests, all_error_requests, all_synth_requests, all_edge_hit_requests, all_edge_miss_requests, all_status_1xx, all_status_2xx, all_status_3xx, all_status_4xx, all_status_5xx, origin_offload, request_denied_get_head_body, service_ddos_requests_detected, service_ddos_requests_mitigated, service_ddos_requests_allowed].hash end # Builds the object from hash diff --git a/lib/fastly/models/results.rb b/lib/fastly/models/results.rb index fbd755be..9462cf0f 100644 --- a/lib/fastly/models/results.rb +++ b/lib/fastly/models/results.rb @@ -701,27 +701,6 @@ class Results # The number of connections the downgrade action was applied to. The downgrade action restricts the connection to http1. attr_accessor :ddos_action_downgraded_connections - # Number of cache hits for a VCL service running on Compute. - attr_accessor :vcl_on_compute_hit_requests - - # Number of cache misses for a VCL service running on Compute. - attr_accessor :vcl_on_compute_miss_requests - - # Number of requests that passed through the CDN without being cached for a VCL service running on Compute. - attr_accessor :vcl_on_compute_pass_requests - - # Number of cache errors for a VCL service running on Compute. - attr_accessor :vcl_on_compute_error_requests - - # Number of requests that returned a synthetic response (i.e., response objects created with the `synthetic` VCL statement) for a VCL service running on Compute. - attr_accessor :vcl_on_compute_synth_requests - - # Number of requests sent by end users to Fastly that resulted in a hit at the edge for a VCL service running on Compute. - attr_accessor :vcl_on_compute_edge_hit_requests - - # Number of requests sent by end users to Fastly that resulted in a miss at the edge for a VCL service running on Compute. - attr_accessor :vcl_on_compute_edge_miss_requests - # Number of cache hits for a VCL service. attr_accessor :all_hit_requests @@ -764,6 +743,15 @@ class Results # Number of requests where Fastly responded with 400 due to the request being a GET or HEAD request containing a body. attr_accessor :request_denied_get_head_body + # Number of requests classified as a DDoS attack against a customer origin or service. + attr_accessor :service_ddos_requests_detected + + # Number of requests classified as a DDoS attack against a customer origin or service that were mitigated by the Fastly platform. + attr_accessor :service_ddos_requests_mitigated + + # Number of requests analyzed for DDoS attacks against a customer origin or service, but with no DDoS detected. + attr_accessor :service_ddos_requests_allowed + attr_accessor :service_id # Timestamp for the start of the time period being reported @@ -1001,13 +989,6 @@ def self.attribute_map :'bot_challenges_failed' => :'bot_challenges_failed', :'ddos_action_downgrade' => :'ddos_action_downgrade', :'ddos_action_downgraded_connections' => :'ddos_action_downgraded_connections', - :'vcl_on_compute_hit_requests' => :'vcl_on_compute_hit_requests', - :'vcl_on_compute_miss_requests' => :'vcl_on_compute_miss_requests', - :'vcl_on_compute_pass_requests' => :'vcl_on_compute_pass_requests', - :'vcl_on_compute_error_requests' => :'vcl_on_compute_error_requests', - :'vcl_on_compute_synth_requests' => :'vcl_on_compute_synth_requests', - :'vcl_on_compute_edge_hit_requests' => :'vcl_on_compute_edge_hit_requests', - :'vcl_on_compute_edge_miss_requests' => :'vcl_on_compute_edge_miss_requests', :'all_hit_requests' => :'all_hit_requests', :'all_miss_requests' => :'all_miss_requests', :'all_pass_requests' => :'all_pass_requests', @@ -1022,6 +1003,9 @@ def self.attribute_map :'all_status_5xx' => :'all_status_5xx', :'origin_offload' => :'origin_offload', :'request_denied_get_head_body' => :'request_denied_get_head_body', + :'service_ddos_requests_detected' => :'service_ddos_requests_detected', + :'service_ddos_requests_mitigated' => :'service_ddos_requests_mitigated', + :'service_ddos_requests_allowed' => :'service_ddos_requests_allowed', :'service_id' => :'service_id', :'start_time' => :'start_time' } @@ -1264,13 +1248,6 @@ def self.fastly_types :'bot_challenges_failed' => :'Integer', :'ddos_action_downgrade' => :'Integer', :'ddos_action_downgraded_connections' => :'Integer', - :'vcl_on_compute_hit_requests' => :'Integer', - :'vcl_on_compute_miss_requests' => :'Integer', - :'vcl_on_compute_pass_requests' => :'Integer', - :'vcl_on_compute_error_requests' => :'Integer', - :'vcl_on_compute_synth_requests' => :'Integer', - :'vcl_on_compute_edge_hit_requests' => :'Integer', - :'vcl_on_compute_edge_miss_requests' => :'Integer', :'all_hit_requests' => :'Integer', :'all_miss_requests' => :'Integer', :'all_pass_requests' => :'Integer', @@ -1285,6 +1262,9 @@ def self.fastly_types :'all_status_5xx' => :'Integer', :'origin_offload' => :'Float', :'request_denied_get_head_body' => :'Integer', + :'service_ddos_requests_detected' => :'Integer', + :'service_ddos_requests_mitigated' => :'Integer', + :'service_ddos_requests_allowed' => :'Integer', :'service_id' => :'String', :'start_time' => :'Integer' } @@ -2228,34 +2208,6 @@ def initialize(attributes = {}) self.ddos_action_downgraded_connections = attributes[:'ddos_action_downgraded_connections'] end - if attributes.key?(:'vcl_on_compute_hit_requests') - self.vcl_on_compute_hit_requests = attributes[:'vcl_on_compute_hit_requests'] - end - - if attributes.key?(:'vcl_on_compute_miss_requests') - self.vcl_on_compute_miss_requests = attributes[:'vcl_on_compute_miss_requests'] - end - - if attributes.key?(:'vcl_on_compute_pass_requests') - self.vcl_on_compute_pass_requests = attributes[:'vcl_on_compute_pass_requests'] - end - - if attributes.key?(:'vcl_on_compute_error_requests') - self.vcl_on_compute_error_requests = attributes[:'vcl_on_compute_error_requests'] - end - - if attributes.key?(:'vcl_on_compute_synth_requests') - self.vcl_on_compute_synth_requests = attributes[:'vcl_on_compute_synth_requests'] - end - - if attributes.key?(:'vcl_on_compute_edge_hit_requests') - self.vcl_on_compute_edge_hit_requests = attributes[:'vcl_on_compute_edge_hit_requests'] - end - - if attributes.key?(:'vcl_on_compute_edge_miss_requests') - self.vcl_on_compute_edge_miss_requests = attributes[:'vcl_on_compute_edge_miss_requests'] - end - if attributes.key?(:'all_hit_requests') self.all_hit_requests = attributes[:'all_hit_requests'] end @@ -2312,6 +2264,18 @@ def initialize(attributes = {}) self.request_denied_get_head_body = attributes[:'request_denied_get_head_body'] end + if attributes.key?(:'service_ddos_requests_detected') + self.service_ddos_requests_detected = attributes[:'service_ddos_requests_detected'] + end + + if attributes.key?(:'service_ddos_requests_mitigated') + self.service_ddos_requests_mitigated = attributes[:'service_ddos_requests_mitigated'] + end + + if attributes.key?(:'service_ddos_requests_allowed') + self.service_ddos_requests_allowed = attributes[:'service_ddos_requests_allowed'] + end + if attributes.key?(:'service_id') self.service_id = attributes[:'service_id'] end @@ -2568,13 +2532,6 @@ def ==(o) bot_challenges_failed == o.bot_challenges_failed && ddos_action_downgrade == o.ddos_action_downgrade && ddos_action_downgraded_connections == o.ddos_action_downgraded_connections && - vcl_on_compute_hit_requests == o.vcl_on_compute_hit_requests && - vcl_on_compute_miss_requests == o.vcl_on_compute_miss_requests && - vcl_on_compute_pass_requests == o.vcl_on_compute_pass_requests && - vcl_on_compute_error_requests == o.vcl_on_compute_error_requests && - vcl_on_compute_synth_requests == o.vcl_on_compute_synth_requests && - vcl_on_compute_edge_hit_requests == o.vcl_on_compute_edge_hit_requests && - vcl_on_compute_edge_miss_requests == o.vcl_on_compute_edge_miss_requests && all_hit_requests == o.all_hit_requests && all_miss_requests == o.all_miss_requests && all_pass_requests == o.all_pass_requests && @@ -2589,6 +2546,9 @@ def ==(o) all_status_5xx == o.all_status_5xx && origin_offload == o.origin_offload && request_denied_get_head_body == o.request_denied_get_head_body && + service_ddos_requests_detected == o.service_ddos_requests_detected && + service_ddos_requests_mitigated == o.service_ddos_requests_mitigated && + service_ddos_requests_allowed == o.service_ddos_requests_allowed && service_id == o.service_id && start_time == o.start_time end @@ -2602,7 +2562,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [requests, hits, hits_time, miss, miss_time, pass, pass_time, errors, restarts, hit_ratio, bandwidth, body_size, header_size, req_body_bytes, req_header_bytes, resp_body_bytes, resp_header_bytes, bereq_body_bytes, bereq_header_bytes, uncacheable, pipe, synth, tls, tls_v10, tls_v11, tls_v12, tls_v13, edge_requests, edge_resp_header_bytes, edge_resp_body_bytes, edge_hit_requests, edge_miss_requests, origin_fetches, origin_fetch_header_bytes, origin_fetch_body_bytes, origin_fetch_resp_header_bytes, origin_fetch_resp_body_bytes, origin_revalidations, origin_cache_fetches, shield, shield_resp_body_bytes, shield_resp_header_bytes, shield_fetches, shield_fetch_header_bytes, shield_fetch_body_bytes, shield_fetch_resp_header_bytes, shield_fetch_resp_body_bytes, shield_revalidations, shield_cache_fetches, ipv6, otfp, otfp_resp_body_bytes, otfp_resp_header_bytes, otfp_shield_resp_body_bytes, otfp_shield_resp_header_bytes, otfp_manifests, otfp_deliver_time, otfp_shield_time, video, pci, log, log_bytes, http2, http3, waf_logged, waf_blocked, waf_passed, attack_req_body_bytes, attack_req_header_bytes, attack_logged_req_body_bytes, attack_logged_req_header_bytes, attack_blocked_req_body_bytes, attack_blocked_req_header_bytes, attack_passed_req_body_bytes, attack_passed_req_header_bytes, attack_resp_synth_bytes, imgopto, imgopto_resp_body_bytes, imgopto_resp_header_bytes, imgopto_shield, imgopto_shield_resp_body_bytes, imgopto_shield_resp_header_bytes, imgopto_transforms, imgvideo, imgvideo_frames, imgvideo_resp_header_bytes, imgvideo_resp_body_bytes, imgvideo_shield_resp_header_bytes, imgvideo_shield_resp_body_bytes, imgvideo_shield, imgvideo_shield_frames, status_200, status_204, status_206, status_301, status_302, status_304, status_400, status_401, status_403, status_404, status_406, status_416, status_429, status_500, status_501, status_502, status_503, status_504, status_505, status_1xx, status_2xx, status_3xx, status_4xx, status_5xx, object_size_1k, object_size_10k, object_size_100k, object_size_1m, object_size_10m, object_size_100m, object_size_1g, recv_sub_time, recv_sub_count, hash_sub_time, hash_sub_count, miss_sub_time, miss_sub_count, fetch_sub_time, fetch_sub_count, pass_sub_time, pass_sub_count, pipe_sub_time, pipe_sub_count, deliver_sub_time, deliver_sub_count, error_sub_time, error_sub_count, hit_sub_time, hit_sub_count, prehash_sub_time, prehash_sub_count, predeliver_sub_time, predeliver_sub_count, tls_handshake_sent_bytes, hit_resp_body_bytes, miss_resp_body_bytes, pass_resp_body_bytes, segblock_origin_fetches, segblock_shield_fetches, compute_requests, compute_request_time_ms, compute_request_time_billed_ms, compute_ram_used, compute_execution_time_ms, compute_req_header_bytes, compute_req_body_bytes, compute_resp_header_bytes, compute_resp_body_bytes, compute_resp_status_1xx, compute_resp_status_2xx, compute_resp_status_3xx, compute_resp_status_4xx, compute_resp_status_5xx, compute_bereq_header_bytes, compute_bereq_body_bytes, compute_beresp_header_bytes, compute_beresp_body_bytes, compute_bereqs, compute_bereq_errors, compute_resource_limit_exceeded, compute_heap_limit_exceeded, compute_stack_limit_exceeded, compute_globals_limit_exceeded, compute_guest_errors, compute_runtime_errors, edge_hit_resp_body_bytes, edge_hit_resp_header_bytes, edge_miss_resp_body_bytes, edge_miss_resp_header_bytes, origin_cache_fetch_resp_body_bytes, origin_cache_fetch_resp_header_bytes, shield_hit_requests, shield_miss_requests, shield_hit_resp_header_bytes, shield_hit_resp_body_bytes, shield_miss_resp_header_bytes, shield_miss_resp_body_bytes, websocket_req_header_bytes, websocket_req_body_bytes, websocket_resp_header_bytes, websocket_resp_body_bytes, websocket_bereq_header_bytes, websocket_bereq_body_bytes, websocket_beresp_header_bytes, websocket_beresp_body_bytes, websocket_conn_time_ms, fanout_recv_publishes, fanout_send_publishes, kv_store_class_a_operations, kv_store_class_b_operations, object_store_class_a_operations, object_store_class_b_operations, fanout_req_header_bytes, fanout_req_body_bytes, fanout_resp_header_bytes, fanout_resp_body_bytes, fanout_bereq_header_bytes, fanout_bereq_body_bytes, fanout_beresp_header_bytes, fanout_beresp_body_bytes, fanout_conn_time_ms, ddos_action_limit_streams_connections, ddos_action_limit_streams_requests, ddos_action_tarpit_accept, ddos_action_tarpit, ddos_action_close, ddos_action_blackhole, bot_challenge_starts, bot_challenge_complete_tokens_passed, bot_challenge_complete_tokens_failed, bot_challenge_complete_tokens_checked, bot_challenge_complete_tokens_disabled, bot_challenge_complete_tokens_issued, bot_challenges_issued, bot_challenges_succeeded, bot_challenges_failed, ddos_action_downgrade, ddos_action_downgraded_connections, vcl_on_compute_hit_requests, vcl_on_compute_miss_requests, vcl_on_compute_pass_requests, vcl_on_compute_error_requests, vcl_on_compute_synth_requests, vcl_on_compute_edge_hit_requests, vcl_on_compute_edge_miss_requests, all_hit_requests, all_miss_requests, all_pass_requests, all_error_requests, all_synth_requests, all_edge_hit_requests, all_edge_miss_requests, all_status_1xx, all_status_2xx, all_status_3xx, all_status_4xx, all_status_5xx, origin_offload, request_denied_get_head_body, service_id, start_time].hash + [requests, hits, hits_time, miss, miss_time, pass, pass_time, errors, restarts, hit_ratio, bandwidth, body_size, header_size, req_body_bytes, req_header_bytes, resp_body_bytes, resp_header_bytes, bereq_body_bytes, bereq_header_bytes, uncacheable, pipe, synth, tls, tls_v10, tls_v11, tls_v12, tls_v13, edge_requests, edge_resp_header_bytes, edge_resp_body_bytes, edge_hit_requests, edge_miss_requests, origin_fetches, origin_fetch_header_bytes, origin_fetch_body_bytes, origin_fetch_resp_header_bytes, origin_fetch_resp_body_bytes, origin_revalidations, origin_cache_fetches, shield, shield_resp_body_bytes, shield_resp_header_bytes, shield_fetches, shield_fetch_header_bytes, shield_fetch_body_bytes, shield_fetch_resp_header_bytes, shield_fetch_resp_body_bytes, shield_revalidations, shield_cache_fetches, ipv6, otfp, otfp_resp_body_bytes, otfp_resp_header_bytes, otfp_shield_resp_body_bytes, otfp_shield_resp_header_bytes, otfp_manifests, otfp_deliver_time, otfp_shield_time, video, pci, log, log_bytes, http2, http3, waf_logged, waf_blocked, waf_passed, attack_req_body_bytes, attack_req_header_bytes, attack_logged_req_body_bytes, attack_logged_req_header_bytes, attack_blocked_req_body_bytes, attack_blocked_req_header_bytes, attack_passed_req_body_bytes, attack_passed_req_header_bytes, attack_resp_synth_bytes, imgopto, imgopto_resp_body_bytes, imgopto_resp_header_bytes, imgopto_shield, imgopto_shield_resp_body_bytes, imgopto_shield_resp_header_bytes, imgopto_transforms, imgvideo, imgvideo_frames, imgvideo_resp_header_bytes, imgvideo_resp_body_bytes, imgvideo_shield_resp_header_bytes, imgvideo_shield_resp_body_bytes, imgvideo_shield, imgvideo_shield_frames, status_200, status_204, status_206, status_301, status_302, status_304, status_400, status_401, status_403, status_404, status_406, status_416, status_429, status_500, status_501, status_502, status_503, status_504, status_505, status_1xx, status_2xx, status_3xx, status_4xx, status_5xx, object_size_1k, object_size_10k, object_size_100k, object_size_1m, object_size_10m, object_size_100m, object_size_1g, recv_sub_time, recv_sub_count, hash_sub_time, hash_sub_count, miss_sub_time, miss_sub_count, fetch_sub_time, fetch_sub_count, pass_sub_time, pass_sub_count, pipe_sub_time, pipe_sub_count, deliver_sub_time, deliver_sub_count, error_sub_time, error_sub_count, hit_sub_time, hit_sub_count, prehash_sub_time, prehash_sub_count, predeliver_sub_time, predeliver_sub_count, tls_handshake_sent_bytes, hit_resp_body_bytes, miss_resp_body_bytes, pass_resp_body_bytes, segblock_origin_fetches, segblock_shield_fetches, compute_requests, compute_request_time_ms, compute_request_time_billed_ms, compute_ram_used, compute_execution_time_ms, compute_req_header_bytes, compute_req_body_bytes, compute_resp_header_bytes, compute_resp_body_bytes, compute_resp_status_1xx, compute_resp_status_2xx, compute_resp_status_3xx, compute_resp_status_4xx, compute_resp_status_5xx, compute_bereq_header_bytes, compute_bereq_body_bytes, compute_beresp_header_bytes, compute_beresp_body_bytes, compute_bereqs, compute_bereq_errors, compute_resource_limit_exceeded, compute_heap_limit_exceeded, compute_stack_limit_exceeded, compute_globals_limit_exceeded, compute_guest_errors, compute_runtime_errors, edge_hit_resp_body_bytes, edge_hit_resp_header_bytes, edge_miss_resp_body_bytes, edge_miss_resp_header_bytes, origin_cache_fetch_resp_body_bytes, origin_cache_fetch_resp_header_bytes, shield_hit_requests, shield_miss_requests, shield_hit_resp_header_bytes, shield_hit_resp_body_bytes, shield_miss_resp_header_bytes, shield_miss_resp_body_bytes, websocket_req_header_bytes, websocket_req_body_bytes, websocket_resp_header_bytes, websocket_resp_body_bytes, websocket_bereq_header_bytes, websocket_bereq_body_bytes, websocket_beresp_header_bytes, websocket_beresp_body_bytes, websocket_conn_time_ms, fanout_recv_publishes, fanout_send_publishes, kv_store_class_a_operations, kv_store_class_b_operations, object_store_class_a_operations, object_store_class_b_operations, fanout_req_header_bytes, fanout_req_body_bytes, fanout_resp_header_bytes, fanout_resp_body_bytes, fanout_bereq_header_bytes, fanout_bereq_body_bytes, fanout_beresp_header_bytes, fanout_beresp_body_bytes, fanout_conn_time_ms, ddos_action_limit_streams_connections, ddos_action_limit_streams_requests, ddos_action_tarpit_accept, ddos_action_tarpit, ddos_action_close, ddos_action_blackhole, bot_challenge_starts, bot_challenge_complete_tokens_passed, bot_challenge_complete_tokens_failed, bot_challenge_complete_tokens_checked, bot_challenge_complete_tokens_disabled, bot_challenge_complete_tokens_issued, bot_challenges_issued, bot_challenges_succeeded, bot_challenges_failed, ddos_action_downgrade, ddos_action_downgraded_connections, all_hit_requests, all_miss_requests, all_pass_requests, all_error_requests, all_synth_requests, all_edge_hit_requests, all_edge_miss_requests, all_status_1xx, all_status_2xx, all_status_3xx, all_status_4xx, all_status_5xx, origin_offload, request_denied_get_head_body, service_ddos_requests_detected, service_ddos_requests_mitigated, service_ddos_requests_allowed, service_id, start_time].hash end # Builds the object from hash diff --git a/lib/fastly/models/set_configuration.rb b/lib/fastly/models/set_configuration.rb index e584cff9..8e394512 100644 --- a/lib/fastly/models/set_configuration.rb +++ b/lib/fastly/models/set_configuration.rb @@ -19,11 +19,15 @@ class SetConfiguration # The new traffic ramp. Optional in the `PATCH` request body for `ngwaf`. attr_accessor :traffic_ramp + # The new mode to run the product in. One of `block`, `log`, or `off`. Optional in the `PATCH` request body for `ddos_protection`. + attr_accessor :mode + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'workspace_id' => :'workspace_id', - :'traffic_ramp' => :'traffic_ramp' + :'traffic_ramp' => :'traffic_ramp', + :'mode' => :'mode' } end @@ -36,7 +40,8 @@ def self.acceptable_attributes def self.fastly_types { :'workspace_id' => :'String', - :'traffic_ramp' => :'String' + :'traffic_ramp' => :'String', + :'mode' => :'String' } end @@ -68,6 +73,10 @@ def initialize(attributes = {}) if attributes.key?(:'traffic_ramp') self.traffic_ramp = attributes[:'traffic_ramp'] end + + if attributes.key?(:'mode') + self.mode = attributes[:'mode'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -89,7 +98,8 @@ def ==(o) return true if self.equal?(o) self.class == o.class && workspace_id == o.workspace_id && - traffic_ramp == o.traffic_ramp + traffic_ramp == o.traffic_ramp && + mode == o.mode end # @see the `==` method @@ -101,7 +111,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [workspace_id, traffic_ramp].hash + [workspace_id, traffic_ramp, mode].hash end # Builds the object from hash diff --git a/lib/fastly/models/usagemetric.rb b/lib/fastly/models/usagemetric.rb new file mode 100644 index 00000000..6b250283 --- /dev/null +++ b/lib/fastly/models/usagemetric.rb @@ -0,0 +1,297 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class Usagemetric + # The year and month of the usage element. + attr_accessor :month + + # The usage type identifier for the usage. This is a single, billable metric for the product. + attr_accessor :usage_type + + # Full name of the product usage type as it might appear on a customer's invoice. + attr_accessor :name + + # The geographical area applicable for regionally based products. + attr_accessor :region + + # The unit for the usage as shown on an invoice. If there is no explicit unit, this field will be \"unit\" (e.g., a request with `product_id` of 'cdn_usage' and `usage_type` of 'North America Requests' has no unit, and will return \"unit\"). + attr_accessor :unit + + # The quantity of the usage for the product. + attr_accessor :quantity + + # The raw units measured for the product. + attr_accessor :raw_quantity + + # The product identifier associated with the usage type. This corresponds to a Fastly product offering. + attr_accessor :product_id + + # The date when the usage metric was last updated. + attr_accessor :last_updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'month' => :'month', + :'usage_type' => :'usage_type', + :'name' => :'name', + :'region' => :'region', + :'unit' => :'unit', + :'quantity' => :'quantity', + :'raw_quantity' => :'raw_quantity', + :'product_id' => :'product_id', + :'last_updated_at' => :'last_updated_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'month' => :'String', + :'usage_type' => :'String', + :'name' => :'String', + :'region' => :'String', + :'unit' => :'String', + :'quantity' => :'Float', + :'raw_quantity' => :'Float', + :'product_id' => :'String', + :'last_updated_at' => :'String' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::Usagemetric` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::Usagemetric`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'month') + self.month = attributes[:'month'] + end + + if attributes.key?(:'usage_type') + self.usage_type = attributes[:'usage_type'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'region') + self.region = attributes[:'region'] + end + + if attributes.key?(:'unit') + self.unit = attributes[:'unit'] + end + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + end + + if attributes.key?(:'raw_quantity') + self.raw_quantity = attributes[:'raw_quantity'] + end + + if attributes.key?(:'product_id') + self.product_id = attributes[:'product_id'] + end + + if attributes.key?(:'last_updated_at') + self.last_updated_at = attributes[:'last_updated_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + month == o.month && + usage_type == o.usage_type && + name == o.name && + region == o.region && + unit == o.unit && + quantity == o.quantity && + raw_quantity == o.raw_quantity && + product_id == o.product_id && + last_updated_at == o.last_updated_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [month, usage_type, name, region, unit, quantity, raw_quantity, product_id, last_updated_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/usagemetrics.rb b/lib/fastly/models/usagemetrics.rb new file mode 100644 index 00000000..7225199f --- /dev/null +++ b/lib/fastly/models/usagemetrics.rb @@ -0,0 +1,218 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class Usagemetrics + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::Usagemetrics` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::Usagemetrics`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/value_field.rb b/lib/fastly/models/value_field.rb new file mode 100644 index 00000000..bc0f8431 --- /dev/null +++ b/lib/fastly/models/value_field.rb @@ -0,0 +1,108 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + module ValueField + class << self + # List of class defined in oneOf (OpenAPI v3) + def fastly_one_of + [ + :'Array', + :'Array', + :'Array', + :'Boolean', + :'Float', + :'Integer', + :'String' + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + fastly_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + fastly_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when 'Boolean' + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when 'Float' + return data if data.instance_of?(Float) + when 'Integer' + return data if data.instance_of?(Integer) + when 'Time' + return Time.parse(data) + when 'Date' + return Date.parse(data) + when 'String' + return data if data.instance_of?(String) + when 'Object' # "type: object" + return data if data.instance_of?(Hash) + when /\AArray<(?.+)>\z/ # "type: array" + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + else # model + const = Fastly.const_get(klass) + if const + if const.respond_to?(:fastly_one_of) # nested oneOf model + model = const.build(data) + return model if model + else + # raise if data contains keys that are not known to the model + raise unless (data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + return model if model && model.valid? + end + end + end + + raise # if no match by now, raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + +end diff --git a/lib/fastly/models/values503_responses.rb b/lib/fastly/models/values503_responses.rb new file mode 100644 index 00000000..a8d93d97 --- /dev/null +++ b/lib/fastly/models/values503_responses.rb @@ -0,0 +1,237 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class Values503Responses + # The HTTP request path. + attr_accessor :url + + # The rate at which the reason in this dimension occurs among responses to this URL with a 503 status code. + attr_accessor :rate_per_url + + # The rate at which 503 status codes are returned for this URL. + attr_accessor :_503_rate_per_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url', + :'rate_per_url' => :'rate_per_url', + :'_503_rate_per_url' => :'503_rate_per_url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'url' => :'String', + :'rate_per_url' => :'Float', + :'_503_rate_per_url' => :'Float' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::Values503Responses` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::Values503Responses`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + + if attributes.key?(:'rate_per_url') + self.rate_per_url = attributes[:'rate_per_url'] + end + + if attributes.key?(:'_503_rate_per_url') + self._503_rate_per_url = attributes[:'_503_rate_per_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url && + rate_per_url == o.rate_per_url && + _503_rate_per_url == o._503_rate_per_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url, rate_per_url, _503_rate_per_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/values_bandwidth.rb b/lib/fastly/models/values_bandwidth.rb new file mode 100644 index 00000000..976beb6f --- /dev/null +++ b/lib/fastly/models/values_bandwidth.rb @@ -0,0 +1,227 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class ValuesBandwidth + # The average bandwidth in bytes for responses to requests to the URL in the current dimension. + attr_accessor :average_bandwidth_bytes + + # The total bandwidth percentage for all responses to requests to the URL in the current dimension. + attr_accessor :bandwidth_percentage + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'average_bandwidth_bytes' => :'average_bandwidth_bytes', + :'bandwidth_percentage' => :'bandwidth_percentage' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'average_bandwidth_bytes' => :'Float', + :'bandwidth_percentage' => :'Float' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::ValuesBandwidth` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ValuesBandwidth`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'average_bandwidth_bytes') + self.average_bandwidth_bytes = attributes[:'average_bandwidth_bytes'] + end + + if attributes.key?(:'bandwidth_percentage') + self.bandwidth_percentage = attributes[:'bandwidth_percentage'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + average_bandwidth_bytes == o.average_bandwidth_bytes && + bandwidth_percentage == o.bandwidth_percentage + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [average_bandwidth_bytes, bandwidth_percentage].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/values_browser.rb b/lib/fastly/models/values_browser.rb new file mode 100644 index 00000000..8177abe3 --- /dev/null +++ b/lib/fastly/models/values_browser.rb @@ -0,0 +1,227 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class ValuesBrowser + # The version of the client's browser. + attr_accessor :browser_version + + # The percentage of requests by this version of the browser specified in the dimension. + attr_accessor :rate + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'browser_version' => :'browser_version', + :'rate' => :'rate' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'browser_version' => :'String', + :'rate' => :'Float' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::ValuesBrowser` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ValuesBrowser`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'browser_version') + self.browser_version = attributes[:'browser_version'] + end + + if attributes.key?(:'rate') + self.rate = attributes[:'rate'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + browser_version == o.browser_version && + rate == o.rate + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [browser_version, rate].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/values_cache_hit_ratio.rb b/lib/fastly/models/values_cache_hit_ratio.rb new file mode 100644 index 00000000..9de97565 --- /dev/null +++ b/lib/fastly/models/values_cache_hit_ratio.rb @@ -0,0 +1,217 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class ValuesCacheHitRatio + # The cache hit ratio for the URL specified in the dimension. + attr_accessor :cache_hit_ratio + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'cache_hit_ratio' => :'cache_hit_ratio' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'cache_hit_ratio' => :'Float' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::ValuesCacheHitRatio` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ValuesCacheHitRatio`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'cache_hit_ratio') + self.cache_hit_ratio = attributes[:'cache_hit_ratio'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + cache_hit_ratio == o.cache_hit_ratio + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [cache_hit_ratio].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/values_country_stats.rb b/lib/fastly/models/values_country_stats.rb new file mode 100644 index 00000000..cb8caf4a --- /dev/null +++ b/lib/fastly/models/values_country_stats.rb @@ -0,0 +1,237 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class ValuesCountryStats + # The client's country subdivision code as defined by ISO 3166-2. + attr_accessor :region + + # The cache hit ratio for the region. + attr_accessor :region_chr + + # The error rate for the region. + attr_accessor :region_error_rate + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'region' => :'region', + :'region_chr' => :'region_chr', + :'region_error_rate' => :'region_error_rate' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'region' => :'String', + :'region_chr' => :'Float', + :'region_error_rate' => :'Float' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::ValuesCountryStats` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ValuesCountryStats`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'region') + self.region = attributes[:'region'] + end + + if attributes.key?(:'region_chr') + self.region_chr = attributes[:'region_chr'] + end + + if attributes.key?(:'region_error_rate') + self.region_error_rate = attributes[:'region_error_rate'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + region == o.region && + region_chr == o.region_chr && + region_error_rate == o.region_error_rate + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [region, region_chr, region_error_rate].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/values_duration.rb b/lib/fastly/models/values_duration.rb new file mode 100644 index 00000000..2c90d3f4 --- /dev/null +++ b/lib/fastly/models/values_duration.rb @@ -0,0 +1,237 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class ValuesDuration + # The average time in seconds to respond to requests to the URL in the current dimension. + attr_accessor :average_response_time + + # The P95 time in seconds to respond to requests to the URL in the current dimension. + attr_accessor :p95_response_time + + # The total percentage of time to respond to all requests to the URL in the current dimension. + attr_accessor :response_time_percentage + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'average_response_time' => :'average_response_time', + :'p95_response_time' => :'p95_response_time', + :'response_time_percentage' => :'response_time_percentage' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'average_response_time' => :'Float', + :'p95_response_time' => :'Float', + :'response_time_percentage' => :'Float' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::ValuesDuration` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ValuesDuration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'average_response_time') + self.average_response_time = attributes[:'average_response_time'] + end + + if attributes.key?(:'p95_response_time') + self.p95_response_time = attributes[:'p95_response_time'] + end + + if attributes.key?(:'response_time_percentage') + self.response_time_percentage = attributes[:'response_time_percentage'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + average_response_time == o.average_response_time && + p95_response_time == o.p95_response_time && + response_time_percentage == o.response_time_percentage + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [average_response_time, p95_response_time, response_time_percentage].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/values_misses.rb b/lib/fastly/models/values_misses.rb new file mode 100644 index 00000000..d056e8aa --- /dev/null +++ b/lib/fastly/models/values_misses.rb @@ -0,0 +1,217 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class ValuesMisses + # The miss rate for requests to the URL in the current dimension. + attr_accessor :miss_rate + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'miss_rate' => :'miss_rate' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'miss_rate' => :'Float' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::ValuesMisses` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ValuesMisses`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'miss_rate') + self.miss_rate = attributes[:'miss_rate'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + miss_rate == o.miss_rate + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [miss_rate].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/values_rate.rb b/lib/fastly/models/values_rate.rb new file mode 100644 index 00000000..87a59a97 --- /dev/null +++ b/lib/fastly/models/values_rate.rb @@ -0,0 +1,217 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class ValuesRate + # The percentage of requests matching the value in the current dimension. + attr_accessor :rate + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'rate' => :'rate' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'rate' => :'Float' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::ValuesRate` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ValuesRate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'rate') + self.rate = attributes[:'rate'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rate == o.rate + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [rate].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/values_requests.rb b/lib/fastly/models/values_requests.rb new file mode 100644 index 00000000..af143b08 --- /dev/null +++ b/lib/fastly/models/values_requests.rb @@ -0,0 +1,217 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class ValuesRequests + # The percentage of all requests made to the URL in the current dimension. + attr_accessor :request_percentage + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'request_percentage' => :'request_percentage' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'request_percentage' => :'Float' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::ValuesRequests` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ValuesRequests`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'request_percentage') + self.request_percentage = attributes[:'request_percentage'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + request_percentage == o.request_percentage + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [request_percentage].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/values_status_codes.rb b/lib/fastly/models/values_status_codes.rb new file mode 100644 index 00000000..591fec03 --- /dev/null +++ b/lib/fastly/models/values_status_codes.rb @@ -0,0 +1,237 @@ +=begin +#Fastly API + +#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class ValuesStatusCodes + # The HTTP request path. + attr_accessor :url + + # The URL accounts for this percentage of the status code in this dimension. + attr_accessor :rate_per_status + + # The rate at which the status code in this dimension occurs for this URL. + attr_accessor :rate_per_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url', + :'rate_per_status' => :'rate_per_status', + :'rate_per_url' => :'rate_per_url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'url' => :'String', + :'rate_per_status' => :'Float', + :'rate_per_url' => :'Float' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::ValuesStatusCodes` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ValuesStatusCodes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + + if attributes.key?(:'rate_per_status') + self.rate_per_status = attributes[:'rate_per_status'] + end + + if attributes.key?(:'rate_per_url') + self.rate_per_url = attributes[:'rate_per_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url && + rate_per_status == o.rate_per_status && + rate_per_url == o.rate_per_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url, rate_per_status, rate_per_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/version.rb b/lib/fastly/version.rb index 5ebdd089..bb7260cb 100644 --- a/lib/fastly/version.rb +++ b/lib/fastly/version.rb @@ -9,5 +9,5 @@ =end module Fastly - VERSION = '8.9.0' + VERSION = '9.0.0' end diff --git a/sig.json b/sig.json index d9facb92..4729e57b 100644 --- a/sig.json +++ b/sig.json @@ -1 +1 @@ -{"G": "1827dbb1", "D": "1f27800e"} +{"G": "8147d17d", "D": "c00fd741"}