From 15f88793e487f2db165c3e333566c9219fcb0ae2 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 5 Aug 2024 06:37:38 +0000 Subject: [PATCH] Generated v8.6.0 --- CHANGELOG.md | 10 + README.md | 17 +- ...onshipTlsDnsRecord.md => AsyncResponse.md} | 5 +- docs/BillingInvoicesApi.md | 41 +- docs/BillingUsageMetricsApi.md | 111 ++++++ docs/CreateDashboardRequest.md | 12 + docs/Dashboard.md | 17 + docs/DashboardItem.md | 15 + docs/DashboardItemPropertyDataSource.md | 11 + ...ardItemPropertyDataSourcePropertyConfig.md | 10 + docs/DashboardItemPropertyVisualization.md | 11 + ...ItemPropertyVisualizationPropertyConfig.md | 12 + ...cords.md => DashboardPropertyCreatedBy.md} | 3 +- ...ecord.md => DashboardPropertyUpdatedBy.md} | 3 +- docs/DomainInspectorMeasurements.md | 2 +- ...voiceResponse.md => EomInvoiceResponse.md} | 2 +- docs/GetServiceLevelUsageResponse.md | 10 + docs/GetServiceLevelUsageTypesResponse.md | 10 + docs/IncludedWithTlsConfiguration.md | 10 + docs/IncludedWithTlsConfigurationItem.md | 12 + docs/ListDashboardsResponse.md | 11 + ...Response.md => ListEomInvoicesResponse.md} | 2 +- docs/MtdInvoiceResponse.md | 15 + docs/Mtdinvoice.md | 15 + docs/Mtdlineitems.md | 18 + docs/ObservabilityCustomDashboardsApi.md | 203 ++++++++++ docs/RealtimeEntryAggregated.md | 1 + docs/RealtimeMeasurements.md | 1 + .../RelationshipDefaultEcdsaTlsCertificate.md | 10 + ...saTlsCertificateDefaultEcdsaCertificate.md | 10 + ...sCertificateDefaultEcdsaCertificateData.md | 11 + docs/RelationshipDefaultTlsCertificate.md | 10 + ...DefaultTlsCertificateDefaultCertificate.md | 10 + ...ultTlsCertificateDefaultCertificateData.md | 11 + docs/RelationshipTlsDnsRecordsRequest.md | 10 + ...ationshipTlsDnsRecordsRequestDnsRecords.md | 10 + ...nshipTlsDnsRecordsRequestDnsRecordsData.md | 11 + docs/RelationshipTlsDnsRecordsResponse.md | 10 + ...tionshipTlsDnsRecordsResponseDnsRecords.md | 10 + ...hipTlsDnsRecordsResponseDnsRecordsData.md} | 2 +- docs/Results.md | 1 + docs/Serviceusagemetric.md | 13 + docs/Serviceusagemetrics.md | 10 + docs/ServiceusagemetricsData.md | 16 + docs/Serviceusagetype.md | 11 + docs/Serviceusagetypes.md | 10 + docs/TlsCertificateBlobResponse.md | 10 + docs/TlsCertificatesApi.md | 38 ++ docs/TlsDnsRecord.md | 3 +- docs/UpdateDashboardRequest.md | 12 + docs/Values.md | 2 +- lib/fastly.rb | 47 ++- lib/fastly/api/billing_invoices_api.rb | 68 +++- lib/fastly/api/billing_usage_metrics_api.rb | 213 ++++++++++ .../observability_custom_dashboards_api.rb | 333 ++++++++++++++++ lib/fastly/api/tls_certificates_api.rb | 63 +++ lib/fastly/configuration.rb | 54 +++ lib/fastly/models/async_response.rb | 225 +++++++++++ lib/fastly/models/create_dashboard_request.rb | 245 ++++++++++++ lib/fastly/models/dashboard.rb | 290 ++++++++++++++ lib/fastly/models/dashboard_item.rb | 368 ++++++++++++++++++ .../dashboard_item_property_data_source.rb | 271 +++++++++++++ ...em_property_data_source_property_config.rb | 244 ++++++++++++ .../dashboard_item_property_visualization.rb | 271 +++++++++++++ ..._property_visualization_property_config.rb | 303 ++++++++++++++ .../models/dashboard_property_created_by.rb | 208 ++++++++++ .../models/dashboard_property_updated_by.rb | 208 ++++++++++ .../models/domain_inspector_measurements.rb | 2 +- ...ce_response.rb => eom_invoice_response.rb} | 6 +- .../get_service_level_usage_response.rb | 223 +++++++++++ .../get_service_level_usage_types_response.rb | 225 +++++++++++ .../models/included_with_tls_configuration.rb | 218 +++++++++++ .../included_with_tls_configuration_item.rb | 237 +++++++++++ lib/fastly/models/invoicelineitems.rb | 10 +- lib/fastly/models/list_dashboards_response.rb | 229 +++++++++++ ...ponse.rb => list_eom_invoices_response.rb} | 6 +- lib/fastly/models/mtd_invoice_response.rb | 275 +++++++++++++ lib/fastly/models/mtdinvoice.rb | 268 +++++++++++++ lib/fastly/models/mtdlineitems.rb | 297 ++++++++++++++ .../models/realtime_entry_aggregated.rb | 18 +- lib/fastly/models/realtime_measurements.rb | 18 +- ...ationship_default_ecdsa_tls_certificate.rb | 216 ++++++++++ ...s_certificate_default_ecdsa_certificate.rb | 216 ++++++++++ ...tificate_default_ecdsa_certificate_data.rb | 228 +++++++++++ .../relationship_default_tls_certificate.rb | 216 ++++++++++ ...ult_tls_certificate_default_certificate.rb | 216 ++++++++++ ...ls_certificate_default_certificate_data.rb | 228 +++++++++++ ...> relationship_tls_dns_records_request.rb} | 8 +- ...hip_tls_dns_records_request_dns_records.rb | 218 +++++++++++ ...s_dns_records_request_dns_records_data.rb} | 6 +- .../relationship_tls_dns_records_response.rb | 216 ++++++++++ ...ip_tls_dns_records_response_dns_records.rb | 218 +++++++++++ ...s_dns_records_response_dns_records_data.rb | 227 +++++++++++ .../relationships_for_tls_configuration.rb | 2 +- lib/fastly/models/results.rb | 12 +- lib/fastly/models/serviceusagemetric.rb | 246 ++++++++++++ ...s_dns_record.rb => serviceusagemetrics.rb} | 20 +- lib/fastly/models/serviceusagemetrics_data.rb | 276 +++++++++++++ lib/fastly/models/serviceusagetype.rb | 227 +++++++++++ ...ord_dns_record.rb => serviceusagetypes.rb} | 8 +- .../models/tls_certificate_blob_response.rb | 217 +++++++++++ lib/fastly/models/tls_dns_record.rb | 60 ++- lib/fastly/models/update_dashboard_request.rb | 240 ++++++++++++ lib/fastly/models/values.rb | 2 +- lib/fastly/version.rb | 2 +- sig.json | 2 +- 106 files changed, 9712 insertions(+), 89 deletions(-) rename docs/{RelationshipTlsDnsRecord.md => AsyncResponse.md} (54%) create mode 100644 docs/BillingUsageMetricsApi.md create mode 100644 docs/CreateDashboardRequest.md create mode 100644 docs/Dashboard.md create mode 100644 docs/DashboardItem.md create mode 100644 docs/DashboardItemPropertyDataSource.md create mode 100644 docs/DashboardItemPropertyDataSourcePropertyConfig.md create mode 100644 docs/DashboardItemPropertyVisualization.md create mode 100644 docs/DashboardItemPropertyVisualizationPropertyConfig.md rename docs/{RelationshipTlsDnsRecords.md => DashboardPropertyCreatedBy.md} (53%) rename docs/{RelationshipTlsDnsRecordDnsRecord.md => DashboardPropertyUpdatedBy.md} (52%) rename docs/{InvoiceResponse.md => EomInvoiceResponse.md} (97%) create mode 100644 docs/GetServiceLevelUsageResponse.md create mode 100644 docs/GetServiceLevelUsageTypesResponse.md create mode 100644 docs/IncludedWithTlsConfiguration.md create mode 100644 docs/IncludedWithTlsConfigurationItem.md create mode 100644 docs/ListDashboardsResponse.md rename docs/{ListInvoicesResponse.md => ListEomInvoicesResponse.md} (90%) create mode 100644 docs/MtdInvoiceResponse.md create mode 100644 docs/Mtdinvoice.md create mode 100644 docs/Mtdlineitems.md create mode 100644 docs/ObservabilityCustomDashboardsApi.md create mode 100644 docs/RelationshipDefaultEcdsaTlsCertificate.md create mode 100644 docs/RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificate.md create mode 100644 docs/RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificateData.md create mode 100644 docs/RelationshipDefaultTlsCertificate.md create mode 100644 docs/RelationshipDefaultTlsCertificateDefaultCertificate.md create mode 100644 docs/RelationshipDefaultTlsCertificateDefaultCertificateData.md create mode 100644 docs/RelationshipTlsDnsRecordsRequest.md create mode 100644 docs/RelationshipTlsDnsRecordsRequestDnsRecords.md create mode 100644 docs/RelationshipTlsDnsRecordsRequestDnsRecordsData.md create mode 100644 docs/RelationshipTlsDnsRecordsResponse.md create mode 100644 docs/RelationshipTlsDnsRecordsResponseDnsRecords.md rename docs/{RelationshipMemberTlsDnsRecord.md => RelationshipTlsDnsRecordsResponseDnsRecordsData.md} (85%) create mode 100644 docs/Serviceusagemetric.md create mode 100644 docs/Serviceusagemetrics.md create mode 100644 docs/ServiceusagemetricsData.md create mode 100644 docs/Serviceusagetype.md create mode 100644 docs/Serviceusagetypes.md create mode 100644 docs/TlsCertificateBlobResponse.md create mode 100644 docs/UpdateDashboardRequest.md create mode 100644 lib/fastly/api/billing_usage_metrics_api.rb create mode 100644 lib/fastly/api/observability_custom_dashboards_api.rb create mode 100644 lib/fastly/models/async_response.rb create mode 100644 lib/fastly/models/create_dashboard_request.rb create mode 100644 lib/fastly/models/dashboard.rb create mode 100644 lib/fastly/models/dashboard_item.rb create mode 100644 lib/fastly/models/dashboard_item_property_data_source.rb create mode 100644 lib/fastly/models/dashboard_item_property_data_source_property_config.rb create mode 100644 lib/fastly/models/dashboard_item_property_visualization.rb create mode 100644 lib/fastly/models/dashboard_item_property_visualization_property_config.rb create mode 100644 lib/fastly/models/dashboard_property_created_by.rb create mode 100644 lib/fastly/models/dashboard_property_updated_by.rb rename lib/fastly/models/{invoice_response.rb => eom_invoice_response.rb} (97%) create mode 100644 lib/fastly/models/get_service_level_usage_response.rb create mode 100644 lib/fastly/models/get_service_level_usage_types_response.rb create mode 100644 lib/fastly/models/included_with_tls_configuration.rb create mode 100644 lib/fastly/models/included_with_tls_configuration_item.rb create mode 100644 lib/fastly/models/list_dashboards_response.rb rename lib/fastly/models/{list_invoices_response.rb => list_eom_invoices_response.rb} (96%) create mode 100644 lib/fastly/models/mtd_invoice_response.rb create mode 100644 lib/fastly/models/mtdinvoice.rb create mode 100644 lib/fastly/models/mtdlineitems.rb create mode 100644 lib/fastly/models/relationship_default_ecdsa_tls_certificate.rb create mode 100644 lib/fastly/models/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate.rb create mode 100644 lib/fastly/models/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate_data.rb create mode 100644 lib/fastly/models/relationship_default_tls_certificate.rb create mode 100644 lib/fastly/models/relationship_default_tls_certificate_default_certificate.rb create mode 100644 lib/fastly/models/relationship_default_tls_certificate_default_certificate_data.rb rename lib/fastly/models/{relationship_tls_dns_records.rb => relationship_tls_dns_records_request.rb} (95%) create mode 100644 lib/fastly/models/relationship_tls_dns_records_request_dns_records.rb rename lib/fastly/models/{relationship_member_tls_dns_record.rb => relationship_tls_dns_records_request_dns_records_data.rb} (95%) create mode 100644 lib/fastly/models/relationship_tls_dns_records_response.rb create mode 100644 lib/fastly/models/relationship_tls_dns_records_response_dns_records.rb create mode 100644 lib/fastly/models/relationship_tls_dns_records_response_dns_records_data.rb create mode 100644 lib/fastly/models/serviceusagemetric.rb rename lib/fastly/models/{relationship_tls_dns_record.rb => serviceusagemetrics.rb} (92%) create mode 100644 lib/fastly/models/serviceusagemetrics_data.rb create mode 100644 lib/fastly/models/serviceusagetype.rb rename lib/fastly/models/{relationship_tls_dns_record_dns_record.rb => serviceusagetypes.rb} (95%) create mode 100644 lib/fastly/models/tls_certificate_blob_response.rb create mode 100644 lib/fastly/models/update_dashboard_request.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index f620db8a..042a1ce1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## [v8.6.0](https://github.com/fastly/fastly-ruby/releases/tag/release/v8.6.0) (2024-08-04) + +**Enhancements:** + +- feat(observability): Adds new Observability Custom Dashboards API +- feat(billing-invoices): Adds month-to-date invoice information +- feat(billing-usage-metrics): Adds information on service-level usage. +- feat(tls): Adds an endpoint to get a TLS certificate blob (Limited Availability) +- feat(stats): Add `origin_offload` metric + ## [v8.5.0](https://github.com/fastly/fastly-ruby/releases/tag/release/v8.5.0) (2024-07-01) **Bug fixes:** diff --git a/README.md b/README.md index e1728522..efbf2b84 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.5.0' +gem 'fastly', '~> 8.6.0' ``` Then run `bundle install`. @@ -102,7 +102,10 @@ Class | Method | Description [*Fastly::BillingAddressApi*](docs/BillingAddressApi.md) | [**get_billing_addr**](docs/BillingAddressApi.md#get_billing_addr) | Get a billing address [*Fastly::BillingAddressApi*](docs/BillingAddressApi.md) | [**update_billing_addr**](docs/BillingAddressApi.md#update_billing_addr) | Update a billing address [*Fastly::BillingInvoicesApi*](docs/BillingInvoicesApi.md) | [**get_invoice_by_invoice_id**](docs/BillingInvoicesApi.md#get_invoice_by_invoice_id) | Get invoice by ID. +[*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::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 @@ -414,6 +417,11 @@ 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::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 +[*Fastly::ObservabilityCustomDashboardsApi*](docs/ObservabilityCustomDashboardsApi.md) | [**list_dashboards**](docs/ObservabilityCustomDashboardsApi.md#list_dashboards) | List all custom dashboards +[*Fastly::ObservabilityCustomDashboardsApi*](docs/ObservabilityCustomDashboardsApi.md) | [**update_dashboard**](docs/ObservabilityCustomDashboardsApi.md#update_dashboard) | Update an existing dashboard [*Fastly::OriginInspectorHistoricalApi*](docs/OriginInspectorHistoricalApi.md) | [**get_origin_inspector_historical**](docs/OriginInspectorHistoricalApi.md#get_origin_inspector_historical) | Get historical origin data for a service [*Fastly::OriginInspectorRealtimeApi*](docs/OriginInspectorRealtimeApi.md) | [**get_origin_inspector_last120_seconds**](docs/OriginInspectorRealtimeApi.md#get_origin_inspector_last120_seconds) | Get real-time origin data for the last 120 seconds [*Fastly::OriginInspectorRealtimeApi*](docs/OriginInspectorRealtimeApi.md) | [**get_origin_inspector_last_max_entries**](docs/OriginInspectorRealtimeApi.md#get_origin_inspector_last_max_entries) | Get a limited number of real-time origin data entries @@ -515,6 +523,7 @@ Class | Method | Description [*Fastly::TlsCertificatesApi*](docs/TlsCertificatesApi.md) | [**create_tls_cert**](docs/TlsCertificatesApi.md#create_tls_cert) | Create a TLS certificate [*Fastly::TlsCertificatesApi*](docs/TlsCertificatesApi.md) | [**delete_tls_cert**](docs/TlsCertificatesApi.md#delete_tls_cert) | Delete a TLS certificate [*Fastly::TlsCertificatesApi*](docs/TlsCertificatesApi.md) | [**get_tls_cert**](docs/TlsCertificatesApi.md#get_tls_cert) | Get a TLS certificate +[*Fastly::TlsCertificatesApi*](docs/TlsCertificatesApi.md) | [**get_tls_cert_blob**](docs/TlsCertificatesApi.md#get_tls_cert_blob) | Get a TLS certificate blob (Limited Availability) [*Fastly::TlsCertificatesApi*](docs/TlsCertificatesApi.md) | [**list_tls_certs**](docs/TlsCertificatesApi.md#list_tls_certs) | List TLS certificates [*Fastly::TlsCertificatesApi*](docs/TlsCertificatesApi.md) | [**update_tls_cert**](docs/TlsCertificatesApi.md#update_tls_cert) | Update a TLS certificate [*Fastly::TlsConfigurationsApi*](docs/TlsConfigurationsApi.md) | [**get_tls_config**](docs/TlsConfigurationsApi.md#get_tls_config) | Get a TLS configuration @@ -612,6 +621,8 @@ The fastly-ruby API client currently does not support the following endpoints: - [`/alerts/definitions/{definition_id}`](https://www.fastly.com/documentation/reference/api/observability/alerts/definitions) (DELETE, GET, PUT) - [`/alerts/definitions`](https://www.fastly.com/documentation/reference/api/observability/alerts/definitions) (GET, POST) - [`/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) - [`/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) @@ -621,7 +632,9 @@ The fastly-ruby API client currently does not support the following endpoints: - [`/resources/stores/kv/{store_id}/batch`](https://www.fastly.com/documentation/reference/api/services/resources/kv-store-item) (PUT) - [`/tls/activations/{tls_activation_id}`](https://www.fastly.com/documentation/reference/api/tls/mutual-tls/activations) (GET, PATCH) - [`/tls/activations`](https://www.fastly.com/documentation/reference/api/tls/mutual-tls/activations) (GET) -- [`/tls/preview/domains/{tls_preview_domain_id}`](https://www.fastly.com/documentation/reference/api/) (GET, PATCH) +- [`/tls/configurations/{tls_configuration_id}`](https://www.fastly.com/documentation/reference/api/) (DELETE, GET, PATCH) +- [`/tls/configurations`](https://www.fastly.com/documentation/reference/api/) (GET, POST) +- [`/tls/preview/domains/{domain_id}`](https://www.fastly.com/documentation/reference/api/) (GET, PATCH) - [`/tls/preview/domains`](https://www.fastly.com/documentation/reference/api/) (GET, POST) - [`/v1/channel/{service_id}/ts/h/limit/{max_entries}`](https://www.fastly.com/documentation/reference/api/metrics-stats/origin-insights) (GET) - [`/v1/channel/{service_id}/ts/h`](https://www.fastly.com/documentation/reference/api/metrics-stats/origin-insights) (GET) diff --git a/docs/RelationshipTlsDnsRecord.md b/docs/AsyncResponse.md similarity index 54% rename from docs/RelationshipTlsDnsRecord.md rename to docs/AsyncResponse.md index 8b0ff6e5..d7fa3b6d 100644 --- a/docs/RelationshipTlsDnsRecord.md +++ b/docs/AsyncResponse.md @@ -1,10 +1,11 @@ -# Fastly::RelationshipTlsDnsRecord +# Fastly::AsyncResponse ## Properties | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **dns_record** | [**RelationshipTlsDnsRecordDnsRecord**](RelationshipTlsDnsRecordDnsRecord.md) | | [optional] | +| **title** | **String** | | [optional] | +| **status** | **String** | | [optional] | [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/BillingInvoicesApi.md b/docs/BillingInvoicesApi.md index 33a3e5bb..442e17a2 100644 --- a/docs/BillingInvoicesApi.md +++ b/docs/BillingInvoicesApi.md @@ -14,13 +14,14 @@ api_instance = Fastly::BillingInvoicesApi.new Method | HTTP request | Description ------ | ------------ | ----------- [**get_invoice_by_invoice_id**](BillingInvoicesApi.md#get_invoice_by_invoice_id) | **GET** /billing/v3/invoices/{invoice_id} | Get invoice by ID. +[**get_month_to_date_invoice**](BillingInvoicesApi.md#get_month_to_date_invoice) | **GET** /billing/v3/invoices/month-to-date | Get month-to-date invoice. [**list_invoices**](BillingInvoicesApi.md#list_invoices) | **GET** /billing/v3/invoices | List of invoices. ## `get_invoice_by_invoice_id()` ```ruby -get_invoice_by_invoice_id(opts): # Get invoice by ID. +get_invoice_by_invoice_id(opts): # Get invoice by ID. ``` Returns invoice associated with the invoice id. @@ -50,14 +51,46 @@ end ### Return type -[**InvoiceResponse**](InvoiceResponse.md) +[**EomInvoiceResponse**](EomInvoiceResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) +## `get_month_to_date_invoice()` + +```ruby +get_month_to_date_invoice: # Get month-to-date invoice. +``` + +Returns month-to-date invoice for the current month. + +### Examples + +```ruby +api_instance = Fastly::BillingInvoicesApi.new + +begin + # Get month-to-date invoice. + result = api_instance.get_month_to_date_invoice + p result +rescue Fastly::ApiError => e + puts "Error when calling BillingInvoicesApi->get_month_to_date_invoice: #{e}" +end +``` + +### Options + +This endpoint does not need any parameter. + +### Return type + +[**MtdInvoiceResponse**](MtdInvoiceResponse.md) [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) ## `list_invoices()` ```ruby -list_invoices(opts): # List of invoices. +list_invoices(opts): # List of invoices. ``` Returns the list of invoices, sorted by billing start date (newest to oldest). @@ -93,7 +126,7 @@ end ### Return type -[**ListInvoicesResponse**](ListInvoicesResponse.md) +[**ListEomInvoicesResponse**](ListEomInvoicesResponse.md) [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/BillingUsageMetricsApi.md b/docs/BillingUsageMetricsApi.md new file mode 100644 index 00000000..f14d5f7e --- /dev/null +++ b/docs/BillingUsageMetricsApi.md @@ -0,0 +1,111 @@ +# Fastly::BillingUsageMetricsApi + + +```ruby +require 'fastly' +api_instance = Fastly::BillingUsageMetricsApi.new +``` + +## Methods + +> [!NOTE] +> All URIs are relative to `https://api.fastly.com` + +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()` + +```ruby +get_service_level_usage(opts): # Retrieve service-level usage metrics for a product. +``` + +Returns product usage, broken down by service. + +### Examples + +```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. + cursor: 'cursor_example', # String | Cursor value from the `next_cursor` field of a previous response, used to retrieve the next page. To request the first page, this should be empty. +} + +begin + # Retrieve service-level usage metrics for a product. + result = api_instance.get_service_level_usage(opts) + p result +rescue Fastly::ApiError => e + puts "Error when calling BillingUsageMetricsApi->get_service_level_usage: #{e}" +end +``` + +### Options + +| 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'] | +| **cursor** | **String** | Cursor value from the `next_cursor` field of a previous response, used to retrieve the next page. To request the first page, this should be empty. | [optional] | + +### Return type + +[**Serviceusagemetrics**](Serviceusagemetrics.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) +## `get_service_level_usage_types()` + +```ruby +get_service_level_usage_types(opts): # Retrieve product usage types for a customer. +``` + +Returns product usage types reported by the customer's services. + +### Examples + +```ruby +api_instance = Fastly::BillingUsageMetricsApi.new +opts = { + customer_id: 'customer_id_example', # String | Alphanumeric string identifying the customer. +} + +begin + # Retrieve product usage types for a customer. + result = api_instance.get_service_level_usage_types(opts) + p result +rescue Fastly::ApiError => e + puts "Error when calling BillingUsageMetricsApi->get_service_level_usage_types: #{e}" +end +``` + +### Options + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **customer_id** | **String** | Alphanumeric string identifying the customer. | | + +### Return type + +[**Serviceusagetypes**](Serviceusagetypes.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) diff --git a/docs/CreateDashboardRequest.md b/docs/CreateDashboardRequest.md new file mode 100644 index 00000000..daf1b337 --- /dev/null +++ b/docs/CreateDashboardRequest.md @@ -0,0 +1,12 @@ +# Fastly::CreateDashboardRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | A human-readable name | | +| **description** | **String** | A short description of the dashboard | [optional] | +| **items** | [**Array<DashboardItem>**](DashboardItem.md) | A list of [dashboard items](#dashboard-item). | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/Dashboard.md b/docs/Dashboard.md new file mode 100644 index 00000000..6ff12ec8 --- /dev/null +++ b/docs/Dashboard.md @@ -0,0 +1,17 @@ +# Fastly::Dashboard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Dashboard identifier (UUID) | [optional][readonly] | +| **name** | **String** | A human-readable name | [optional] | +| **description** | **String** | A short description of the dashboard | [optional] | +| **items** | [**Array<DashboardItem>**](DashboardItem.md) | A list of [dashboard items](#dashboard-item). | [optional] | +| **created_at** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] | +| **updated_at** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] | +| **created_by** | [**DashboardPropertyCreatedBy**](DashboardPropertyCreatedBy.md) | | [optional] | +| **updated_by** | [**DashboardPropertyUpdatedBy**](DashboardPropertyUpdatedBy.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/DashboardItem.md b/docs/DashboardItem.md new file mode 100644 index 00000000..4af693d4 --- /dev/null +++ b/docs/DashboardItem.md @@ -0,0 +1,15 @@ +# Fastly::DashboardItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **title** | **String** | A human-readable title for the dashboard item | | +| **subtitle** | **String** | A human-readable subtitle for the dashboard item. Often a description of the visualization. | | +| **data_source** | [**DashboardItemPropertyDataSource**](DashboardItemPropertyDataSource.md) | | | +| **visualization** | [**DashboardItemPropertyVisualization**](DashboardItemPropertyVisualization.md) | | | +| **id** | **String** | Dashboard item identifier (UUID) | [optional][readonly] | +| **span** | **Integer** | The number of columns for the dashboard item to span. Dashboards are rendered on a 12-column grid on \"desktop\" screen sizes. | [optional][default to 4] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/DashboardItemPropertyDataSource.md b/docs/DashboardItemPropertyDataSource.md new file mode 100644 index 00000000..063a49a2 --- /dev/null +++ b/docs/DashboardItemPropertyDataSource.md @@ -0,0 +1,11 @@ +# Fastly::DashboardItemPropertyDataSource + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | The source of the data to display. | | +| **config** | [**DashboardItemPropertyDataSourcePropertyConfig**](DashboardItemPropertyDataSourcePropertyConfig.md) | | | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/DashboardItemPropertyDataSourcePropertyConfig.md b/docs/DashboardItemPropertyDataSourcePropertyConfig.md new file mode 100644 index 00000000..2740b6f4 --- /dev/null +++ b/docs/DashboardItemPropertyDataSourcePropertyConfig.md @@ -0,0 +1,10 @@ +# Fastly::DashboardItemPropertyDataSourcePropertyConfig + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **metrics** | **Array<String>** | The metrics to visualize. Valid options are defined by the selected [data source](#field_data_source). | | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/DashboardItemPropertyVisualization.md b/docs/DashboardItemPropertyVisualization.md new file mode 100644 index 00000000..b36c4f47 --- /dev/null +++ b/docs/DashboardItemPropertyVisualization.md @@ -0,0 +1,11 @@ +# Fastly::DashboardItemPropertyVisualization + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | The type of visualization to display. | | +| **config** | [**DashboardItemPropertyVisualizationPropertyConfig**](DashboardItemPropertyVisualizationPropertyConfig.md) | | | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/DashboardItemPropertyVisualizationPropertyConfig.md b/docs/DashboardItemPropertyVisualizationPropertyConfig.md new file mode 100644 index 00000000..4d0f7650 --- /dev/null +++ b/docs/DashboardItemPropertyVisualizationPropertyConfig.md @@ -0,0 +1,12 @@ +# Fastly::DashboardItemPropertyVisualizationPropertyConfig + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **plot_type** | **String** | The type of chart to display. | | +| **format** | **String** | (Optional) The units to use to format the data. | [optional][default to 'number'] | +| **calculation_method** | **String** | (Optional) The aggregation function to apply to the dataset. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/RelationshipTlsDnsRecords.md b/docs/DashboardPropertyCreatedBy.md similarity index 53% rename from docs/RelationshipTlsDnsRecords.md rename to docs/DashboardPropertyCreatedBy.md index d63b1b6b..0cdc4980 100644 --- a/docs/RelationshipTlsDnsRecords.md +++ b/docs/DashboardPropertyCreatedBy.md @@ -1,10 +1,9 @@ -# Fastly::RelationshipTlsDnsRecords +# Fastly::DashboardPropertyCreatedBy ## Properties | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **dns_records** | [**RelationshipTlsDnsRecordDnsRecord**](RelationshipTlsDnsRecordDnsRecord.md) | | [optional] | [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/RelationshipTlsDnsRecordDnsRecord.md b/docs/DashboardPropertyUpdatedBy.md similarity index 52% rename from docs/RelationshipTlsDnsRecordDnsRecord.md rename to docs/DashboardPropertyUpdatedBy.md index 95c84fdb..becb1555 100644 --- a/docs/RelationshipTlsDnsRecordDnsRecord.md +++ b/docs/DashboardPropertyUpdatedBy.md @@ -1,10 +1,9 @@ -# Fastly::RelationshipTlsDnsRecordDnsRecord +# Fastly::DashboardPropertyUpdatedBy ## Properties | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **data** | [**Array<RelationshipMemberTlsDnsRecord>**](RelationshipMemberTlsDnsRecord.md) | | [optional] | [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/DomainInspectorMeasurements.md b/docs/DomainInspectorMeasurements.md index e51ef626..20287442 100644 --- a/docs/DomainInspectorMeasurements.md +++ b/docs/DomainInspectorMeasurements.md @@ -42,7 +42,7 @@ | **origin_fetch_resp_body_bytes** | **Integer** | Total body bytes received from origin. | [optional] | | **bandwidth** | **Integer** | Total bytes delivered (`resp_header_bytes` + `resp_body_bytes` + `bereq_header_bytes` + `bereq_body_bytes`). | [optional] | | **edge_hit_ratio** | **Float** | Ratio of cache hits to cache misses at the edge, between 0 and 1 (`edge_hit_requests` / (`edge_hit_requests` + `edge_miss_requests`)). | [optional] | -| **origin_offload** | **Float** | Ratio of response bytes delivered from the edge compared to what is delivered from origin, 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] | +| **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`). Previously, Origin Offload used a different formula. [Learn more](https://www.fastly.com/documentation/reference/changes/2024/06/add-origin_offload-metric). | [optional] | | **origin_status_200** | **Integer** | Number of responses received from origin with status code 200 (Success). | [optional] | | **origin_status_204** | **Integer** | Number of responses received from origin with status code 204 (No Content). | [optional] | | **origin_status_206** | **Integer** | Number of responses received from origin with status code 206 (Partial Content). | [optional] | diff --git a/docs/InvoiceResponse.md b/docs/EomInvoiceResponse.md similarity index 97% rename from docs/InvoiceResponse.md rename to docs/EomInvoiceResponse.md index b5da6206..5fd191e5 100644 --- a/docs/InvoiceResponse.md +++ b/docs/EomInvoiceResponse.md @@ -1,4 +1,4 @@ -# Fastly::InvoiceResponse +# Fastly::EomInvoiceResponse ## Properties diff --git a/docs/GetServiceLevelUsageResponse.md b/docs/GetServiceLevelUsageResponse.md new file mode 100644 index 00000000..1942a25b --- /dev/null +++ b/docs/GetServiceLevelUsageResponse.md @@ -0,0 +1,10 @@ +# Fastly::GetServiceLevelUsageResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**ServiceusagemetricsData**](ServiceusagemetricsData.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/GetServiceLevelUsageTypesResponse.md b/docs/GetServiceLevelUsageTypesResponse.md new file mode 100644 index 00000000..7d07e1f5 --- /dev/null +++ b/docs/GetServiceLevelUsageTypesResponse.md @@ -0,0 +1,10 @@ +# Fastly::GetServiceLevelUsageTypesResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<Serviceusagetype>**](Serviceusagetype.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/IncludedWithTlsConfiguration.md b/docs/IncludedWithTlsConfiguration.md new file mode 100644 index 00000000..b1ed89e4 --- /dev/null +++ b/docs/IncludedWithTlsConfiguration.md @@ -0,0 +1,10 @@ +# Fastly::IncludedWithTlsConfiguration + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **included** | [**Array<IncludedWithTlsConfigurationItem>**](IncludedWithTlsConfigurationItem.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/IncludedWithTlsConfigurationItem.md b/docs/IncludedWithTlsConfigurationItem.md new file mode 100644 index 00000000..04f93d3a --- /dev/null +++ b/docs/IncludedWithTlsConfigurationItem.md @@ -0,0 +1,12 @@ +# Fastly::IncludedWithTlsConfigurationItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | The IP address or hostname of the DNS record. | [optional] | +| **type** | [**TypeTlsDnsRecord**](TypeTlsDnsRecord.md) | | [optional][default to 'dns_record'] | +| **attributes** | [**TlsDnsRecord**](TlsDnsRecord.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/ListDashboardsResponse.md b/docs/ListDashboardsResponse.md new file mode 100644 index 00000000..9d8ba7d6 --- /dev/null +++ b/docs/ListDashboardsResponse.md @@ -0,0 +1,11 @@ +# Fastly::ListDashboardsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<Dashboard>**](Dashboard.md) | | [optional] | +| **meta** | **Object** | Meta for the pagination. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/ListInvoicesResponse.md b/docs/ListEomInvoicesResponse.md similarity index 90% rename from docs/ListInvoicesResponse.md rename to docs/ListEomInvoicesResponse.md index ca6fe963..aa505317 100644 --- a/docs/ListInvoicesResponse.md +++ b/docs/ListEomInvoicesResponse.md @@ -1,4 +1,4 @@ -# Fastly::ListInvoicesResponse +# Fastly::ListEomInvoicesResponse ## Properties diff --git a/docs/MtdInvoiceResponse.md b/docs/MtdInvoiceResponse.md new file mode 100644 index 00000000..184a5b3f --- /dev/null +++ b/docs/MtdInvoiceResponse.md @@ -0,0 +1,15 @@ +# Fastly::MtdInvoiceResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **customer_id** | **String** | The Customer ID associated with the invoice. | [optional] | +| **invoice_id** | **String** | An alphanumeric string identifying the invoice. | [optional] | +| **billing_start_date** | **Time** | The date and time (in ISO 8601 format) for the initiation point of a billing cycle, signifying the start of charges for a service or subscription. | [optional] | +| **billing_end_date** | **Time** | The date and time (in ISO 8601 format) for the termination point of a billing cycle, signifying the end of charges for a service or subscription. | [optional] | +| **monthly_transaction_amount** | **String** | The total billable amount for invoiced services charged within a single month. | [optional] | +| **transaction_line_items** | [**Array<Mtdlineitems>**](Mtdlineitems.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/Mtdinvoice.md b/docs/Mtdinvoice.md new file mode 100644 index 00000000..54372036 --- /dev/null +++ b/docs/Mtdinvoice.md @@ -0,0 +1,15 @@ +# Fastly::Mtdinvoice + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **customer_id** | **String** | The Customer ID associated with the invoice. | [optional] | +| **invoice_id** | **String** | An alphanumeric string identifying the invoice. | [optional] | +| **billing_start_date** | **Time** | The date and time (in ISO 8601 format) for the initiation point of a billing cycle, signifying the start of charges for a service or subscription. | [optional] | +| **billing_end_date** | **Time** | The date and time (in ISO 8601 format) for the termination point of a billing cycle, signifying the end of charges for a service or subscription. | [optional] | +| **monthly_transaction_amount** | **String** | The total billable amount for invoiced services charged within a single month. | [optional] | +| **transaction_line_items** | [**Array<Mtdlineitems>**](Mtdlineitems.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/Mtdlineitems.md b/docs/Mtdlineitems.md new file mode 100644 index 00000000..76675fdc --- /dev/null +++ b/docs/Mtdlineitems.md @@ -0,0 +1,18 @@ +# Fastly::Mtdlineitems + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **description** | **String** | Invoice line item transaction name. | [optional] | +| **amount** | **Float** | Billed amount for line item. | [optional] | +| **rate** | **Float** | Price per unit. | [optional] | +| **units** | **Float** | Total number of units of usage. | [optional] | +| **product_name** | **String** | The name of the product. | [optional] | +| **product_group** | **String** | The broader classification of the product (e.g., `Compute` or `Full-Site Delivery`). | [optional] | +| **product_line** | **String** | The broader classification of the product (e.g., `Network Services` or `Security`). | [optional] | +| **region** | **String** | The geographical area applicable for regionally based products. | [optional] | +| **usage_type** | **String** | The unit of measure (e.g., `requests` or `bandwidth`). | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/ObservabilityCustomDashboardsApi.md b/docs/ObservabilityCustomDashboardsApi.md new file mode 100644 index 00000000..391fc8ab --- /dev/null +++ b/docs/ObservabilityCustomDashboardsApi.md @@ -0,0 +1,203 @@ +# Fastly::ObservabilityCustomDashboardsApi + + +```ruby +require 'fastly' +api_instance = Fastly::ObservabilityCustomDashboardsApi.new +``` + +## Methods + +> [!NOTE] +> All URIs are relative to `https://api.fastly.com` + +Method | HTTP request | Description +------ | ------------ | ----------- +[**create_dashboard**](ObservabilityCustomDashboardsApi.md#create_dashboard) | **POST** /observability/dashboards | Create a new dashboard +[**delete_dashboard**](ObservabilityCustomDashboardsApi.md#delete_dashboard) | **DELETE** /observability/dashboards/{dashboard_id} | Delete an existing dashboard +[**get_dashboard**](ObservabilityCustomDashboardsApi.md#get_dashboard) | **GET** /observability/dashboards/{dashboard_id} | Retrieve a dashboard by ID +[**list_dashboards**](ObservabilityCustomDashboardsApi.md#list_dashboards) | **GET** /observability/dashboards | List all custom dashboards +[**update_dashboard**](ObservabilityCustomDashboardsApi.md#update_dashboard) | **PATCH** /observability/dashboards/{dashboard_id} | Update an existing dashboard + + +## `create_dashboard()` + +```ruby +create_dashboard(opts): # Create a new dashboard +``` + +Create a new dashboard + +### Examples + +```ruby +api_instance = Fastly::ObservabilityCustomDashboardsApi.new +opts = { + create_dashboard_request: Fastly::CreateDashboardRequest.new({name: 'name_example'}), # CreateDashboardRequest | +} + +begin + # Create a new dashboard + result = api_instance.create_dashboard(opts) + p result +rescue Fastly::ApiError => e + puts "Error when calling ObservabilityCustomDashboardsApi->create_dashboard: #{e}" +end +``` + +### Options + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **create_dashboard_request** | [**CreateDashboardRequest**](CreateDashboardRequest.md) | | [optional] | + +### Return type + +[**Dashboard**](Dashboard.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) +## `delete_dashboard()` + +```ruby +delete_dashboard(opts) # Delete an existing dashboard +``` + +Delete an existing dashboard + +### Examples + +```ruby +api_instance = Fastly::ObservabilityCustomDashboardsApi.new +opts = { + dashboard_id: '2eGFXF4F4kTxd4gU39Bg3e', # String | +} + +begin + # Delete an existing dashboard + api_instance.delete_dashboard(opts) +rescue Fastly::ApiError => e + puts "Error when calling ObservabilityCustomDashboardsApi->delete_dashboard: #{e}" +end +``` + +### Options + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **dashboard_id** | **String** | | | + +### Return type + +nil (empty response body) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) +## `get_dashboard()` + +```ruby +get_dashboard(opts): # Retrieve a dashboard by ID +``` + +Retrieve a dashboard by ID + +### Examples + +```ruby +api_instance = Fastly::ObservabilityCustomDashboardsApi.new +opts = { + dashboard_id: '2eGFXF4F4kTxd4gU39Bg3e', # String | +} + +begin + # Retrieve a dashboard by ID + result = api_instance.get_dashboard(opts) + p result +rescue Fastly::ApiError => e + puts "Error when calling ObservabilityCustomDashboardsApi->get_dashboard: #{e}" +end +``` + +### Options + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **dashboard_id** | **String** | | | + +### Return type + +[**Dashboard**](Dashboard.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) +## `list_dashboards()` + +```ruby +list_dashboards: # List all custom dashboards +``` + +List all custom dashboards + +### Examples + +```ruby +api_instance = Fastly::ObservabilityCustomDashboardsApi.new + +begin + # List all custom dashboards + result = api_instance.list_dashboards + p result +rescue Fastly::ApiError => e + puts "Error when calling ObservabilityCustomDashboardsApi->list_dashboards: #{e}" +end +``` + +### Options + +This endpoint does not need any parameter. + +### Return type + +[**ListDashboardsResponse**](ListDashboardsResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) +## `update_dashboard()` + +```ruby +update_dashboard(opts): # Update an existing dashboard +``` + +Update an existing dashboard + +### Examples + +```ruby +api_instance = Fastly::ObservabilityCustomDashboardsApi.new +opts = { + dashboard_id: '2eGFXF4F4kTxd4gU39Bg3e', # String | + update_dashboard_request: Fastly::UpdateDashboardRequest.new, # UpdateDashboardRequest | +} + +begin + # Update an existing dashboard + result = api_instance.update_dashboard(opts) + p result +rescue Fastly::ApiError => e + puts "Error when calling ObservabilityCustomDashboardsApi->update_dashboard: #{e}" +end +``` + +### Options + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **dashboard_id** | **String** | | | +| **update_dashboard_request** | [**UpdateDashboardRequest**](UpdateDashboardRequest.md) | | [optional] | + +### Return type + +[**Dashboard**](Dashboard.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 57530756..7eae5506 100644 --- a/docs/RealtimeEntryAggregated.md +++ b/docs/RealtimeEntryAggregated.md @@ -252,6 +252,7 @@ | **all_status_3xx** | **Integer** | Number of \"Redirection\" codes delivered for all sources. | [optional] | | **all_status_4xx** | **Integer** | Number of \"Client Error\" codes delivered for all sources. | [optional] | | **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] | [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/RealtimeMeasurements.md b/docs/RealtimeMeasurements.md index f503ac42..0f962fad 100644 --- a/docs/RealtimeMeasurements.md +++ b/docs/RealtimeMeasurements.md @@ -252,6 +252,7 @@ | **all_status_3xx** | **Integer** | Number of \"Redirection\" codes delivered for all sources. | [optional] | | **all_status_4xx** | **Integer** | Number of \"Client Error\" codes delivered for all sources. | [optional] | | **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] | [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/RelationshipDefaultEcdsaTlsCertificate.md b/docs/RelationshipDefaultEcdsaTlsCertificate.md new file mode 100644 index 00000000..80f03eab --- /dev/null +++ b/docs/RelationshipDefaultEcdsaTlsCertificate.md @@ -0,0 +1,10 @@ +# Fastly::RelationshipDefaultEcdsaTlsCertificate + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **default_ecdsa_certificate** | [**RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificate**](RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificate.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificate.md b/docs/RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificate.md new file mode 100644 index 00000000..a332b034 --- /dev/null +++ b/docs/RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificate.md @@ -0,0 +1,10 @@ +# Fastly::RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificate + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificateData**](RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificateData.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificateData.md b/docs/RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificateData.md new file mode 100644 index 00000000..81554819 --- /dev/null +++ b/docs/RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificateData.md @@ -0,0 +1,11 @@ +# Fastly::RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificateData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | [**TypeTlsCertificate**](TypeTlsCertificate.md) | | [optional][default to 'tls_certificate'] | +| **id** | **String** | Alphanumeric string identifying the default ECDSA TLS certificate. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/RelationshipDefaultTlsCertificate.md b/docs/RelationshipDefaultTlsCertificate.md new file mode 100644 index 00000000..90cdd5a2 --- /dev/null +++ b/docs/RelationshipDefaultTlsCertificate.md @@ -0,0 +1,10 @@ +# Fastly::RelationshipDefaultTlsCertificate + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **default_certificate** | [**RelationshipDefaultTlsCertificateDefaultCertificate**](RelationshipDefaultTlsCertificateDefaultCertificate.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/RelationshipDefaultTlsCertificateDefaultCertificate.md b/docs/RelationshipDefaultTlsCertificateDefaultCertificate.md new file mode 100644 index 00000000..ddddb284 --- /dev/null +++ b/docs/RelationshipDefaultTlsCertificateDefaultCertificate.md @@ -0,0 +1,10 @@ +# Fastly::RelationshipDefaultTlsCertificateDefaultCertificate + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**RelationshipDefaultTlsCertificateDefaultCertificateData**](RelationshipDefaultTlsCertificateDefaultCertificateData.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/RelationshipDefaultTlsCertificateDefaultCertificateData.md b/docs/RelationshipDefaultTlsCertificateDefaultCertificateData.md new file mode 100644 index 00000000..e1a4920b --- /dev/null +++ b/docs/RelationshipDefaultTlsCertificateDefaultCertificateData.md @@ -0,0 +1,11 @@ +# Fastly::RelationshipDefaultTlsCertificateDefaultCertificateData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | [**TypeTlsCertificate**](TypeTlsCertificate.md) | | [optional][default to 'tls_certificate'] | +| **id** | **String** | Alphanumeric string identifying the default TLS certificate. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/RelationshipTlsDnsRecordsRequest.md b/docs/RelationshipTlsDnsRecordsRequest.md new file mode 100644 index 00000000..e13b6f61 --- /dev/null +++ b/docs/RelationshipTlsDnsRecordsRequest.md @@ -0,0 +1,10 @@ +# Fastly::RelationshipTlsDnsRecordsRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **dns_records** | [**RelationshipTlsDnsRecordsRequestDnsRecords**](RelationshipTlsDnsRecordsRequestDnsRecords.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/RelationshipTlsDnsRecordsRequestDnsRecords.md b/docs/RelationshipTlsDnsRecordsRequestDnsRecords.md new file mode 100644 index 00000000..863bd90c --- /dev/null +++ b/docs/RelationshipTlsDnsRecordsRequestDnsRecords.md @@ -0,0 +1,10 @@ +# Fastly::RelationshipTlsDnsRecordsRequestDnsRecords + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<RelationshipTlsDnsRecordsRequestDnsRecordsData>**](RelationshipTlsDnsRecordsRequestDnsRecordsData.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/RelationshipTlsDnsRecordsRequestDnsRecordsData.md b/docs/RelationshipTlsDnsRecordsRequestDnsRecordsData.md new file mode 100644 index 00000000..cfd0b466 --- /dev/null +++ b/docs/RelationshipTlsDnsRecordsRequestDnsRecordsData.md @@ -0,0 +1,11 @@ +# Fastly::RelationshipTlsDnsRecordsRequestDnsRecordsData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | [**TypeTlsDnsRecord**](TypeTlsDnsRecord.md) | | [optional][default to 'dns_record'] | +| **id** | **String** | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/RelationshipTlsDnsRecordsResponse.md b/docs/RelationshipTlsDnsRecordsResponse.md new file mode 100644 index 00000000..8bc61cfa --- /dev/null +++ b/docs/RelationshipTlsDnsRecordsResponse.md @@ -0,0 +1,10 @@ +# Fastly::RelationshipTlsDnsRecordsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **dns_records** | [**RelationshipTlsDnsRecordsResponseDnsRecords**](RelationshipTlsDnsRecordsResponseDnsRecords.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/RelationshipTlsDnsRecordsResponseDnsRecords.md b/docs/RelationshipTlsDnsRecordsResponseDnsRecords.md new file mode 100644 index 00000000..1f447d1c --- /dev/null +++ b/docs/RelationshipTlsDnsRecordsResponseDnsRecords.md @@ -0,0 +1,10 @@ +# Fastly::RelationshipTlsDnsRecordsResponseDnsRecords + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<RelationshipTlsDnsRecordsResponseDnsRecordsData>**](RelationshipTlsDnsRecordsResponseDnsRecordsData.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/RelationshipMemberTlsDnsRecord.md b/docs/RelationshipTlsDnsRecordsResponseDnsRecordsData.md similarity index 85% rename from docs/RelationshipMemberTlsDnsRecord.md rename to docs/RelationshipTlsDnsRecordsResponseDnsRecordsData.md index a05042f9..49c002f8 100644 --- a/docs/RelationshipMemberTlsDnsRecord.md +++ b/docs/RelationshipTlsDnsRecordsResponseDnsRecordsData.md @@ -1,4 +1,4 @@ -# Fastly::RelationshipMemberTlsDnsRecord +# Fastly::RelationshipTlsDnsRecordsResponseDnsRecordsData ## Properties diff --git a/docs/Results.md b/docs/Results.md index 5824ae6d..40fe6d31 100644 --- a/docs/Results.md +++ b/docs/Results.md @@ -252,6 +252,7 @@ | **all_status_3xx** | **Integer** | Number of \"Redirection\" codes delivered for all sources. | [optional] | | **all_status_4xx** | **Integer** | Number of \"Client Error\" codes delivered for all sources. | [optional] | | **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] | | **service_id** | **String** | | [optional][readonly] | | **start_time** | **Integer** | Timestamp for the start of the time period being reported | [optional] | diff --git a/docs/Serviceusagemetric.md b/docs/Serviceusagemetric.md new file mode 100644 index 00000000..21a282f2 --- /dev/null +++ b/docs/Serviceusagemetric.md @@ -0,0 +1,13 @@ +# Fastly::Serviceusagemetric + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **customer_id** | **String** | | [optional][readonly] | +| **service_id** | **String** | Service ID associated with the usage. | [optional] | +| **service_name** | **String** | Name of the service associated with the usage. | [optional] | +| **usage_units** | **Float** | The quantity of the usage for the billing period. Amount will be in the units provided in the parent object (e.g., a quantity of `1.3` with a unit of `gb` would have a usage amount of 1.3 gigabytes). | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/Serviceusagemetrics.md b/docs/Serviceusagemetrics.md new file mode 100644 index 00000000..e6b2d926 --- /dev/null +++ b/docs/Serviceusagemetrics.md @@ -0,0 +1,10 @@ +# Fastly::Serviceusagemetrics + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**ServiceusagemetricsData**](ServiceusagemetricsData.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/ServiceusagemetricsData.md b/docs/ServiceusagemetricsData.md new file mode 100644 index 00000000..edcc49d9 --- /dev/null +++ b/docs/ServiceusagemetricsData.md @@ -0,0 +1,16 @@ +# Fastly::ServiceusagemetricsData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **customer_id** | **String** | | [optional][readonly] | +| **start_time** | **Time** | Date and time (in ISO 8601 format) for initiation point of a billing cycle, signifying the start of charges for a service or subscription. | [optional] | +| **end_time** | **Time** | Date and time (in ISO 8601 format) for termination point of a billing cycle, signifying the end of charges for a service or subscription. | [optional] | +| **usage_type** | **String** | The usage type identifier for the usage. This is a single, billable metric for the product. | [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] | +| **details** | [**Array<Serviceusagemetric>**](Serviceusagemetric.md) | | [optional] | +| **meta** | [**Metadata**](Metadata.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/Serviceusagetype.md b/docs/Serviceusagetype.md new file mode 100644 index 00000000..f8bdb23c --- /dev/null +++ b/docs/Serviceusagetype.md @@ -0,0 +1,11 @@ +# Fastly::Serviceusagetype + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **product_id** | **String** | The product identifier associated with the usage type. This corresponds to a Fastly product offering. | [optional] | +| **name** | **String** | Full name of the product usage type as it might appear on a customer's invoice. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/Serviceusagetypes.md b/docs/Serviceusagetypes.md new file mode 100644 index 00000000..44ac7906 --- /dev/null +++ b/docs/Serviceusagetypes.md @@ -0,0 +1,10 @@ +# Fastly::Serviceusagetypes + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**Array<Serviceusagetype>**](Serviceusagetype.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/TlsCertificateBlobResponse.md b/docs/TlsCertificateBlobResponse.md new file mode 100644 index 00000000..fc3e131a --- /dev/null +++ b/docs/TlsCertificateBlobResponse.md @@ -0,0 +1,10 @@ +# Fastly::TlsCertificateBlobResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **cert_blob** | **String** | A certificate blob | [optional][readonly] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/TlsCertificatesApi.md b/docs/TlsCertificatesApi.md index 30cd6dfb..8523cacb 100644 --- a/docs/TlsCertificatesApi.md +++ b/docs/TlsCertificatesApi.md @@ -16,6 +16,7 @@ Method | HTTP request | Description [**create_tls_cert**](TlsCertificatesApi.md#create_tls_cert) | **POST** /tls/certificates | Create a TLS certificate [**delete_tls_cert**](TlsCertificatesApi.md#delete_tls_cert) | **DELETE** /tls/certificates/{tls_certificate_id} | Delete a TLS certificate [**get_tls_cert**](TlsCertificatesApi.md#get_tls_cert) | **GET** /tls/certificates/{tls_certificate_id} | Get a TLS certificate +[**get_tls_cert_blob**](TlsCertificatesApi.md#get_tls_cert_blob) | **GET** /tls/certificates/{tls_certificate_id}/blob | Get a TLS certificate blob (Limited Availability) [**list_tls_certs**](TlsCertificatesApi.md#list_tls_certs) | **GET** /tls/certificates | List TLS certificates [**update_tls_cert**](TlsCertificatesApi.md#update_tls_cert) | **PATCH** /tls/certificates/{tls_certificate_id} | Update a TLS certificate @@ -128,6 +129,43 @@ end [**TlsCertificateResponse**](TlsCertificateResponse.md) +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) +## `get_tls_cert_blob()` + +```ruby +get_tls_cert_blob(opts): # Get a TLS certificate blob (Limited Availability) +``` + +Retrieve a TLS certificate blob. This feature is part of a [limited availability](https://docs.fastly.com/products/fastly-product-lifecycle#limited-availability) release. + +### Examples + +```ruby +api_instance = Fastly::TlsCertificatesApi.new +opts = { + tls_certificate_id: 'tls_certificate_id_example', # String | Alphanumeric string identifying a TLS certificate. +} + +begin + # Get a TLS certificate blob (Limited Availability) + result = api_instance.get_tls_cert_blob(opts) + p result +rescue Fastly::ApiError => e + puts "Error when calling TlsCertificatesApi->get_tls_cert_blob: #{e}" +end +``` + +### Options + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **tls_certificate_id** | **String** | Alphanumeric string identifying a TLS certificate. | | + +### Return type + +[**TlsCertificateBlobResponse**](TlsCertificateBlobResponse.md) + [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) ## `list_tls_certs()` diff --git a/docs/TlsDnsRecord.md b/docs/TlsDnsRecord.md index 5b7f7caf..ff7bf761 100644 --- a/docs/TlsDnsRecord.md +++ b/docs/TlsDnsRecord.md @@ -4,8 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **id** | **String** | The IP address or hostname of the DNS record. | [optional] | -| **region** | **String** | Specifies the regions that will be used to route traffic. Select DNS Records with a `global` region to route traffic to the most performant point of presence (POP) worldwide (global pricing will apply). Select DNS records with a `us-eu` region to exclusively land traffic on North American and European POPs. | [optional] | +| **region** | **String** | Specifies the regions that will be used to route traffic. Select DNS records with a `global` region to route traffic to the most performant point of presence (POP) worldwide (global pricing will apply). Select DNS records with a `na/eu` region to exclusively land traffic on North American and European POPs. | [optional] | | **record_type** | **String** | The type of the DNS record. `A` specifies an IPv4 address to be used for an A record to be used for apex domains (e.g., `example.com`). `AAAA` specifies an IPv6 address for use in an A record for apex domains. `CNAME` specifies the hostname to be used for a CNAME record for subdomains or wildcard domains (e.g., `www.example.com` or `*.example.com`). | [optional] | [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/UpdateDashboardRequest.md b/docs/UpdateDashboardRequest.md new file mode 100644 index 00000000..45acbc51 --- /dev/null +++ b/docs/UpdateDashboardRequest.md @@ -0,0 +1,12 @@ +# Fastly::UpdateDashboardRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | A human-readable name | [optional] | +| **description** | **String** | A short description of the dashboard | [optional] | +| **items** | [**Array<DashboardItem>**](DashboardItem.md) | A list of [dashboard items](#dashboard-item). | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/Values.md b/docs/Values.md index 682e00ca..5247df91 100644 --- a/docs/Values.md +++ b/docs/Values.md @@ -42,7 +42,7 @@ | **origin_fetch_resp_body_bytes** | **Integer** | Total body bytes received from origin. | [optional] | | **bandwidth** | **Integer** | Total bytes delivered (`resp_header_bytes` + `resp_body_bytes` + `bereq_header_bytes` + `bereq_body_bytes`). | [optional] | | **edge_hit_ratio** | **Float** | Ratio of cache hits to cache misses at the edge, between 0 and 1 (`edge_hit_requests` / (`edge_hit_requests` + `edge_miss_requests`)). | [optional] | -| **origin_offload** | **Float** | Ratio of response bytes delivered from the edge compared to what is delivered from origin, 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] | +| **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`). Previously, Origin Offload used a different formula. [Learn more](https://www.fastly.com/documentation/reference/changes/2024/06/add-origin_offload-metric). | [optional] | | **origin_status_200** | **Integer** | Number of responses received from origin with status code 200 (Success). | [optional] | | **origin_status_204** | **Integer** | Number of responses received from origin with status code 204 (No Content). | [optional] | | **origin_status_206** | **Integer** | Number of responses received from origin with status code 206 (Partial Content). | [optional] | diff --git a/lib/fastly.rb b/lib/fastly.rb index ce072b91..7e014cac 100644 --- a/lib/fastly.rb +++ b/lib/fastly.rb @@ -23,6 +23,7 @@ require 'fastly/models/acl_response_all_of' require 'fastly/models/apex_redirect' require 'fastly/models/apex_redirect_all_of' +require 'fastly/models/async_response' require 'fastly/models/automation_token' require 'fastly/models/automation_token_create_request' require 'fastly/models/automation_token_create_request_attributes' @@ -79,10 +80,19 @@ require 'fastly/models/contact_response' require 'fastly/models/contact_response_all_of' require 'fastly/models/content' +require 'fastly/models/create_dashboard_request' require 'fastly/models/create_response_object_request' require 'fastly/models/customer' require 'fastly/models/customer_response' require 'fastly/models/customer_response_all_of' +require 'fastly/models/dashboard' +require 'fastly/models/dashboard_item' +require 'fastly/models/dashboard_item_property_data_source' +require 'fastly/models/dashboard_item_property_data_source_property_config' +require 'fastly/models/dashboard_item_property_visualization' +require 'fastly/models/dashboard_item_property_visualization_property_config' +require 'fastly/models/dashboard_property_created_by' +require 'fastly/models/dashboard_property_updated_by' require 'fastly/models/default_settings' require 'fastly/models/default_settings_error' require 'fastly/models/default_settings_response' @@ -109,6 +119,7 @@ require 'fastly/models/enabled_product_response_links' require 'fastly/models/enabled_product_response_product' require 'fastly/models/enabled_product_response_service' +require 'fastly/models/eom_invoice_response' require 'fastly/models/error' require 'fastly/models/error_response_data' require 'fastly/models/event' @@ -117,6 +128,8 @@ require 'fastly/models/event_response' require 'fastly/models/events_response' require 'fastly/models/generic_token_error' +require 'fastly/models/get_service_level_usage_response' +require 'fastly/models/get_service_level_usage_types_response' require 'fastly/models/gzip' require 'fastly/models/gzip_response' require 'fastly/models/header' @@ -162,6 +175,8 @@ require 'fastly/models/iam_service_group_all_of' require 'fastly/models/iam_user_group' require 'fastly/models/iam_user_group_all_of' +require 'fastly/models/included_with_tls_configuration' +require 'fastly/models/included_with_tls_configuration_item' require 'fastly/models/included_with_waf_active_rule_item' require 'fastly/models/included_with_waf_exclusion_item' require 'fastly/models/included_with_waf_firewall_version_item' @@ -189,7 +204,6 @@ require 'fastly/models/invitations_response' require 'fastly/models/invitations_response_all_of' require 'fastly/models/invoice' -require 'fastly/models/invoice_response' require 'fastly/models/invoicelineitems' require 'fastly/models/legacy_waf_configuration_set' require 'fastly/models/legacy_waf_firewall' @@ -201,7 +215,8 @@ require 'fastly/models/legacy_waf_update_status' require 'fastly/models/line_item_data' require 'fastly/models/line_item_data_read_only_invoice_id' -require 'fastly/models/list_invoices_response' +require 'fastly/models/list_dashboards_response' +require 'fastly/models/list_eom_invoices_response' require 'fastly/models/listinvoices' require 'fastly/models/logging_address_and_port' require 'fastly/models/logging_azureblob_additional' @@ -277,6 +292,9 @@ require 'fastly/models/logging_tls_common' require 'fastly/models/logging_use_tls_string' require 'fastly/models/metadata' +require 'fastly/models/mtd_invoice_response' +require 'fastly/models/mtdinvoice' +require 'fastly/models/mtdlineitems' require 'fastly/models/mutual_authentication' require 'fastly/models/mutual_authentication_data' require 'fastly/models/mutual_authentication_data_attributes' @@ -343,6 +361,12 @@ require 'fastly/models/relationship_common_name' require 'fastly/models/relationship_customer' require 'fastly/models/relationship_customer_customer' +require 'fastly/models/relationship_default_ecdsa_tls_certificate' +require 'fastly/models/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate' +require 'fastly/models/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate_data' +require 'fastly/models/relationship_default_tls_certificate' +require 'fastly/models/relationship_default_tls_certificate_default_certificate' +require 'fastly/models/relationship_default_tls_certificate_default_certificate_data' require 'fastly/models/relationship_member_customer' require 'fastly/models/relationship_member_mutual_authentication' require 'fastly/models/relationship_member_service' @@ -351,7 +375,6 @@ require 'fastly/models/relationship_member_tls_bulk_certificate' require 'fastly/models/relationship_member_tls_certificate' require 'fastly/models/relationship_member_tls_configuration' -require 'fastly/models/relationship_member_tls_dns_record' require 'fastly/models/relationship_member_tls_domain' require 'fastly/models/relationship_member_tls_private_key' require 'fastly/models/relationship_member_tls_subscription' @@ -387,9 +410,12 @@ require 'fastly/models/relationship_tls_configuration_tls_configuration' require 'fastly/models/relationship_tls_configurations' require 'fastly/models/relationship_tls_configurations_tls_configurations' -require 'fastly/models/relationship_tls_dns_record' -require 'fastly/models/relationship_tls_dns_record_dns_record' -require 'fastly/models/relationship_tls_dns_records' +require 'fastly/models/relationship_tls_dns_records_request' +require 'fastly/models/relationship_tls_dns_records_request_dns_records' +require 'fastly/models/relationship_tls_dns_records_request_dns_records_data' +require 'fastly/models/relationship_tls_dns_records_response' +require 'fastly/models/relationship_tls_dns_records_response_dns_records' +require 'fastly/models/relationship_tls_dns_records_response_dns_records_data' require 'fastly/models/relationship_tls_domain' require 'fastly/models/relationship_tls_domain_tls_domain' require 'fastly/models/relationship_tls_domains' @@ -489,6 +515,11 @@ require 'fastly/models/service_response_all_of' require 'fastly/models/service_version_detail' require 'fastly/models/service_version_detail_or_null' +require 'fastly/models/serviceusagemetric' +require 'fastly/models/serviceusagemetrics' +require 'fastly/models/serviceusagemetrics_data' +require 'fastly/models/serviceusagetype' +require 'fastly/models/serviceusagetypes' require 'fastly/models/settings' require 'fastly/models/settings_response' require 'fastly/models/signing_key' @@ -532,6 +563,7 @@ require 'fastly/models/tls_bulk_certificates_response' require 'fastly/models/tls_bulk_certificates_response_all_of' require 'fastly/models/tls_certificate' +require 'fastly/models/tls_certificate_blob_response' require 'fastly/models/tls_certificate_data' require 'fastly/models/tls_certificate_data_attributes' require 'fastly/models/tls_certificate_response' @@ -619,6 +651,7 @@ require 'fastly/models/type_waf_tag' require 'fastly/models/update_billing_address_request' require 'fastly/models/update_billing_address_request_data' +require 'fastly/models/update_dashboard_request' require 'fastly/models/user' require 'fastly/models/user_response' require 'fastly/models/user_response_read_only' @@ -712,6 +745,7 @@ require 'fastly/api/billing_api' require 'fastly/api/billing_address_api' require 'fastly/api/billing_invoices_api' +require 'fastly/api/billing_usage_metrics_api' require 'fastly/api/cache_settings_api' require 'fastly/api/condition_api' require 'fastly/api/config_store_api' @@ -780,6 +814,7 @@ require 'fastly/api/logging_sumologic_api' require 'fastly/api/logging_syslog_api' require 'fastly/api/mutual_authentication_api' +require 'fastly/api/observability_custom_dashboards_api' require 'fastly/api/origin_inspector_historical_api' require 'fastly/api/origin_inspector_realtime_api' require 'fastly/api/package_api' diff --git a/lib/fastly/api/billing_invoices_api.rb b/lib/fastly/api/billing_invoices_api.rb index 83211090..16c3d679 100644 --- a/lib/fastly/api/billing_invoices_api.rb +++ b/lib/fastly/api/billing_invoices_api.rb @@ -20,7 +20,7 @@ def initialize(api_client = ApiClient.default) # Get invoice by ID. # Returns invoice associated with the invoice id. # @option opts [String] :invoice_id Alphanumeric string identifying the invoice. (required) - # @return [InvoiceResponse] + # @return [EomInvoiceResponse] def get_invoice_by_invoice_id(opts = {}) data, _status_code, _headers = get_invoice_by_invoice_id_with_http_info(opts) data @@ -29,7 +29,7 @@ def get_invoice_by_invoice_id(opts = {}) # Get invoice by ID. # Returns invoice associated with the invoice id. # @option opts [String] :invoice_id Alphanumeric string identifying the invoice. (required) - # @return [Array<(InvoiceResponse, Integer, Hash)>] InvoiceResponse data, response status code and response headers + # @return [Array<(EomInvoiceResponse, Integer, Hash)>] EomInvoiceResponse data, response status code and response headers def get_invoice_by_invoice_id_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingInvoicesApi.get_invoice_by_invoice_id ...' @@ -58,7 +58,7 @@ def get_invoice_by_invoice_id_with_http_info(opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'InvoiceResponse' + return_type = opts[:debug_return_type] || 'EomInvoiceResponse' # auth_names auth_names = opts[:debug_auth_names] || ['token'] @@ -80,13 +80,69 @@ def get_invoice_by_invoice_id_with_http_info(opts = {}) return data, status_code, headers end + # Get month-to-date invoice. + # Returns month-to-date invoice for the current month. + # @return [MtdInvoiceResponse] + def get_month_to_date_invoice(opts = {}) + data, _status_code, _headers = get_month_to_date_invoice_with_http_info(opts) + data + end + + # Get month-to-date invoice. + # Returns month-to-date invoice for the current month. + # @return [Array<(MtdInvoiceResponse, Integer, Hash)>] MtdInvoiceResponse data, response status code and response headers + def get_month_to_date_invoice_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BillingInvoicesApi.get_month_to_date_invoice ...' + end + # unbox the parameters from the hash + # resource path + local_var_path = '/billing/v3/invoices/month-to-date' + + # 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] || 'MtdInvoiceResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"BillingInvoicesApi.get_month_to_date_invoice", + :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: BillingInvoicesApi#get_month_to_date_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List of invoices. # Returns the list of invoices, sorted by billing start date (newest to oldest). # @option opts [String] :billing_start_date # @option opts [String] :billing_end_date # @option opts [String] :limit Number of results per page. The maximum is 200. (default to '100') # @option opts [String] :cursor Cursor value from the `next_cursor` field of a previous response, used to retrieve the next page. To request the first page, this should be empty. - # @return [ListInvoicesResponse] + # @return [ListEomInvoicesResponse] def list_invoices(opts = {}) data, _status_code, _headers = list_invoices_with_http_info(opts) data @@ -98,7 +154,7 @@ def list_invoices(opts = {}) # @option opts [String] :billing_end_date # @option opts [String] :limit Number of results per page. The maximum is 200. (default to '100') # @option opts [String] :cursor Cursor value from the `next_cursor` field of a previous response, used to retrieve the next page. To request the first page, this should be empty. - # @return [Array<(ListInvoicesResponse, Integer, Hash)>] ListInvoicesResponse data, response status code and response headers + # @return [Array<(ListEomInvoicesResponse, Integer, Hash)>] ListEomInvoicesResponse data, response status code and response headers def list_invoices_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingInvoicesApi.list_invoices ...' @@ -126,7 +182,7 @@ def list_invoices_with_http_info(opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'ListInvoicesResponse' + return_type = opts[:debug_return_type] || 'ListEomInvoicesResponse' # auth_names auth_names = opts[:debug_auth_names] || ['token'] diff --git a/lib/fastly/api/billing_usage_metrics_api.rb b/lib/fastly/api/billing_usage_metrics_api.rb new file mode 100644 index 00000000..aeaff9c8 --- /dev/null +++ b/lib/fastly/api/billing_usage_metrics_api.rb @@ -0,0 +1,213 @@ +=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 BillingUsageMetricsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + 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') + # @option opts [String] :cursor Cursor value from the `next_cursor` field of a previous response, used to retrieve the next page. To request the first page, this should be empty. + # @return [Serviceusagemetrics] + def get_service_level_usage(opts = {}) + data, _status_code, _headers = get_service_level_usage_with_http_info(opts) + data + 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') + # @option opts [String] :cursor Cursor value from the `next_cursor` field of a previous response, used to retrieve the next page. To request the first page, this should be empty. + # @return [Array<(Serviceusagemetrics, Integer, Hash)>] Serviceusagemetrics data, response status code and response headers + def get_service_level_usage_with_http_info(opts = {}) + if @api_client.config.debugging + @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" + end + # verify the required parameter 'usage_type_name' is set + 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}." + 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_service_level_usage, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/billing/v2/account_customers/{customer_id}/service-usage-metrics'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s)) + + # 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? + query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].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] || 'Serviceusagemetrics' + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"BillingUsageMetricsApi.get_service_level_usage", + :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: BillingUsageMetricsApi#get_service_level_usage\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + 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) + 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 = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BillingUsageMetricsApi.get_service_level_usage_types ...' + 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" + end + # resource path + local_var_path = '/billing/v2/account_customers/{customer_id}/service-usage-types'.sub('{' + 'customer_id' + '}', CGI.escape(customer_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] || 'Serviceusagetypes' + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"BillingUsageMetricsApi.get_service_level_usage_types", + :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: BillingUsageMetricsApi#get_service_level_usage_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/fastly/api/observability_custom_dashboards_api.rb b/lib/fastly/api/observability_custom_dashboards_api.rb new file mode 100644 index 00000000..73da9487 --- /dev/null +++ b/lib/fastly/api/observability_custom_dashboards_api.rb @@ -0,0 +1,333 @@ +=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 ObservabilityCustomDashboardsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create a new dashboard + # Create a new dashboard + # @option opts [CreateDashboardRequest] :create_dashboard_request + # @return [Dashboard] + def create_dashboard(opts = {}) + data, _status_code, _headers = create_dashboard_with_http_info(opts) + data + end + + # Create a new dashboard + # Create a new dashboard + # @option opts [CreateDashboardRequest] :create_dashboard_request + # @return [Array<(Dashboard, Integer, Hash)>] Dashboard data, response status code and response headers + def create_dashboard_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ObservabilityCustomDashboardsApi.create_dashboard ...' + end + # unbox the parameters from the hash + # resource path + local_var_path = '/observability/dashboards' + + # 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[:'create_dashboard_request']) + + # return_type + return_type = opts[:debug_return_type] || 'Dashboard' + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"ObservabilityCustomDashboardsApi.create_dashboard", + :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: ObservabilityCustomDashboardsApi#create_dashboard\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete an existing dashboard + # Delete an existing dashboard + # @option opts [String] :dashboard_id (required) + # @return [nil] + def delete_dashboard(opts = {}) + delete_dashboard_with_http_info(opts) + nil + end + + # Delete an existing dashboard + # Delete an existing dashboard + # @option opts [String] :dashboard_id (required) + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_dashboard_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ObservabilityCustomDashboardsApi.delete_dashboard ...' + end + # unbox the parameters from the hash + dashboard_id = opts[:'dashboard_id'] + # verify the required parameter 'dashboard_id' is set + if @api_client.config.client_side_validation && dashboard_id.nil? + fail ArgumentError, "Missing the required parameter 'dashboard_id' when calling ObservabilityCustomDashboardsApi.delete_dashboard" + end + # resource path + local_var_path = '/observability/dashboards/{dashboard_id}'.sub('{' + 'dashboard_id' + '}', CGI.escape(dashboard_id.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 => :"ObservabilityCustomDashboardsApi.delete_dashboard", + :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: ObservabilityCustomDashboardsApi#delete_dashboard\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve a dashboard by ID + # Retrieve a dashboard by ID + # @option opts [String] :dashboard_id (required) + # @return [Dashboard] + def get_dashboard(opts = {}) + data, _status_code, _headers = get_dashboard_with_http_info(opts) + data + end + + # Retrieve a dashboard by ID + # Retrieve a dashboard by ID + # @option opts [String] :dashboard_id (required) + # @return [Array<(Dashboard, Integer, Hash)>] Dashboard data, response status code and response headers + def get_dashboard_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ObservabilityCustomDashboardsApi.get_dashboard ...' + end + # unbox the parameters from the hash + dashboard_id = opts[:'dashboard_id'] + # verify the required parameter 'dashboard_id' is set + if @api_client.config.client_side_validation && dashboard_id.nil? + fail ArgumentError, "Missing the required parameter 'dashboard_id' when calling ObservabilityCustomDashboardsApi.get_dashboard" + end + # resource path + local_var_path = '/observability/dashboards/{dashboard_id}'.sub('{' + 'dashboard_id' + '}', CGI.escape(dashboard_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] || 'Dashboard' + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"ObservabilityCustomDashboardsApi.get_dashboard", + :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: ObservabilityCustomDashboardsApi#get_dashboard\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List all custom dashboards + # List all custom dashboards + # @return [ListDashboardsResponse] + def list_dashboards(opts = {}) + data, _status_code, _headers = list_dashboards_with_http_info(opts) + data + end + + # List all custom dashboards + # List all custom dashboards + # @return [Array<(ListDashboardsResponse, Integer, Hash)>] ListDashboardsResponse data, response status code and response headers + def list_dashboards_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ObservabilityCustomDashboardsApi.list_dashboards ...' + end + # unbox the parameters from the hash + # resource path + local_var_path = '/observability/dashboards' + + # 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] || 'ListDashboardsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"ObservabilityCustomDashboardsApi.list_dashboards", + :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: ObservabilityCustomDashboardsApi#list_dashboards\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update an existing dashboard + # Update an existing dashboard + # @option opts [String] :dashboard_id (required) + # @option opts [UpdateDashboardRequest] :update_dashboard_request + # @return [Dashboard] + def update_dashboard(opts = {}) + data, _status_code, _headers = update_dashboard_with_http_info(opts) + data + end + + # Update an existing dashboard + # Update an existing dashboard + # @option opts [String] :dashboard_id (required) + # @option opts [UpdateDashboardRequest] :update_dashboard_request + # @return [Array<(Dashboard, Integer, Hash)>] Dashboard data, response status code and response headers + def update_dashboard_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ObservabilityCustomDashboardsApi.update_dashboard ...' + end + # unbox the parameters from the hash + dashboard_id = opts[:'dashboard_id'] + # verify the required parameter 'dashboard_id' is set + if @api_client.config.client_side_validation && dashboard_id.nil? + fail ArgumentError, "Missing the required parameter 'dashboard_id' when calling ObservabilityCustomDashboardsApi.update_dashboard" + end + # resource path + local_var_path = '/observability/dashboards/{dashboard_id}'.sub('{' + 'dashboard_id' + '}', CGI.escape(dashboard_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/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[:'update_dashboard_request']) + + # return_type + return_type = opts[:debug_return_type] || 'Dashboard' + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"ObservabilityCustomDashboardsApi.update_dashboard", + :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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ObservabilityCustomDashboardsApi#update_dashboard\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/fastly/api/tls_certificates_api.rb b/lib/fastly/api/tls_certificates_api.rb index 8d6e0d19..232727cc 100644 --- a/lib/fastly/api/tls_certificates_api.rb +++ b/lib/fastly/api/tls_certificates_api.rb @@ -204,6 +204,69 @@ def get_tls_cert_with_http_info(opts = {}) return data, status_code, headers end + # Get a TLS certificate blob (Limited Availability) + # Retrieve a TLS certificate blob. This feature is part of a [limited availability](https://docs.fastly.com/products/fastly-product-lifecycle#limited-availability) release. + # @option opts [String] :tls_certificate_id Alphanumeric string identifying a TLS certificate. (required) + # @return [TlsCertificateBlobResponse] + def get_tls_cert_blob(opts = {}) + data, _status_code, _headers = get_tls_cert_blob_with_http_info(opts) + data + end + + # Get a TLS certificate blob (Limited Availability) + # Retrieve a TLS certificate blob. This feature is part of a [limited availability](https://docs.fastly.com/products/fastly-product-lifecycle#limited-availability) release. + # @option opts [String] :tls_certificate_id Alphanumeric string identifying a TLS certificate. (required) + # @return [Array<(TlsCertificateBlobResponse, Integer, Hash)>] TlsCertificateBlobResponse data, response status code and response headers + def get_tls_cert_blob_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TlsCertificatesApi.get_tls_cert_blob ...' + end + # unbox the parameters from the hash + tls_certificate_id = opts[:'tls_certificate_id'] + # verify the required parameter 'tls_certificate_id' is set + if @api_client.config.client_side_validation && tls_certificate_id.nil? + fail ArgumentError, "Missing the required parameter 'tls_certificate_id' when calling TlsCertificatesApi.get_tls_cert_blob" + end + # resource path + local_var_path = '/tls/certificates/{tls_certificate_id}/blob'.sub('{' + 'tls_certificate_id' + '}', CGI.escape(tls_certificate_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] || 'TlsCertificateBlobResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['token'] + + new_options = opts.merge( + :operation => :"TlsCertificatesApi.get_tls_cert_blob", + :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: TlsCertificatesApi#get_tls_cert_blob\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List TLS certificates # List all TLS certificates. # @option opts [String] :filter_in_use Optional. Limit the returned certificates to those currently using Fastly to terminate TLS (that is, certificates associated with an activation). Permitted values: true, false. diff --git a/lib/fastly/configuration.rb b/lib/fastly/configuration.rb index b6d4bfe7..7f879009 100644 --- a/lib/fastly/configuration.rb +++ b/lib/fastly/configuration.rb @@ -482,12 +482,30 @@ def operation_server_settings description: "No description provided", } ], + "BillingInvoicesApi.get_month_to_date_invoice": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], "BillingInvoicesApi.list_invoices": [ { url: "https://api.fastly.com", description: "No description provided", } ], + "BillingUsageMetricsApi.get_service_level_usage": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], + "BillingUsageMetricsApi.get_service_level_usage_types": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], "CacheSettingsApi.create_cache_settings": [ { url: "https://api.fastly.com", @@ -2354,6 +2372,36 @@ def operation_server_settings description: "No description provided", } ], + "ObservabilityCustomDashboardsApi.create_dashboard": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], + "ObservabilityCustomDashboardsApi.delete_dashboard": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], + "ObservabilityCustomDashboardsApi.get_dashboard": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], + "ObservabilityCustomDashboardsApi.list_dashboards": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], + "ObservabilityCustomDashboardsApi.update_dashboard": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], "OriginInspectorHistoricalApi.get_origin_inspector_historical": [ { url: "https://api.fastly.com", @@ -2960,6 +3008,12 @@ def operation_server_settings description: "No description provided", } ], + "TlsCertificatesApi.get_tls_cert_blob": [ + { + url: "https://api.fastly.com", + description: "No description provided", + } + ], "TlsCertificatesApi.list_tls_certs": [ { url: "https://api.fastly.com", diff --git a/lib/fastly/models/async_response.rb b/lib/fastly/models/async_response.rb new file mode 100644 index 00000000..fdd4d1fe --- /dev/null +++ b/lib/fastly/models/async_response.rb @@ -0,0 +1,225 @@ +=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 AsyncResponse + attr_accessor :title + + attr_accessor :status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'title' => :'title', + :'status' => :'status' + } + 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 + { + :'title' => :'String', + :'status' => :'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::AsyncResponse` 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::AsyncResponse`. 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?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + 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 && + title == o.title && + status == o.status + 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 + [title, status].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/create_dashboard_request.rb b/lib/fastly/models/create_dashboard_request.rb new file mode 100644 index 00000000..e05ccb99 --- /dev/null +++ b/lib/fastly/models/create_dashboard_request.rb @@ -0,0 +1,245 @@ +=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 CreateDashboardRequest + # A human-readable name + attr_accessor :name + + # A short description of the dashboard + attr_accessor :description + + # A list of [dashboard items](#dashboard-item). + attr_accessor :items + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'description' => :'description', + :'items' => :'items' + } + 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', + :'description' => :'String', + :'items' => :'Array' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + :'items' + ]) + 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::CreateDashboardRequest` 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::CreateDashboardRequest`. 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?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'items') + if (value = attributes[:'items']).is_a?(Array) + self.items = 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 @name.nil? + invalid_properties.push('invalid value for "name", name 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 @name.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 && + name == o.name && + description == o.description && + items == o.items + 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, description, items].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/dashboard.rb b/lib/fastly/models/dashboard.rb new file mode 100644 index 00000000..8b62e628 --- /dev/null +++ b/lib/fastly/models/dashboard.rb @@ -0,0 +1,290 @@ +=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 Dashboard + # Dashboard identifier (UUID) + attr_accessor :id + + # A human-readable name + attr_accessor :name + + # A short description of the dashboard + attr_accessor :description + + # A list of [dashboard items](#dashboard-item). + attr_accessor :items + + # Date and time in ISO 8601 format. + attr_accessor :created_at + + # Date and time in ISO 8601 format. + attr_accessor :updated_at + + attr_accessor :created_by + + attr_accessor :updated_by + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'description' => :'description', + :'items' => :'items', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'created_by' => :'created_by', + :'updated_by' => :'updated_by' + } + 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 + { + :'id' => :'String', + :'name' => :'String', + :'description' => :'String', + :'items' => :'Array', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'created_by' => :'DashboardPropertyCreatedBy', + :'updated_by' => :'DashboardPropertyUpdatedBy' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + :'items', + :'created_at', + :'updated_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::Dashboard` 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::Dashboard`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'items') + if (value = attributes[:'items']).is_a?(Array) + self.items = value + end + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'created_by') + self.created_by = attributes[:'created_by'] + end + + if attributes.key?(:'updated_by') + self.updated_by = attributes[:'updated_by'] + 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 && + id == o.id && + name == o.name && + description == o.description && + items == o.items && + created_at == o.created_at && + updated_at == o.updated_at && + created_by == o.created_by && + updated_by == o.updated_by + 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 + [id, name, description, items, created_at, updated_at, created_by, updated_by].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/dashboard_item.rb b/lib/fastly/models/dashboard_item.rb new file mode 100644 index 00000000..fc0761ba --- /dev/null +++ b/lib/fastly/models/dashboard_item.rb @@ -0,0 +1,368 @@ +=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 dashboard item. Typically a data visualization like a chart. + class DashboardItem + # A human-readable title for the dashboard item + attr_accessor :title + + # A human-readable subtitle for the dashboard item. Often a description of the visualization. + attr_accessor :subtitle + + attr_accessor :data_source + + attr_accessor :visualization + + # Dashboard item identifier (UUID) + attr_accessor :id + + # The number of columns for the dashboard item to span. Dashboards are rendered on a 12-column grid on \"desktop\" screen sizes. + attr_accessor :span + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'title' => :'title', + :'subtitle' => :'subtitle', + :'data_source' => :'data_source', + :'visualization' => :'visualization', + :'id' => :'id', + :'span' => :'span' + } + 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 + { + :'title' => :'String', + :'subtitle' => :'String', + :'data_source' => :'DashboardItemPropertyDataSource', + :'visualization' => :'DashboardItemPropertyVisualization', + :'id' => :'String', + :'span' => :'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::DashboardItem` 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::DashboardItem`. 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?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'subtitle') + self.subtitle = attributes[:'subtitle'] + end + + if attributes.key?(:'data_source') + self.data_source = attributes[:'data_source'] + end + + if attributes.key?(:'visualization') + self.visualization = attributes[:'visualization'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'span') + self.span = attributes[:'span'] + else + self.span = 4 + 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 @title.nil? + invalid_properties.push('invalid value for "title", title cannot be nil.') + end + + if @title.to_s.length > 255 + invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 255.') + end + + if @title.to_s.length < 1 + invalid_properties.push('invalid value for "title", the character length must be great than or equal to 1.') + end + + if @subtitle.nil? + invalid_properties.push('invalid value for "subtitle", subtitle cannot be nil.') + end + + if @subtitle.to_s.length > 255 + invalid_properties.push('invalid value for "subtitle", the character length must be smaller than or equal to 255.') + end + + if @subtitle.to_s.length < 1 + invalid_properties.push('invalid value for "subtitle", the character length must be great than or equal to 1.') + end + + if @data_source.nil? + invalid_properties.push('invalid value for "data_source", data_source cannot be nil.') + end + + if @visualization.nil? + invalid_properties.push('invalid value for "visualization", visualization cannot be nil.') + end + + if !@span.nil? && @span > 12 + invalid_properties.push('invalid value for "span", must be smaller than or equal to 12.') + end + + if !@span.nil? && @span < 1 + invalid_properties.push('invalid value for "span", 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 @title.nil? + return false if @title.to_s.length > 255 + return false if @title.to_s.length < 1 + return false if @subtitle.nil? + return false if @subtitle.to_s.length > 255 + return false if @subtitle.to_s.length < 1 + return false if @data_source.nil? + return false if @visualization.nil? + return false if !@span.nil? && @span > 12 + return false if !@span.nil? && @span < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] title Value to be assigned + def title=(title) + if title.nil? + fail ArgumentError, 'title cannot be nil' + end + + if title.to_s.length > 255 + fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 255.' + end + + if title.to_s.length < 1 + fail ArgumentError, 'invalid value for "title", the character length must be great than or equal to 1.' + end + + @title = title + end + + # Custom attribute writer method with validation + # @param [Object] subtitle Value to be assigned + def subtitle=(subtitle) + if subtitle.nil? + fail ArgumentError, 'subtitle cannot be nil' + end + + if subtitle.to_s.length > 255 + fail ArgumentError, 'invalid value for "subtitle", the character length must be smaller than or equal to 255.' + end + + if subtitle.to_s.length < 1 + fail ArgumentError, 'invalid value for "subtitle", the character length must be great than or equal to 1.' + end + + @subtitle = subtitle + end + + # Custom attribute writer method with validation + # @param [Object] span Value to be assigned + def span=(span) + if !span.nil? && span > 12 + fail ArgumentError, 'invalid value for "span", must be smaller than or equal to 12.' + end + + if !span.nil? && span < 1 + fail ArgumentError, 'invalid value for "span", must be greater than or equal to 1.' + end + + @span = span + 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 && + title == o.title && + subtitle == o.subtitle && + data_source == o.data_source && + visualization == o.visualization && + id == o.id && + span == o.span + 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 + [title, subtitle, data_source, visualization, id, span].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/dashboard_item_property_data_source.rb b/lib/fastly/models/dashboard_item_property_data_source.rb new file mode 100644 index 00000000..61f4fd18 --- /dev/null +++ b/lib/fastly/models/dashboard_item_property_data_source.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 + # [An object](#data-source) which describes the data to display. + class DashboardItemPropertyDataSource + # The source of the data to display. + attr_accessor :type + + attr_accessor :config + + 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 + { + :'type' => :'type', + :'config' => :'config' + } + 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 + { + :'type' => :'String', + :'config' => :'DashboardItemPropertyDataSourcePropertyConfig' + } + 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::DashboardItemPropertyDataSource` 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::DashboardItemPropertyDataSource`. 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?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'config') + self.config = attributes[:'config'] + 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 @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + if @config.nil? + invalid_properties.push('invalid value for "config", config 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 @type.nil? + type_validator = EnumAttributeValidator.new('String', ["stats.edge", "stats.domain", "stats.origin"]) + return false unless type_validator.valid?(@type) + return false if @config.nil? + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] type Object to be assigned + def type=(type) + validator = EnumAttributeValidator.new('String', ["stats.edge", "stats.domain", "stats.origin"]) + unless validator.valid?(type) + fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." + end + @type = type + 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 && + type == o.type && + config == o.config + 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 + [type, config].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/dashboard_item_property_data_source_property_config.rb b/lib/fastly/models/dashboard_item_property_data_source_property_config.rb new file mode 100644 index 00000000..7f994ff2 --- /dev/null +++ b/lib/fastly/models/dashboard_item_property_data_source_property_config.rb @@ -0,0 +1,244 @@ +=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 + # [Configuration options](#data-source-config) for the selected data source. + class DashboardItemPropertyDataSourcePropertyConfig + # The metrics to visualize. Valid options are defined by the selected [data source](#field_data_source). + attr_accessor :metrics + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'metrics' => :'metrics' + } + 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 + { + :'metrics' => :'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::DashboardItemPropertyDataSourcePropertyConfig` 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::DashboardItemPropertyDataSourcePropertyConfig`. 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?(:'metrics') + if (value = attributes[:'metrics']).is_a?(Array) + self.metrics = 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 @metrics.nil? + invalid_properties.push('invalid value for "metrics", metrics cannot be nil.') + end + + if @metrics.length < 1 + invalid_properties.push('invalid value for "metrics", number of items 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 @metrics.nil? + return false if @metrics.length < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] metrics Value to be assigned + def metrics=(metrics) + if metrics.nil? + fail ArgumentError, 'metrics cannot be nil' + end + + if metrics.length < 1 + fail ArgumentError, 'invalid value for "metrics", number of items must be greater than or equal to 1.' + end + + @metrics = metrics + 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 && + metrics == o.metrics + 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 + [metrics].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/dashboard_item_property_visualization.rb b/lib/fastly/models/dashboard_item_property_visualization.rb new file mode 100644 index 00000000..dc19bfcb --- /dev/null +++ b/lib/fastly/models/dashboard_item_property_visualization.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 + # [An object](#visualization) which describes the data visualization to display. + class DashboardItemPropertyVisualization + # The type of visualization to display. + attr_accessor :type + + attr_accessor :config + + 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 + { + :'type' => :'type', + :'config' => :'config' + } + 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 + { + :'type' => :'String', + :'config' => :'DashboardItemPropertyVisualizationPropertyConfig' + } + 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::DashboardItemPropertyVisualization` 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::DashboardItemPropertyVisualization`. 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?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'config') + self.config = attributes[:'config'] + 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 @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + if @config.nil? + invalid_properties.push('invalid value for "config", config 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 @type.nil? + type_validator = EnumAttributeValidator.new('String', ["chart"]) + return false unless type_validator.valid?(@type) + return false if @config.nil? + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] type Object to be assigned + def type=(type) + validator = EnumAttributeValidator.new('String', ["chart"]) + unless validator.valid?(type) + fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." + end + @type = type + 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 && + type == o.type && + config == o.config + 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 + [type, config].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/dashboard_item_property_visualization_property_config.rb b/lib/fastly/models/dashboard_item_property_visualization_property_config.rb new file mode 100644 index 00000000..46ae2e26 --- /dev/null +++ b/lib/fastly/models/dashboard_item_property_visualization_property_config.rb @@ -0,0 +1,303 @@ +=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 + # [Configuration options](#visualization-config) for the given visualization. + class DashboardItemPropertyVisualizationPropertyConfig + # The type of chart to display. + attr_accessor :plot_type + + # (Optional) The units to use to format the data. + attr_accessor :format + + # (Optional) The aggregation function to apply to the dataset. + attr_accessor :calculation_method + + 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 + { + :'plot_type' => :'plot_type', + :'format' => :'format', + :'calculation_method' => :'calculation_method' + } + 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 + { + :'plot_type' => :'String', + :'format' => :'String', + :'calculation_method' => :'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::DashboardItemPropertyVisualizationPropertyConfig` 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::DashboardItemPropertyVisualizationPropertyConfig`. 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?(:'plot_type') + self.plot_type = attributes[:'plot_type'] + end + + if attributes.key?(:'format') + self.format = attributes[:'format'] + else + self.format = 'number' + end + + if attributes.key?(:'calculation_method') + self.calculation_method = attributes[:'calculation_method'] + 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 @plot_type.nil? + invalid_properties.push('invalid value for "plot_type", plot_type 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 @plot_type.nil? + plot_type_validator = EnumAttributeValidator.new('String', ["line", "bar", "single-metric", "donut"]) + return false unless plot_type_validator.valid?(@plot_type) + format_validator = EnumAttributeValidator.new('String', ["number", "bytes", "percent", "requests", "responses", "seconds", "milliseconds", "ratio", "bitrate"]) + return false unless format_validator.valid?(@format) + calculation_method_validator = EnumAttributeValidator.new('String', ["avg", "sum", "min", "max", "latest", "p95"]) + return false unless calculation_method_validator.valid?(@calculation_method) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] plot_type Object to be assigned + def plot_type=(plot_type) + validator = EnumAttributeValidator.new('String', ["line", "bar", "single-metric", "donut"]) + unless validator.valid?(plot_type) + fail ArgumentError, "invalid value for \"plot_type\", must be one of #{validator.allowable_values}." + end + @plot_type = plot_type + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] format Object to be assigned + def format=(format) + validator = EnumAttributeValidator.new('String', ["number", "bytes", "percent", "requests", "responses", "seconds", "milliseconds", "ratio", "bitrate"]) + unless validator.valid?(format) + fail ArgumentError, "invalid value for \"format\", must be one of #{validator.allowable_values}." + end + @format = format + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] calculation_method Object to be assigned + def calculation_method=(calculation_method) + validator = EnumAttributeValidator.new('String', ["avg", "sum", "min", "max", "latest", "p95"]) + unless validator.valid?(calculation_method) + fail ArgumentError, "invalid value for \"calculation_method\", must be one of #{validator.allowable_values}." + end + @calculation_method = calculation_method + 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 && + plot_type == o.plot_type && + format == o.format && + calculation_method == o.calculation_method + 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 + [plot_type, format, calculation_method].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/dashboard_property_created_by.rb b/lib/fastly/models/dashboard_property_created_by.rb new file mode 100644 index 00000000..152b45d4 --- /dev/null +++ b/lib/fastly/models/dashboard_property_created_by.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 user who created the dashboard + class DashboardPropertyCreatedBy + # 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::DashboardPropertyCreatedBy` 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::DashboardPropertyCreatedBy`. 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/dashboard_property_updated_by.rb b/lib/fastly/models/dashboard_property_updated_by.rb new file mode 100644 index 00000000..45924ad7 --- /dev/null +++ b/lib/fastly/models/dashboard_property_updated_by.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 user who last modified the dashboard + class DashboardPropertyUpdatedBy + # 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::DashboardPropertyUpdatedBy` 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::DashboardPropertyUpdatedBy`. 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/domain_inspector_measurements.rb b/lib/fastly/models/domain_inspector_measurements.rb index d8640ff9..c91dbd03 100644 --- a/lib/fastly/models/domain_inspector_measurements.rb +++ b/lib/fastly/models/domain_inspector_measurements.rb @@ -128,7 +128,7 @@ class DomainInspectorMeasurements # Ratio of cache hits to cache misses at the edge, between 0 and 1 (`edge_hit_requests` / (`edge_hit_requests` + `edge_miss_requests`)). attr_accessor :edge_hit_ratio - # Ratio of response bytes delivered from the edge compared to what is delivered from origin, 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`). + # 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`). Previously, Origin Offload used a different formula. [Learn more](https://www.fastly.com/documentation/reference/changes/2024/06/add-origin_offload-metric). attr_accessor :origin_offload # Number of responses received from origin with status code 200 (Success). diff --git a/lib/fastly/models/invoice_response.rb b/lib/fastly/models/eom_invoice_response.rb similarity index 97% rename from lib/fastly/models/invoice_response.rb rename to lib/fastly/models/eom_invoice_response.rb index 85c90398..c4a8f814 100644 --- a/lib/fastly/models/invoice_response.rb +++ b/lib/fastly/models/eom_invoice_response.rb @@ -12,7 +12,7 @@ require 'time' module Fastly - class InvoiceResponse + class EomInvoiceResponse # Customer ID associated with the invoice. attr_accessor :customer_id @@ -91,13 +91,13 @@ def self.fastly_all_of # @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::InvoiceResponse` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::EomInvoiceResponse` 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::InvoiceResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::EomInvoiceResponse`. 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 } diff --git a/lib/fastly/models/get_service_level_usage_response.rb b/lib/fastly/models/get_service_level_usage_response.rb new file mode 100644 index 00000000..9d0d6cee --- /dev/null +++ b/lib/fastly/models/get_service_level_usage_response.rb @@ -0,0 +1,223 @@ +=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 GetServiceLevelUsageResponse + 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' => :'ServiceusagemetricsData' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.fastly_all_of + [ + :'Serviceusagemetrics' + ] + 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::GetServiceLevelUsageResponse` 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::GetServiceLevelUsageResponse`. 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') + self.data = attributes[:'data'] + 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/get_service_level_usage_types_response.rb b/lib/fastly/models/get_service_level_usage_types_response.rb new file mode 100644 index 00000000..32eab937 --- /dev/null +++ b/lib/fastly/models/get_service_level_usage_types_response.rb @@ -0,0 +1,225 @@ +=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 GetServiceLevelUsageTypesResponse + 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 + + # List of class defined in allOf (OpenAPI v3) + def self.fastly_all_of + [ + :'Serviceusagetypes' + ] + 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::GetServiceLevelUsageTypesResponse` 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::GetServiceLevelUsageTypesResponse`. 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/included_with_tls_configuration.rb b/lib/fastly/models/included_with_tls_configuration.rb new file mode 100644 index 00000000..8268bf8d --- /dev/null +++ b/lib/fastly/models/included_with_tls_configuration.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 IncludedWithTlsConfiguration + attr_accessor :included + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'included' => :'included' + } + 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 + { + :'included' => :'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::IncludedWithTlsConfiguration` 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::IncludedWithTlsConfiguration`. 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?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = 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 && + included == o.included + 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 + [included].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/included_with_tls_configuration_item.rb b/lib/fastly/models/included_with_tls_configuration_item.rb new file mode 100644 index 00000000..646fb121 --- /dev/null +++ b/lib/fastly/models/included_with_tls_configuration_item.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 IncludedWithTlsConfigurationItem + # The IP address or hostname of the DNS record. + attr_accessor :id + + attr_accessor :type + + attr_accessor :attributes + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type', + :'attributes' => :'attributes' + } + 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 + { + :'id' => :'String', + :'type' => :'TypeTlsDnsRecord', + :'attributes' => :'TlsDnsRecord' + } + 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::IncludedWithTlsConfigurationItem` 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::IncludedWithTlsConfigurationItem`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = 'dns_record' + end + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + 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 && + id == o.id && + type == o.type && + attributes == o.attributes + 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 + [id, type, attributes].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/invoicelineitems.rb b/lib/fastly/models/invoicelineitems.rb index c387f9ee..f8ac50f9 100644 --- a/lib/fastly/models/invoicelineitems.rb +++ b/lib/fastly/models/invoicelineitems.rb @@ -51,11 +51,11 @@ def self.attribute_map :'credit_coupon_code' => :'credit_coupon_code', :'rate' => :'rate', :'units' => :'units', - :'product_name' => :'ProductName', - :'product_group' => :'ProductGroup', - :'product_line' => :'ProductLine', - :'region' => :'Region', - :'usage_type' => :'UsageType' + :'product_name' => :'product_name', + :'product_group' => :'product_group', + :'product_line' => :'product_line', + :'region' => :'region', + :'usage_type' => :'usage_type' } end diff --git a/lib/fastly/models/list_dashboards_response.rb b/lib/fastly/models/list_dashboards_response.rb new file mode 100644 index 00000000..57847271 --- /dev/null +++ b/lib/fastly/models/list_dashboards_response.rb @@ -0,0 +1,229 @@ +=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 ListDashboardsResponse + attr_accessor :data + + # Meta for the pagination. + 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' => :'Object' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + :'meta' + ]) + 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::ListDashboardsResponse` 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::ListDashboardsResponse`. 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/list_invoices_response.rb b/lib/fastly/models/list_eom_invoices_response.rb similarity index 96% rename from lib/fastly/models/list_invoices_response.rb rename to lib/fastly/models/list_eom_invoices_response.rb index 12c53ae2..30df689b 100644 --- a/lib/fastly/models/list_invoices_response.rb +++ b/lib/fastly/models/list_eom_invoices_response.rb @@ -12,7 +12,7 @@ require 'time' module Fastly - class ListInvoicesResponse + class ListEomInvoicesResponse attr_accessor :data attr_accessor :meta @@ -55,13 +55,13 @@ def self.fastly_all_of # @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::ListInvoicesResponse` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::ListEomInvoicesResponse` 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::ListInvoicesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ListEomInvoicesResponse`. 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 } diff --git a/lib/fastly/models/mtd_invoice_response.rb b/lib/fastly/models/mtd_invoice_response.rb new file mode 100644 index 00000000..361ac9d6 --- /dev/null +++ b/lib/fastly/models/mtd_invoice_response.rb @@ -0,0 +1,275 @@ +=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 MtdInvoiceResponse + # The Customer ID associated with the invoice. + attr_accessor :customer_id + + # An alphanumeric string identifying the invoice. + attr_accessor :invoice_id + + # The date and time (in ISO 8601 format) for the initiation point of a billing cycle, signifying the start of charges for a service or subscription. + attr_accessor :billing_start_date + + # The date and time (in ISO 8601 format) for the termination point of a billing cycle, signifying the end of charges for a service or subscription. + attr_accessor :billing_end_date + + # The total billable amount for invoiced services charged within a single month. + attr_accessor :monthly_transaction_amount + + attr_accessor :transaction_line_items + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'customer_id' => :'customer_id', + :'invoice_id' => :'invoice_id', + :'billing_start_date' => :'billing_start_date', + :'billing_end_date' => :'billing_end_date', + :'monthly_transaction_amount' => :'monthly_transaction_amount', + :'transaction_line_items' => :'transaction_line_items' + } + 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', + :'invoice_id' => :'String', + :'billing_start_date' => :'Time', + :'billing_end_date' => :'Time', + :'monthly_transaction_amount' => :'String', + :'transaction_line_items' => :'Array' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.fastly_all_of + [ + :'Mtdinvoice' + ] + 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::MtdInvoiceResponse` 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::MtdInvoiceResponse`. 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?(:'invoice_id') + self.invoice_id = attributes[:'invoice_id'] + end + + if attributes.key?(:'billing_start_date') + self.billing_start_date = attributes[:'billing_start_date'] + end + + if attributes.key?(:'billing_end_date') + self.billing_end_date = attributes[:'billing_end_date'] + end + + if attributes.key?(:'monthly_transaction_amount') + self.monthly_transaction_amount = attributes[:'monthly_transaction_amount'] + end + + if attributes.key?(:'transaction_line_items') + if (value = attributes[:'transaction_line_items']).is_a?(Array) + self.transaction_line_items = 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 && + customer_id == o.customer_id && + invoice_id == o.invoice_id && + billing_start_date == o.billing_start_date && + billing_end_date == o.billing_end_date && + monthly_transaction_amount == o.monthly_transaction_amount && + transaction_line_items == o.transaction_line_items + 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, invoice_id, billing_start_date, billing_end_date, monthly_transaction_amount, transaction_line_items].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/mtdinvoice.rb b/lib/fastly/models/mtdinvoice.rb new file mode 100644 index 00000000..2e2cbfef --- /dev/null +++ b/lib/fastly/models/mtdinvoice.rb @@ -0,0 +1,268 @@ +=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 Mtdinvoice + # The Customer ID associated with the invoice. + attr_accessor :customer_id + + # An alphanumeric string identifying the invoice. + attr_accessor :invoice_id + + # The date and time (in ISO 8601 format) for the initiation point of a billing cycle, signifying the start of charges for a service or subscription. + attr_accessor :billing_start_date + + # The date and time (in ISO 8601 format) for the termination point of a billing cycle, signifying the end of charges for a service or subscription. + attr_accessor :billing_end_date + + # The total billable amount for invoiced services charged within a single month. + attr_accessor :monthly_transaction_amount + + attr_accessor :transaction_line_items + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'customer_id' => :'customer_id', + :'invoice_id' => :'invoice_id', + :'billing_start_date' => :'billing_start_date', + :'billing_end_date' => :'billing_end_date', + :'monthly_transaction_amount' => :'monthly_transaction_amount', + :'transaction_line_items' => :'transaction_line_items' + } + 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', + :'invoice_id' => :'String', + :'billing_start_date' => :'Time', + :'billing_end_date' => :'Time', + :'monthly_transaction_amount' => :'String', + :'transaction_line_items' => :'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::Mtdinvoice` 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::Mtdinvoice`. 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?(:'invoice_id') + self.invoice_id = attributes[:'invoice_id'] + end + + if attributes.key?(:'billing_start_date') + self.billing_start_date = attributes[:'billing_start_date'] + end + + if attributes.key?(:'billing_end_date') + self.billing_end_date = attributes[:'billing_end_date'] + end + + if attributes.key?(:'monthly_transaction_amount') + self.monthly_transaction_amount = attributes[:'monthly_transaction_amount'] + end + + if attributes.key?(:'transaction_line_items') + if (value = attributes[:'transaction_line_items']).is_a?(Array) + self.transaction_line_items = 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 && + customer_id == o.customer_id && + invoice_id == o.invoice_id && + billing_start_date == o.billing_start_date && + billing_end_date == o.billing_end_date && + monthly_transaction_amount == o.monthly_transaction_amount && + transaction_line_items == o.transaction_line_items + 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, invoice_id, billing_start_date, billing_end_date, monthly_transaction_amount, transaction_line_items].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/mtdlineitems.rb b/lib/fastly/models/mtdlineitems.rb new file mode 100644 index 00000000..5b981da5 --- /dev/null +++ b/lib/fastly/models/mtdlineitems.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 Mtdlineitems + # Invoice line item transaction name. + attr_accessor :description + + # Billed amount for line item. + attr_accessor :amount + + # Price per unit. + attr_accessor :rate + + # Total number of units of usage. + attr_accessor :units + + # The name of the product. + attr_accessor :product_name + + # The broader classification of the product (e.g., `Compute` or `Full-Site Delivery`). + attr_accessor :product_group + + # The broader classification of the product (e.g., `Network Services` or `Security`). + attr_accessor :product_line + + # The geographical area applicable for regionally based products. + attr_accessor :region + + # The unit of measure (e.g., `requests` or `bandwidth`). + attr_accessor :usage_type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'description' => :'description', + :'amount' => :'amount', + :'rate' => :'rate', + :'units' => :'units', + :'product_name' => :'product_name', + :'product_group' => :'product_group', + :'product_line' => :'product_line', + :'region' => :'region', + :'usage_type' => :'usage_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 + { + :'description' => :'String', + :'amount' => :'Float', + :'rate' => :'Float', + :'units' => :'Float', + :'product_name' => :'String', + :'product_group' => :'String', + :'product_line' => :'String', + :'region' => :'String', + :'usage_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::Mtdlineitems` 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::Mtdlineitems`. 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?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'rate') + self.rate = attributes[:'rate'] + end + + if attributes.key?(:'units') + self.units = attributes[:'units'] + end + + if attributes.key?(:'product_name') + self.product_name = attributes[:'product_name'] + end + + if attributes.key?(:'product_group') + self.product_group = attributes[:'product_group'] + end + + if attributes.key?(:'product_line') + self.product_line = attributes[:'product_line'] + end + + if attributes.key?(:'region') + self.region = attributes[:'region'] + end + + if attributes.key?(:'usage_type') + self.usage_type = attributes[:'usage_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 && + description == o.description && + amount == o.amount && + rate == o.rate && + units == o.units && + product_name == o.product_name && + product_group == o.product_group && + product_line == o.product_line && + region == o.region && + usage_type == o.usage_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 + [description, amount, rate, units, product_name, product_group, product_line, region, usage_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/realtime_entry_aggregated.rb b/lib/fastly/models/realtime_entry_aggregated.rb index 7c2c9c99..154ced4a 100644 --- a/lib/fastly/models/realtime_entry_aggregated.rb +++ b/lib/fastly/models/realtime_entry_aggregated.rb @@ -758,6 +758,9 @@ class RealtimeEntryAggregated # Number of \"Server Error\" codes delivered for all sources. attr_accessor :all_status_5xx + # 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`). + attr_accessor :origin_offload + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -1008,7 +1011,8 @@ def self.attribute_map :'all_status_2xx' => :'all_status_2xx', :'all_status_3xx' => :'all_status_3xx', :'all_status_4xx' => :'all_status_4xx', - :'all_status_5xx' => :'all_status_5xx' + :'all_status_5xx' => :'all_status_5xx', + :'origin_offload' => :'origin_offload' } end @@ -1267,7 +1271,8 @@ def self.fastly_types :'all_status_2xx' => :'Integer', :'all_status_3xx' => :'Integer', :'all_status_4xx' => :'Integer', - :'all_status_5xx' => :'Integer' + :'all_status_5xx' => :'Integer', + :'origin_offload' => :'Float' } end @@ -2292,6 +2297,10 @@ def initialize(attributes = {}) if attributes.key?(:'all_status_5xx') self.all_status_5xx = attributes[:'all_status_5xx'] end + + if attributes.key?(:'origin_offload') + self.origin_offload = attributes[:'origin_offload'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -2559,7 +2568,8 @@ def ==(o) all_status_2xx == o.all_status_2xx && all_status_3xx == o.all_status_3xx && all_status_4xx == o.all_status_4xx && - all_status_5xx == o.all_status_5xx + all_status_5xx == o.all_status_5xx && + origin_offload == o.origin_offload end # @see the `==` method @@ -2571,7 +2581,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].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].hash end # Builds the object from hash diff --git a/lib/fastly/models/realtime_measurements.rb b/lib/fastly/models/realtime_measurements.rb index 0298b19f..ac942861 100644 --- a/lib/fastly/models/realtime_measurements.rb +++ b/lib/fastly/models/realtime_measurements.rb @@ -758,6 +758,9 @@ class RealtimeMeasurements # Number of \"Server Error\" codes delivered for all sources. attr_accessor :all_status_5xx + # 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`). + attr_accessor :origin_offload + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -1008,7 +1011,8 @@ def self.attribute_map :'all_status_2xx' => :'all_status_2xx', :'all_status_3xx' => :'all_status_3xx', :'all_status_4xx' => :'all_status_4xx', - :'all_status_5xx' => :'all_status_5xx' + :'all_status_5xx' => :'all_status_5xx', + :'origin_offload' => :'origin_offload' } end @@ -1267,7 +1271,8 @@ def self.fastly_types :'all_status_2xx' => :'Integer', :'all_status_3xx' => :'Integer', :'all_status_4xx' => :'Integer', - :'all_status_5xx' => :'Integer' + :'all_status_5xx' => :'Integer', + :'origin_offload' => :'Float' } end @@ -2285,6 +2290,10 @@ def initialize(attributes = {}) if attributes.key?(:'all_status_5xx') self.all_status_5xx = attributes[:'all_status_5xx'] end + + if attributes.key?(:'origin_offload') + self.origin_offload = attributes[:'origin_offload'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -2552,7 +2561,8 @@ def ==(o) all_status_2xx == o.all_status_2xx && all_status_3xx == o.all_status_3xx && all_status_4xx == o.all_status_4xx && - all_status_5xx == o.all_status_5xx + all_status_5xx == o.all_status_5xx && + origin_offload == o.origin_offload end # @see the `==` method @@ -2564,7 +2574,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].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].hash end # Builds the object from hash diff --git a/lib/fastly/models/relationship_default_ecdsa_tls_certificate.rb b/lib/fastly/models/relationship_default_ecdsa_tls_certificate.rb new file mode 100644 index 00000000..a2aa3939 --- /dev/null +++ b/lib/fastly/models/relationship_default_ecdsa_tls_certificate.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 RelationshipDefaultEcdsaTlsCertificate + attr_accessor :default_ecdsa_certificate + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'default_ecdsa_certificate' => :'default_ecdsa_certificate' + } + 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 + { + :'default_ecdsa_certificate' => :'RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificate' + } + 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::RelationshipDefaultEcdsaTlsCertificate` 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::RelationshipDefaultEcdsaTlsCertificate`. 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?(:'default_ecdsa_certificate') + self.default_ecdsa_certificate = attributes[:'default_ecdsa_certificate'] + 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 && + default_ecdsa_certificate == o.default_ecdsa_certificate + 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 + [default_ecdsa_certificate].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/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate.rb b/lib/fastly/models/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate.rb new file mode 100644 index 00000000..e65d99f4 --- /dev/null +++ b/lib/fastly/models/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate.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 RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificate + 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' => :'RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificateData' + } + 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::RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificate` 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::RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificate`. 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') + self.data = attributes[:'data'] + 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/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate_data.rb b/lib/fastly/models/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate_data.rb new file mode 100644 index 00000000..31a917b9 --- /dev/null +++ b/lib/fastly/models/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate_data.rb @@ -0,0 +1,228 @@ +=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 RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificateData + attr_accessor :type + + # Alphanumeric string identifying the default ECDSA TLS certificate. + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'id' => :'id' + } + 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 + { + :'type' => :'TypeTlsCertificate', + :'id' => :'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::RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificateData` 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::RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificateData`. 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?(:'type') + self.type = attributes[:'type'] + else + self.type = 'tls_certificate' + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + 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 && + type == o.type && + id == o.id + 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 + [type, id].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/relationship_default_tls_certificate.rb b/lib/fastly/models/relationship_default_tls_certificate.rb new file mode 100644 index 00000000..9fcb71d1 --- /dev/null +++ b/lib/fastly/models/relationship_default_tls_certificate.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 RelationshipDefaultTlsCertificate + attr_accessor :default_certificate + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'default_certificate' => :'default_certificate' + } + 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 + { + :'default_certificate' => :'RelationshipDefaultTlsCertificateDefaultCertificate' + } + 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::RelationshipDefaultTlsCertificate` 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::RelationshipDefaultTlsCertificate`. 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?(:'default_certificate') + self.default_certificate = attributes[:'default_certificate'] + 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 && + default_certificate == o.default_certificate + 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 + [default_certificate].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/relationship_default_tls_certificate_default_certificate.rb b/lib/fastly/models/relationship_default_tls_certificate_default_certificate.rb new file mode 100644 index 00000000..535b1ae0 --- /dev/null +++ b/lib/fastly/models/relationship_default_tls_certificate_default_certificate.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 RelationshipDefaultTlsCertificateDefaultCertificate + 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' => :'RelationshipDefaultTlsCertificateDefaultCertificateData' + } + 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::RelationshipDefaultTlsCertificateDefaultCertificate` 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::RelationshipDefaultTlsCertificateDefaultCertificate`. 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') + self.data = attributes[:'data'] + 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/relationship_default_tls_certificate_default_certificate_data.rb b/lib/fastly/models/relationship_default_tls_certificate_default_certificate_data.rb new file mode 100644 index 00000000..4bfeae76 --- /dev/null +++ b/lib/fastly/models/relationship_default_tls_certificate_default_certificate_data.rb @@ -0,0 +1,228 @@ +=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 RelationshipDefaultTlsCertificateDefaultCertificateData + attr_accessor :type + + # Alphanumeric string identifying the default TLS certificate. + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'id' => :'id' + } + 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 + { + :'type' => :'TypeTlsCertificate', + :'id' => :'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::RelationshipDefaultTlsCertificateDefaultCertificateData` 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::RelationshipDefaultTlsCertificateDefaultCertificateData`. 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?(:'type') + self.type = attributes[:'type'] + else + self.type = 'tls_certificate' + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + 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 && + type == o.type && + id == o.id + 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 + [type, id].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/relationship_tls_dns_records.rb b/lib/fastly/models/relationship_tls_dns_records_request.rb similarity index 95% rename from lib/fastly/models/relationship_tls_dns_records.rb rename to lib/fastly/models/relationship_tls_dns_records_request.rb index bcb7d258..33d76565 100644 --- a/lib/fastly/models/relationship_tls_dns_records.rb +++ b/lib/fastly/models/relationship_tls_dns_records_request.rb @@ -12,7 +12,7 @@ require 'time' module Fastly - class RelationshipTlsDnsRecords + class RelationshipTlsDnsRecordsRequest attr_accessor :dns_records # Attribute mapping from ruby-style variable name to JSON key. @@ -30,7 +30,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.fastly_types { - :'dns_records' => :'RelationshipTlsDnsRecordDnsRecord' + :'dns_records' => :'RelationshipTlsDnsRecordsRequestDnsRecords' } end @@ -44,13 +44,13 @@ def self.fastly_nullable # @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::RelationshipTlsDnsRecords` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::RelationshipTlsDnsRecordsRequest` 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::RelationshipTlsDnsRecords`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::RelationshipTlsDnsRecordsRequest`. 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 } diff --git a/lib/fastly/models/relationship_tls_dns_records_request_dns_records.rb b/lib/fastly/models/relationship_tls_dns_records_request_dns_records.rb new file mode 100644 index 00000000..7a87bff6 --- /dev/null +++ b/lib/fastly/models/relationship_tls_dns_records_request_dns_records.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 RelationshipTlsDnsRecordsRequestDnsRecords + 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::RelationshipTlsDnsRecordsRequestDnsRecords` 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::RelationshipTlsDnsRecordsRequestDnsRecords`. 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/relationship_member_tls_dns_record.rb b/lib/fastly/models/relationship_tls_dns_records_request_dns_records_data.rb similarity index 95% rename from lib/fastly/models/relationship_member_tls_dns_record.rb rename to lib/fastly/models/relationship_tls_dns_records_request_dns_records_data.rb index f65eacfd..0f96f62d 100644 --- a/lib/fastly/models/relationship_member_tls_dns_record.rb +++ b/lib/fastly/models/relationship_tls_dns_records_request_dns_records_data.rb @@ -12,7 +12,7 @@ require 'time' module Fastly - class RelationshipMemberTlsDnsRecord + class RelationshipTlsDnsRecordsRequestDnsRecordsData attr_accessor :type attr_accessor :id @@ -48,13 +48,13 @@ def self.fastly_nullable # @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::RelationshipMemberTlsDnsRecord` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::RelationshipTlsDnsRecordsRequestDnsRecordsData` 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::RelationshipMemberTlsDnsRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::RelationshipTlsDnsRecordsRequestDnsRecordsData`. 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 } diff --git a/lib/fastly/models/relationship_tls_dns_records_response.rb b/lib/fastly/models/relationship_tls_dns_records_response.rb new file mode 100644 index 00000000..e9546620 --- /dev/null +++ b/lib/fastly/models/relationship_tls_dns_records_response.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 RelationshipTlsDnsRecordsResponse + attr_accessor :dns_records + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'dns_records' => :'dns_records' + } + 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 + { + :'dns_records' => :'RelationshipTlsDnsRecordsResponseDnsRecords' + } + 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::RelationshipTlsDnsRecordsResponse` 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::RelationshipTlsDnsRecordsResponse`. 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?(:'dns_records') + self.dns_records = attributes[:'dns_records'] + 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 && + dns_records == o.dns_records + 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 + [dns_records].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/relationship_tls_dns_records_response_dns_records.rb b/lib/fastly/models/relationship_tls_dns_records_response_dns_records.rb new file mode 100644 index 00000000..cee03e95 --- /dev/null +++ b/lib/fastly/models/relationship_tls_dns_records_response_dns_records.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 RelationshipTlsDnsRecordsResponseDnsRecords + 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::RelationshipTlsDnsRecordsResponseDnsRecords` 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::RelationshipTlsDnsRecordsResponseDnsRecords`. 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/relationship_tls_dns_records_response_dns_records_data.rb b/lib/fastly/models/relationship_tls_dns_records_response_dns_records_data.rb new file mode 100644 index 00000000..f5fd046c --- /dev/null +++ b/lib/fastly/models/relationship_tls_dns_records_response_dns_records_data.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 RelationshipTlsDnsRecordsResponseDnsRecordsData + attr_accessor :type + + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'id' => :'id' + } + 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 + { + :'type' => :'TypeTlsDnsRecord', + :'id' => :'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::RelationshipTlsDnsRecordsResponseDnsRecordsData` 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::RelationshipTlsDnsRecordsResponseDnsRecordsData`. 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?(:'type') + self.type = attributes[:'type'] + else + self.type = 'dns_record' + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + 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 && + type == o.type && + id == o.id + 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 + [type, id].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/relationships_for_tls_configuration.rb b/lib/fastly/models/relationships_for_tls_configuration.rb index 96a8b0d4..e737283d 100644 --- a/lib/fastly/models/relationships_for_tls_configuration.rb +++ b/lib/fastly/models/relationships_for_tls_configuration.rb @@ -44,7 +44,7 @@ def self.fastly_nullable def self.fastly_any_of [ :'RelationshipService', - :'RelationshipTlsDnsRecords' + :'RelationshipTlsDnsRecordsResponse' ] end diff --git a/lib/fastly/models/results.rb b/lib/fastly/models/results.rb index 101230b6..76adc5cc 100644 --- a/lib/fastly/models/results.rb +++ b/lib/fastly/models/results.rb @@ -758,6 +758,9 @@ class Results # Number of \"Server Error\" codes delivered for all sources. attr_accessor :all_status_5xx + # 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`). + attr_accessor :origin_offload + attr_accessor :service_id # Timestamp for the start of the time period being reported @@ -1014,6 +1017,7 @@ def self.attribute_map :'all_status_3xx' => :'all_status_3xx', :'all_status_4xx' => :'all_status_4xx', :'all_status_5xx' => :'all_status_5xx', + :'origin_offload' => :'origin_offload', :'service_id' => :'service_id', :'start_time' => :'start_time' } @@ -1275,6 +1279,7 @@ def self.fastly_types :'all_status_3xx' => :'Integer', :'all_status_4xx' => :'Integer', :'all_status_5xx' => :'Integer', + :'origin_offload' => :'Float', :'service_id' => :'String', :'start_time' => :'Integer' } @@ -2294,6 +2299,10 @@ def initialize(attributes = {}) self.all_status_5xx = attributes[:'all_status_5xx'] end + if attributes.key?(:'origin_offload') + self.origin_offload = attributes[:'origin_offload'] + end + if attributes.key?(:'service_id') self.service_id = attributes[:'service_id'] end @@ -2569,6 +2578,7 @@ def ==(o) all_status_3xx == o.all_status_3xx && all_status_4xx == o.all_status_4xx && all_status_5xx == o.all_status_5xx && + origin_offload == o.origin_offload && service_id == o.service_id && start_time == o.start_time end @@ -2582,7 +2592,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, 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, 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, service_id, start_time].hash end # Builds the object from hash diff --git a/lib/fastly/models/serviceusagemetric.rb b/lib/fastly/models/serviceusagemetric.rb new file mode 100644 index 00000000..cc18256c --- /dev/null +++ b/lib/fastly/models/serviceusagemetric.rb @@ -0,0 +1,246 @@ +=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 Serviceusagemetric + attr_accessor :customer_id + + # Service ID associated with the usage. + attr_accessor :service_id + + # Name of the service associated with the usage. + attr_accessor :service_name + + # The quantity of the usage for the billing period. Amount will be in the units provided in the parent object (e.g., a quantity of `1.3` with a unit of `gb` would have a usage amount of 1.3 gigabytes). + attr_accessor :usage_units + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'customer_id' => :'customer_id', + :'service_id' => :'service_id', + :'service_name' => :'service_name', + :'usage_units' => :'usage_units' + } + 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' => :'String', + :'service_name' => :'String', + :'usage_units' => :'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::Serviceusagemetric` 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::Serviceusagemetric`. 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?(:'service_name') + self.service_name = attributes[:'service_name'] + end + + if attributes.key?(:'usage_units') + self.usage_units = attributes[:'usage_units'] + 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 && + service_name == o.service_name && + usage_units == o.usage_units + 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, service_name, usage_units].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/relationship_tls_dns_record.rb b/lib/fastly/models/serviceusagemetrics.rb similarity index 92% rename from lib/fastly/models/relationship_tls_dns_record.rb rename to lib/fastly/models/serviceusagemetrics.rb index 4f31c3bd..eadc3fca 100644 --- a/lib/fastly/models/relationship_tls_dns_record.rb +++ b/lib/fastly/models/serviceusagemetrics.rb @@ -12,13 +12,13 @@ require 'time' module Fastly - class RelationshipTlsDnsRecord - attr_accessor :dns_record + class Serviceusagemetrics + attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'dns_record' => :'dns_record' + :'data' => :'data' } end @@ -30,7 +30,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.fastly_types { - :'dns_record' => :'RelationshipTlsDnsRecordDnsRecord' + :'data' => :'ServiceusagemetricsData' } end @@ -44,19 +44,19 @@ def self.fastly_nullable # @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::RelationshipTlsDnsRecord` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::Serviceusagemetrics` 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::RelationshipTlsDnsRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::Serviceusagemetrics`. 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?(:'dns_record') - self.dns_record = attributes[:'dns_record'] + if attributes.key?(:'data') + self.data = attributes[:'data'] end end @@ -78,7 +78,7 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - dns_record == o.dns_record + data == o.data end # @see the `==` method @@ -90,7 +90,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [dns_record].hash + [data].hash end # Builds the object from hash diff --git a/lib/fastly/models/serviceusagemetrics_data.rb b/lib/fastly/models/serviceusagemetrics_data.rb new file mode 100644 index 00000000..264a23a7 --- /dev/null +++ b/lib/fastly/models/serviceusagemetrics_data.rb @@ -0,0 +1,276 @@ +=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 ServiceusagemetricsData + attr_accessor :customer_id + + # Date and time (in ISO 8601 format) for initiation point of a billing cycle, signifying the start of charges for a service or subscription. + attr_accessor :start_time + + # Date and time (in ISO 8601 format) for termination point of a billing cycle, signifying the end of charges for a service or subscription. + attr_accessor :end_time + + # The usage type identifier for the usage. This is a single, billable metric for the product. + attr_accessor :usage_type + + # 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 + + attr_accessor :details + + attr_accessor :meta + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'customer_id' => :'customer_id', + :'start_time' => :'start_time', + :'end_time' => :'end_time', + :'usage_type' => :'usage_type', + :'unit' => :'unit', + :'details' => :'details', + :'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 + { + :'customer_id' => :'String', + :'start_time' => :'Time', + :'end_time' => :'Time', + :'usage_type' => :'String', + :'unit' => :'String', + :'details' => :'Array', + :'meta' => :'Metadata' + } + 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::ServiceusagemetricsData` 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::ServiceusagemetricsData`. 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?(:'start_time') + self.start_time = attributes[:'start_time'] + end + + if attributes.key?(:'end_time') + self.end_time = attributes[:'end_time'] + end + + if attributes.key?(:'usage_type') + self.usage_type = attributes[:'usage_type'] + end + + if attributes.key?(:'unit') + self.unit = attributes[:'unit'] + end + + if attributes.key?(:'details') + if (value = attributes[:'details']).is_a?(Array) + self.details = 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 && + customer_id == o.customer_id && + start_time == o.start_time && + end_time == o.end_time && + usage_type == o.usage_type && + unit == o.unit && + details == o.details && + 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 + [customer_id, start_time, end_time, usage_type, unit, details, 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/serviceusagetype.rb b/lib/fastly/models/serviceusagetype.rb new file mode 100644 index 00000000..38c7de33 --- /dev/null +++ b/lib/fastly/models/serviceusagetype.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 Serviceusagetype + # The product identifier associated with the usage type. This corresponds to a Fastly product offering. + attr_accessor :product_id + + # Full name of the product usage type as it might appear on a customer's invoice. + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'product_id' => :'product_id', + :'name' => :'name' + } + 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 + { + :'product_id' => :'String', + :'name' => :'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::Serviceusagetype` 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::Serviceusagetype`. 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?(:'product_id') + self.product_id = attributes[:'product_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + 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 && + product_id == o.product_id && + name == o.name + 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 + [product_id, name].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/relationship_tls_dns_record_dns_record.rb b/lib/fastly/models/serviceusagetypes.rb similarity index 95% rename from lib/fastly/models/relationship_tls_dns_record_dns_record.rb rename to lib/fastly/models/serviceusagetypes.rb index ca35f553..fb843d82 100644 --- a/lib/fastly/models/relationship_tls_dns_record_dns_record.rb +++ b/lib/fastly/models/serviceusagetypes.rb @@ -12,7 +12,7 @@ require 'time' module Fastly - class RelationshipTlsDnsRecordDnsRecord + class Serviceusagetypes attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -30,7 +30,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.fastly_types { - :'data' => :'Array' + :'data' => :'Array' } end @@ -44,13 +44,13 @@ def self.fastly_nullable # @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::RelationshipTlsDnsRecordDnsRecord` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::Serviceusagetypes` 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::RelationshipTlsDnsRecordDnsRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::Serviceusagetypes`. 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 } diff --git a/lib/fastly/models/tls_certificate_blob_response.rb b/lib/fastly/models/tls_certificate_blob_response.rb new file mode 100644 index 00000000..b330bb65 --- /dev/null +++ b/lib/fastly/models/tls_certificate_blob_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 TlsCertificateBlobResponse + # A certificate blob + attr_accessor :cert_blob + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'cert_blob' => :'cert_blob' + } + 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 + { + :'cert_blob' => :'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::TlsCertificateBlobResponse` 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::TlsCertificateBlobResponse`. 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?(:'cert_blob') + self.cert_blob = attributes[:'cert_blob'] + 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 && + cert_blob == o.cert_blob + 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 + [cert_blob].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/tls_dns_record.rb b/lib/fastly/models/tls_dns_record.rb index 6cdff22b..cc627bee 100644 --- a/lib/fastly/models/tls_dns_record.rb +++ b/lib/fastly/models/tls_dns_record.rb @@ -13,19 +13,37 @@ module Fastly class TlsDnsRecord - # The IP address or hostname of the DNS record. - attr_accessor :id - - # Specifies the regions that will be used to route traffic. Select DNS Records with a `global` region to route traffic to the most performant point of presence (POP) worldwide (global pricing will apply). Select DNS records with a `us-eu` region to exclusively land traffic on North American and European POPs. + # Specifies the regions that will be used to route traffic. Select DNS records with a `global` region to route traffic to the most performant point of presence (POP) worldwide (global pricing will apply). Select DNS records with a `na/eu` region to exclusively land traffic on North American and European POPs. attr_accessor :region # The type of the DNS record. `A` specifies an IPv4 address to be used for an A record to be used for apex domains (e.g., `example.com`). `AAAA` specifies an IPv6 address for use in an A record for apex domains. `CNAME` specifies the hostname to be used for a CNAME record for subdomains or wildcard domains (e.g., `www.example.com` or `*.example.com`). attr_accessor :record_type + 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 { - :'id' => :'id', :'region' => :'region', :'record_type' => :'record_type' } @@ -39,7 +57,6 @@ def self.acceptable_attributes # Attribute type mapping. def self.fastly_types { - :'id' => :'String', :'region' => :'String', :'record_type' => :'String' } @@ -66,10 +83,6 @@ def initialize(attributes = {}) h[k.to_sym] = v } - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - if attributes.key?(:'region') self.region = attributes[:'region'] end @@ -89,15 +102,38 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + region_validator = EnumAttributeValidator.new('String', ["custom", "global", "na/eu"]) + return false unless region_validator.valid?(@region) + record_type_validator = EnumAttributeValidator.new('String', ["CNAME", "A", "AAAA"]) + return false unless record_type_validator.valid?(@record_type) true end + # Custom attribute writer method checking allowed values (enum). + # @param [Object] region Object to be assigned + def region=(region) + validator = EnumAttributeValidator.new('String', ["custom", "global", "na/eu"]) + unless validator.valid?(region) + fail ArgumentError, "invalid value for \"region\", must be one of #{validator.allowable_values}." + end + @region = region + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] record_type Object to be assigned + def record_type=(record_type) + validator = EnumAttributeValidator.new('String', ["CNAME", "A", "AAAA"]) + unless validator.valid?(record_type) + fail ArgumentError, "invalid value for \"record_type\", must be one of #{validator.allowable_values}." + end + @record_type = record_type + 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 && - id == o.id && region == o.region && record_type == o.record_type end @@ -111,7 +147,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, region, record_type].hash + [region, record_type].hash end # Builds the object from hash diff --git a/lib/fastly/models/update_dashboard_request.rb b/lib/fastly/models/update_dashboard_request.rb new file mode 100644 index 00000000..5ec13718 --- /dev/null +++ b/lib/fastly/models/update_dashboard_request.rb @@ -0,0 +1,240 @@ +=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 UpdateDashboardRequest + # A human-readable name + attr_accessor :name + + # A short description of the dashboard + attr_accessor :description + + # A list of [dashboard items](#dashboard-item). + attr_accessor :items + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'description' => :'description', + :'items' => :'items' + } + 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', + :'description' => :'String', + :'items' => :'Array' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + :'items' + ]) + 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::UpdateDashboardRequest` 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::UpdateDashboardRequest`. 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?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'items') + if (value = attributes[:'items']).is_a?(Array) + self.items = 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 && + name == o.name && + description == o.description && + items == o.items + 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, description, items].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.rb b/lib/fastly/models/values.rb index 390a8368..478e5bd0 100644 --- a/lib/fastly/models/values.rb +++ b/lib/fastly/models/values.rb @@ -128,7 +128,7 @@ class Values # Ratio of cache hits to cache misses at the edge, between 0 and 1 (`edge_hit_requests` / (`edge_hit_requests` + `edge_miss_requests`)). attr_accessor :edge_hit_ratio - # Ratio of response bytes delivered from the edge compared to what is delivered from origin, 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`). + # 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`). Previously, Origin Offload used a different formula. [Learn more](https://www.fastly.com/documentation/reference/changes/2024/06/add-origin_offload-metric). attr_accessor :origin_offload # Number of responses received from origin with status code 200 (Success). diff --git a/lib/fastly/version.rb b/lib/fastly/version.rb index 0b575aa0..ecda697a 100644 --- a/lib/fastly/version.rb +++ b/lib/fastly/version.rb @@ -9,5 +9,5 @@ =end module Fastly - VERSION = '8.5.0' + VERSION = '8.6.0' end diff --git a/sig.json b/sig.json index 66147743..713aa7d4 100644 --- a/sig.json +++ b/sig.json @@ -1 +1 @@ -{"G": "5a2ccc65", "D": "f9e684d4"} +{"G": "01161630", "D": "e05af2db"}