fastly 13.0.0 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +43 -0
- data/Gemfile.lock +4 -4
- data/README.md +21 -6
- data/docs/AttackReport.md +19 -0
- data/docs/AttackSignal.md +12 -0
- data/docs/AttackSource.md +13 -0
- data/docs/Backend.md +6 -6
- data/docs/BackendApi.md +18 -18
- data/docs/BackendResponse.md +6 -6
- data/docs/DdosProtectionApi.md +40 -0
- data/docs/DdosProtectionAttributeStats.md +1 -1
- data/docs/DdosProtectionInvalidRequest.md +13 -0
- data/docs/DdosProtectionNotAuthorized.md +11 -0
- data/docs/DdosProtectionRule.md +1 -1
- data/docs/DdosProtectionRuleAllOf.md +1 -1
- data/docs/DdosProtectionRulePatch.md +10 -0
- data/docs/HistoricalApi.md +2 -0
- data/docs/Invitation.md +1 -1
- data/docs/InvitationCreateData.md +12 -0
- data/docs/InvitationCreateDataAllOf.md +10 -0
- data/docs/{InvitationResponse.md → InvitationCreateResponse.md} +1 -1
- data/docs/{InvitationResponseAllOf.md → InvitationCreateResponseAllOf.md} +1 -1
- data/docs/InvitationData.md +0 -1
- data/docs/InvitationResponseData.md +1 -1
- data/docs/InvitationsApi.md +2 -2
- data/docs/KvStoreApi.md +2 -0
- data/docs/ListAttackReport.md +11 -0
- data/docs/{DdosProtectionTrafficAttribute.md → ListAttackReportMeta.md} +2 -1
- data/docs/{DdosProtectionAction.md → ListSignalReport.md} +2 -1
- data/docs/LogExplorerApi.md +1 -1
- data/docs/LoggingAzureblobApi.md +8 -4
- data/docs/LoggingAzureblobResponse.md +2 -1
- data/docs/LoggingBigqueryAdditional.md +1 -1
- data/docs/LoggingBigqueryApi.md +8 -4
- data/docs/LoggingBigqueryResponse.md +2 -1
- data/docs/LoggingCloudfilesApi.md +8 -4
- data/docs/LoggingCloudfilesResponse.md +2 -1
- data/docs/LoggingCommon.md +2 -1
- data/docs/LoggingCommonResponse.md +2 -1
- data/docs/LoggingCommonResponseAllOf.md +2 -1
- data/docs/LoggingDatadogAdditional.md +1 -1
- data/docs/LoggingDatadogApi.md +8 -4
- data/docs/LoggingDatadogResponse.md +2 -1
- data/docs/LoggingDigitaloceanApi.md +8 -4
- data/docs/LoggingDigitaloceanResponse.md +2 -1
- data/docs/LoggingElasticsearchAdditional.md +1 -1
- data/docs/LoggingElasticsearchApi.md +8 -4
- data/docs/LoggingElasticsearchResponse.md +2 -1
- data/docs/LoggingFtpApi.md +8 -4
- data/docs/LoggingFtpResponse.md +2 -1
- data/docs/LoggingGcsApi.md +8 -4
- data/docs/LoggingGcsResponse.md +2 -1
- data/docs/LoggingGooglePubsubAdditional.md +1 -1
- data/docs/LoggingGooglePubsubResponse.md +2 -1
- data/docs/LoggingGrafanacloudlogsAdditional.md +1 -1
- data/docs/LoggingGrafanacloudlogsApi.md +8 -4
- data/docs/LoggingGrafanacloudlogsResponse.md +2 -1
- data/docs/LoggingHerokuApi.md +8 -4
- data/docs/LoggingHerokuResponse.md +2 -1
- data/docs/LoggingHoneycombAdditional.md +1 -1
- data/docs/LoggingHoneycombApi.md +8 -4
- data/docs/LoggingHoneycombResponse.md +2 -1
- data/docs/LoggingHttpsAdditional.md +1 -1
- data/docs/LoggingHttpsApi.md +8 -4
- data/docs/LoggingHttpsResponse.md +2 -1
- data/docs/LoggingKafkaApi.md +4 -2
- data/docs/LoggingKafkaResponse.md +2 -1
- data/docs/LoggingKafkaResponsePost.md +2 -1
- data/docs/LoggingKinesisAdditional.md +1 -1
- data/docs/LoggingKinesisApi.md +2 -2
- data/docs/LoggingKinesisResponse.md +1 -1
- data/docs/LoggingLogentriesApi.md +8 -4
- data/docs/LoggingLogentriesResponse.md +2 -1
- data/docs/LoggingLogglyApi.md +8 -4
- data/docs/LoggingLogglyResponse.md +2 -1
- data/docs/LoggingLogshuttleApi.md +8 -4
- data/docs/LoggingLogshuttleResponse.md +2 -1
- data/docs/LoggingNewrelicAdditional.md +1 -1
- data/docs/LoggingNewrelicApi.md +8 -4
- data/docs/LoggingNewrelicResponse.md +2 -1
- data/docs/LoggingNewrelicotlpAdditional.md +1 -1
- data/docs/LoggingNewrelicotlpApi.md +8 -4
- data/docs/LoggingNewrelicotlpResponse.md +2 -1
- data/docs/LoggingOpenstackApi.md +8 -4
- data/docs/LoggingOpenstackResponse.md +2 -1
- data/docs/LoggingPapertrailApi.md +8 -4
- data/docs/LoggingPapertrailResponse.md +2 -1
- data/docs/LoggingPubsubApi.md +8 -4
- data/docs/LoggingS3Api.md +8 -4
- data/docs/LoggingS3Response.md +2 -1
- data/docs/LoggingScalyrApi.md +8 -4
- data/docs/LoggingScalyrResponse.md +2 -1
- data/docs/LoggingSftpApi.md +8 -4
- data/docs/LoggingSftpResponse.md +2 -1
- data/docs/LoggingSplunkApi.md +8 -4
- data/docs/LoggingSplunkResponse.md +2 -1
- data/docs/LoggingSumologicApi.md +8 -4
- data/docs/LoggingSumologicResponse.md +2 -1
- data/docs/LoggingSyslogApi.md +8 -4
- data/docs/LoggingSyslogResponse.md +2 -1
- data/docs/NgwafReportsApi.md +99 -0
- data/docs/ObservabilityTimeseriesApi.md +67 -0
- data/docs/PoolAdditional.md +1 -1
- data/docs/PoolApi.md +8 -8
- data/docs/PoolResponse.md +2 -2
- data/docs/PoolResponseCommon.md +1 -1
- data/docs/PoolResponsePost.md +2 -2
- data/docs/PurgeApi.md +1 -1
- data/docs/SignalReport.md +13 -0
- data/docs/TimeseriesGetResponse.md +11 -0
- data/docs/TimeseriesMeta.md +13 -0
- data/docs/TimeseriesResult.md +11 -0
- data/docs/TlsCertificateDataAttributes.md +1 -0
- data/docs/TlsCsrData.md +0 -1
- data/docs/TlsCsrDataAttributes.md +1 -0
- data/docs/TlsSubscriptionsApi.md +0 -2
- data/docs/TopWorkspace.md +12 -0
- data/lib/fastly/api/backend_api.rb +24 -24
- data/lib/fastly/api/ddos_protection_api.rb +70 -0
- data/lib/fastly/api/historical_api.rb +3 -0
- data/lib/fastly/api/invitations_api.rb +3 -3
- data/lib/fastly/api/kv_store_api.rb +3 -0
- data/lib/fastly/api/logging_azureblob_api.rb +18 -4
- data/lib/fastly/api/logging_bigquery_api.rb +18 -4
- data/lib/fastly/api/logging_cloudfiles_api.rb +18 -4
- data/lib/fastly/api/logging_datadog_api.rb +18 -4
- data/lib/fastly/api/logging_digitalocean_api.rb +18 -4
- data/lib/fastly/api/logging_elasticsearch_api.rb +18 -4
- data/lib/fastly/api/logging_ftp_api.rb +18 -4
- data/lib/fastly/api/logging_gcs_api.rb +18 -4
- data/lib/fastly/api/logging_grafanacloudlogs_api.rb +18 -4
- data/lib/fastly/api/logging_heroku_api.rb +18 -4
- data/lib/fastly/api/logging_honeycomb_api.rb +18 -4
- data/lib/fastly/api/logging_https_api.rb +18 -4
- data/lib/fastly/api/logging_kafka_api.rb +9 -2
- data/lib/fastly/api/logging_kinesis_api.rb +2 -2
- data/lib/fastly/api/logging_logentries_api.rb +18 -4
- data/lib/fastly/api/logging_loggly_api.rb +18 -4
- data/lib/fastly/api/logging_logshuttle_api.rb +18 -4
- data/lib/fastly/api/logging_newrelic_api.rb +18 -4
- data/lib/fastly/api/logging_newrelicotlp_api.rb +18 -4
- data/lib/fastly/api/logging_openstack_api.rb +18 -4
- data/lib/fastly/api/logging_papertrail_api.rb +18 -4
- data/lib/fastly/api/logging_pubsub_api.rb +18 -4
- data/lib/fastly/api/logging_s3_api.rb +18 -4
- data/lib/fastly/api/logging_scalyr_api.rb +18 -4
- data/lib/fastly/api/logging_sftp_api.rb +18 -4
- data/lib/fastly/api/logging_splunk_api.rb +18 -4
- data/lib/fastly/api/logging_sumologic_api.rb +18 -4
- data/lib/fastly/api/logging_syslog_api.rb +18 -4
- data/lib/fastly/api/ngwaf_reports_api.rb +161 -0
- data/lib/fastly/api/{observability_timeseries_for_logs_api.rb → observability_timeseries_api.rb} +38 -43
- data/lib/fastly/api/pool_api.rb +8 -8
- data/lib/fastly/api/purge_api.rb +2 -2
- data/lib/fastly/api/tls_subscriptions_api.rb +0 -3
- data/lib/fastly/configuration.rb +19 -1
- data/lib/fastly/models/attack_report.rb +359 -0
- data/lib/fastly/models/attack_signal.rb +252 -0
- data/lib/fastly/models/attack_source.rb +267 -0
- data/lib/fastly/models/backend.rb +9 -4
- data/lib/fastly/models/backend_response.rb +9 -4
- data/lib/fastly/models/ddos_protection_attribute_stats.rb +2 -1
- data/lib/fastly/models/ddos_protection_invalid_request.rb +309 -0
- data/lib/fastly/models/{log_timeseries_filter_field_item.rb → ddos_protection_not_authorized.rb} +24 -36
- data/lib/fastly/models/ddos_protection_rule.rb +2 -1
- data/lib/fastly/models/ddos_protection_rule_all_of.rb +2 -1
- data/lib/fastly/models/{log_timeseries_get_response_meta_filters.rb → ddos_protection_rule_patch.rb} +13 -14
- data/lib/fastly/models/invitation.rb +1 -1
- data/lib/fastly/models/invitation_create_data.rb +244 -0
- data/lib/fastly/models/invitation_create_data_all_of.rb +216 -0
- data/lib/fastly/models/{invitation_response.rb → invitation_create_response.rb} +4 -4
- data/lib/fastly/models/{invitation_response_all_of.rb → invitation_create_response_all_of.rb} +3 -3
- data/lib/fastly/models/invitation_data.rb +4 -13
- data/lib/fastly/models/invitation_response_data.rb +13 -13
- data/lib/fastly/models/{log_timeseries_get_response.rb → list_attack_report.rb} +5 -5
- data/lib/fastly/models/list_attack_report_meta.rb +218 -0
- data/lib/fastly/models/{log_timeseries_result_dimensions.rb → list_signal_report.rb} +12 -10
- data/lib/fastly/models/logging_azureblob_response.rb +26 -2
- data/lib/fastly/models/logging_bigquery_additional.rb +1 -1
- data/lib/fastly/models/logging_bigquery_response.rb +26 -2
- data/lib/fastly/models/logging_cloudfiles_response.rb +26 -2
- data/lib/fastly/models/logging_common.rb +29 -5
- data/lib/fastly/models/logging_common_response.rb +26 -2
- data/lib/fastly/models/logging_common_response_all_of.rb +29 -5
- data/lib/fastly/models/logging_datadog_additional.rb +1 -1
- data/lib/fastly/models/logging_datadog_response.rb +26 -2
- data/lib/fastly/models/logging_digitalocean_response.rb +26 -2
- data/lib/fastly/models/logging_elasticsearch_additional.rb +1 -1
- data/lib/fastly/models/logging_elasticsearch_response.rb +26 -2
- data/lib/fastly/models/logging_ftp_response.rb +26 -2
- data/lib/fastly/models/logging_gcs_response.rb +26 -2
- data/lib/fastly/models/logging_google_pubsub_additional.rb +1 -1
- data/lib/fastly/models/logging_google_pubsub_response.rb +26 -2
- data/lib/fastly/models/logging_grafanacloudlogs_additional.rb +1 -1
- data/lib/fastly/models/logging_grafanacloudlogs_response.rb +26 -2
- data/lib/fastly/models/logging_heroku_response.rb +26 -2
- data/lib/fastly/models/logging_honeycomb_additional.rb +1 -1
- data/lib/fastly/models/logging_honeycomb_response.rb +26 -2
- data/lib/fastly/models/logging_https_additional.rb +1 -1
- data/lib/fastly/models/logging_https_response.rb +26 -2
- data/lib/fastly/models/logging_kafka_response.rb +26 -2
- data/lib/fastly/models/logging_kafka_response_post.rb +26 -2
- data/lib/fastly/models/logging_kinesis_additional.rb +1 -1
- data/lib/fastly/models/logging_kinesis_response.rb +1 -1
- data/lib/fastly/models/logging_logentries_response.rb +26 -2
- data/lib/fastly/models/logging_loggly_response.rb +26 -2
- data/lib/fastly/models/logging_logshuttle_response.rb +26 -2
- data/lib/fastly/models/logging_newrelic_additional.rb +1 -1
- data/lib/fastly/models/logging_newrelic_response.rb +26 -2
- data/lib/fastly/models/logging_newrelicotlp_additional.rb +1 -1
- data/lib/fastly/models/logging_newrelicotlp_response.rb +26 -2
- data/lib/fastly/models/logging_openstack_response.rb +26 -2
- data/lib/fastly/models/logging_papertrail_response.rb +26 -2
- data/lib/fastly/models/logging_s3_response.rb +26 -2
- data/lib/fastly/models/logging_scalyr_response.rb +26 -2
- data/lib/fastly/models/logging_sftp_response.rb +26 -2
- data/lib/fastly/models/logging_splunk_response.rb +26 -2
- data/lib/fastly/models/logging_sumologic_response.rb +26 -2
- data/lib/fastly/models/logging_syslog_response.rb +26 -2
- data/lib/fastly/models/pool_additional.rb +1 -1
- data/lib/fastly/models/pool_response.rb +2 -2
- data/lib/fastly/models/pool_response_common.rb +1 -1
- data/lib/fastly/models/pool_response_post.rb +2 -2
- data/lib/fastly/models/relationship_service_invitations.rb +1 -0
- data/lib/fastly/models/relationship_service_invitations_service_invitations.rb +1 -0
- data/lib/fastly/models/relationships_for_invitation.rb +1 -0
- data/lib/fastly/models/signal_report.rb +249 -0
- data/lib/fastly/models/timeseries_get_response.rb +227 -0
- data/lib/fastly/models/{log_timeseries_get_response_meta.rb → timeseries_meta.rb} +23 -32
- data/lib/fastly/models/{log_timeseries_result.rb → timeseries_result.rb} +9 -5
- data/lib/fastly/models/tls_certificate_data_attributes.rb +14 -4
- data/lib/fastly/models/tls_csr_data.rb +4 -13
- data/lib/fastly/models/tls_csr_data_attributes.rb +14 -4
- data/lib/fastly/models/top_workspace.rb +238 -0
- data/lib/fastly/version.rb +1 -1
- data/lib/fastly.rb +20 -12
- data/sig.json +1 -1
- metadata +42 -26
- data/docs/LogTimeseriesFilterFieldItem.md +0 -12
- data/docs/LogTimeseriesGetResponse.md +0 -11
- data/docs/LogTimeseriesGetResponseMeta.md +0 -14
- data/docs/LogTimeseriesGetResponseMetaFilters.md +0 -10
- data/docs/LogTimeseriesResult.md +0 -11
- data/docs/LogTimeseriesResultDimensions.md +0 -10
- data/docs/LogTimeseriesValueField.md +0 -59
- data/docs/ObservabilityTimeseriesForLogsApi.md +0 -67
- data/lib/fastly/models/ddos_protection_action.rb +0 -37
- data/lib/fastly/models/ddos_protection_traffic_attribute.rb +0 -40
- data/lib/fastly/models/log_timeseries_value_field.rb +0 -108
@@ -0,0 +1,267 @@
|
|
1
|
+
=begin
|
2
|
+
#Fastly API
|
3
|
+
|
4
|
+
#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/)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: oss@fastly.com
|
8
|
+
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'date'
|
12
|
+
require 'time'
|
13
|
+
|
14
|
+
module Fastly
|
15
|
+
class AttackSource
|
16
|
+
# Country code of the attack source
|
17
|
+
attr_accessor :country_code
|
18
|
+
|
19
|
+
# Name of the country
|
20
|
+
attr_accessor :country_name
|
21
|
+
|
22
|
+
# Number of requests from this country
|
23
|
+
attr_accessor :request_count
|
24
|
+
|
25
|
+
# Total number of attacks considered
|
26
|
+
attr_accessor :total_count
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'country_code' => :'country_code',
|
32
|
+
:'country_name' => :'country_name',
|
33
|
+
:'request_count' => :'request_count',
|
34
|
+
:'total_count' => :'total_count'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Returns all the JSON keys this model knows about
|
39
|
+
def self.acceptable_attributes
|
40
|
+
attribute_map.values
|
41
|
+
end
|
42
|
+
|
43
|
+
# Attribute type mapping.
|
44
|
+
def self.fastly_types
|
45
|
+
{
|
46
|
+
:'country_code' => :'String',
|
47
|
+
:'country_name' => :'String',
|
48
|
+
:'request_count' => :'Integer',
|
49
|
+
:'total_count' => :'Integer'
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# List of attributes with nullable: true
|
54
|
+
def self.fastly_nullable
|
55
|
+
Set.new([
|
56
|
+
])
|
57
|
+
end
|
58
|
+
|
59
|
+
# Initializes the object
|
60
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
61
|
+
def initialize(attributes = {})
|
62
|
+
if (!attributes.is_a?(Hash))
|
63
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::AttackSource` initialize method"
|
64
|
+
end
|
65
|
+
|
66
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
67
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
68
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
69
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::AttackSource`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
70
|
+
end
|
71
|
+
h[k.to_sym] = v
|
72
|
+
}
|
73
|
+
|
74
|
+
if attributes.key?(:'country_code')
|
75
|
+
self.country_code = attributes[:'country_code']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'country_name')
|
79
|
+
self.country_name = attributes[:'country_name']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.key?(:'request_count')
|
83
|
+
self.request_count = attributes[:'request_count']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.key?(:'total_count')
|
87
|
+
self.total_count = attributes[:'total_count']
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
92
|
+
# @return Array for valid properties with the reasons
|
93
|
+
def list_invalid_properties
|
94
|
+
invalid_properties = Array.new
|
95
|
+
if @country_code.nil?
|
96
|
+
invalid_properties.push('invalid value for "country_code", country_code cannot be nil.')
|
97
|
+
end
|
98
|
+
|
99
|
+
if @country_name.nil?
|
100
|
+
invalid_properties.push('invalid value for "country_name", country_name cannot be nil.')
|
101
|
+
end
|
102
|
+
|
103
|
+
if @request_count.nil?
|
104
|
+
invalid_properties.push('invalid value for "request_count", request_count cannot be nil.')
|
105
|
+
end
|
106
|
+
|
107
|
+
if @total_count.nil?
|
108
|
+
invalid_properties.push('invalid value for "total_count", total_count cannot be nil.')
|
109
|
+
end
|
110
|
+
|
111
|
+
invalid_properties
|
112
|
+
end
|
113
|
+
|
114
|
+
# Check to see if the all the properties in the model are valid
|
115
|
+
# @return true if the model is valid
|
116
|
+
def valid?
|
117
|
+
return false if @country_code.nil?
|
118
|
+
return false if @country_name.nil?
|
119
|
+
return false if @request_count.nil?
|
120
|
+
return false if @total_count.nil?
|
121
|
+
true
|
122
|
+
end
|
123
|
+
|
124
|
+
# Checks equality by comparing each attribute.
|
125
|
+
# @param [Object] Object to be compared
|
126
|
+
def ==(o)
|
127
|
+
return true if self.equal?(o)
|
128
|
+
self.class == o.class &&
|
129
|
+
country_code == o.country_code &&
|
130
|
+
country_name == o.country_name &&
|
131
|
+
request_count == o.request_count &&
|
132
|
+
total_count == o.total_count
|
133
|
+
end
|
134
|
+
|
135
|
+
# @see the `==` method
|
136
|
+
# @param [Object] Object to be compared
|
137
|
+
def eql?(o)
|
138
|
+
self == o
|
139
|
+
end
|
140
|
+
|
141
|
+
# Calculates hash code according to all attributes.
|
142
|
+
# @return [Integer] Hash code
|
143
|
+
def hash
|
144
|
+
[country_code, country_name, request_count, total_count].hash
|
145
|
+
end
|
146
|
+
|
147
|
+
# Builds the object from hash
|
148
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
149
|
+
# @return [Object] Returns the model itself
|
150
|
+
def self.build_from_hash(attributes)
|
151
|
+
new.build_from_hash(attributes)
|
152
|
+
end
|
153
|
+
|
154
|
+
# Builds the object from hash
|
155
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
156
|
+
# @return [Object] Returns the model itself
|
157
|
+
def build_from_hash(attributes)
|
158
|
+
return nil unless attributes.is_a?(Hash)
|
159
|
+
self.class.fastly_types.each_pair do |key, type|
|
160
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
|
161
|
+
self.send("#{key}=", nil)
|
162
|
+
elsif type =~ /\AArray<(.*)>/i
|
163
|
+
# check to ensure the input is an array given that the attribute
|
164
|
+
# is documented as an array but the input is not
|
165
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
166
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
167
|
+
end
|
168
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
169
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
self
|
174
|
+
end
|
175
|
+
|
176
|
+
# Deserializes the data based on type
|
177
|
+
# @param string type Data type
|
178
|
+
# @param string value Value to be deserialized
|
179
|
+
# @return [Object] Deserialized data
|
180
|
+
def _deserialize(type, value)
|
181
|
+
case type.to_sym
|
182
|
+
when :Time
|
183
|
+
Time.parse(value)
|
184
|
+
when :Date
|
185
|
+
Date.parse(value)
|
186
|
+
when :String
|
187
|
+
value.to_s
|
188
|
+
when :Integer
|
189
|
+
value.to_i
|
190
|
+
when :Float
|
191
|
+
value.to_f
|
192
|
+
when :Boolean
|
193
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
194
|
+
true
|
195
|
+
else
|
196
|
+
false
|
197
|
+
end
|
198
|
+
when :Object
|
199
|
+
# generic object (usually a Hash), return directly
|
200
|
+
value
|
201
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
202
|
+
inner_type = Regexp.last_match[:inner_type]
|
203
|
+
value.map { |v| _deserialize(inner_type, v) }
|
204
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
205
|
+
k_type = Regexp.last_match[:k_type]
|
206
|
+
v_type = Regexp.last_match[:v_type]
|
207
|
+
{}.tap do |hash|
|
208
|
+
value.each do |k, v|
|
209
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
else # model
|
213
|
+
# models (e.g. Pet) or oneOf
|
214
|
+
klass = Fastly.const_get(type)
|
215
|
+
klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
# Returns the string representation of the object
|
220
|
+
# @return [String] String presentation of the object
|
221
|
+
def to_s
|
222
|
+
to_hash.to_s
|
223
|
+
end
|
224
|
+
|
225
|
+
# to_body is an alias to to_hash (backward compatibility)
|
226
|
+
# @return [Hash] Returns the object in the form of hash
|
227
|
+
def to_body
|
228
|
+
to_hash
|
229
|
+
end
|
230
|
+
|
231
|
+
# Returns the object in the form of hash
|
232
|
+
# @return [Hash] Returns the object in the form of hash
|
233
|
+
def to_hash
|
234
|
+
hash = {}
|
235
|
+
self.class.attribute_map.each_pair do |attr, param|
|
236
|
+
value = self.send(attr)
|
237
|
+
if value.nil?
|
238
|
+
is_nullable = self.class.fastly_nullable.include?(attr)
|
239
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
240
|
+
end
|
241
|
+
|
242
|
+
hash[param] = _to_hash(value)
|
243
|
+
end
|
244
|
+
hash
|
245
|
+
end
|
246
|
+
|
247
|
+
# Outputs non-array value in the form of hash
|
248
|
+
# For object, use to_hash. Otherwise, just return the value
|
249
|
+
# @param [Object] value Any valid value
|
250
|
+
# @return [Hash] Returns the value in the form of hash
|
251
|
+
def _to_hash(value)
|
252
|
+
if value.is_a?(Array)
|
253
|
+
value.compact.map { |v| _to_hash(v) }
|
254
|
+
elsif value.is_a?(Hash)
|
255
|
+
{}.tap do |hash|
|
256
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
257
|
+
end
|
258
|
+
elsif value.respond_to? :to_hash
|
259
|
+
value.to_hash
|
260
|
+
else
|
261
|
+
value
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
end
|
266
|
+
|
267
|
+
end
|
@@ -19,7 +19,7 @@ module Fastly
|
|
19
19
|
# Whether or not this backend should be automatically load balanced. If true, all backends with this setting that don't have a `request_condition` will be selected based on their `weight`.
|
20
20
|
attr_accessor :auto_loadbalance
|
21
21
|
|
22
|
-
# Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using `bereq.between_bytes_timeout`.
|
22
|
+
# Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, for Delivery services, the response received so far will be considered complete and the fetch will end. For Compute services, timeout expiration is treated as a failure of the backend connection, and an error is generated. May be set at runtime using `bereq.between_bytes_timeout`.
|
23
23
|
attr_accessor :between_bytes_timeout
|
24
24
|
|
25
25
|
# Unused.
|
@@ -67,7 +67,7 @@ module Fastly
|
|
67
67
|
# Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request.
|
68
68
|
attr_accessor :port
|
69
69
|
|
70
|
-
# Prefer IPv6 connections to origins for hostname backends.
|
70
|
+
# Prefer IPv6 connections to origins for hostname backends. Default is 'false' for Delivery services and 'true' for Compute services.
|
71
71
|
attr_accessor :prefer_ipv6
|
72
72
|
|
73
73
|
# Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests.
|
@@ -76,7 +76,7 @@ module Fastly
|
|
76
76
|
# Value that when shared across backends will enable those backends to share the same health check.
|
77
77
|
attr_accessor :share_key
|
78
78
|
|
79
|
-
# Identifier of the POP to use as a [shield](https://
|
79
|
+
# Identifier of the POP to use as a [shield](https://www.fastly.com/documentation/guides/getting-started/hosts/shielding/).
|
80
80
|
attr_accessor :shield
|
81
81
|
|
82
82
|
# CA certificate attached to origin.
|
@@ -223,7 +223,6 @@ module Fastly
|
|
223
223
|
:'max_tls_version',
|
224
224
|
:'min_tls_version',
|
225
225
|
:'override_host',
|
226
|
-
:'prefer_ipv6',
|
227
226
|
:'share_key',
|
228
227
|
:'shield',
|
229
228
|
:'ssl_ca_cert',
|
@@ -384,14 +383,20 @@ module Fastly
|
|
384
383
|
|
385
384
|
if attributes.key?(:'tcp_keepalive_interval')
|
386
385
|
self.tcp_keepalive_interval = attributes[:'tcp_keepalive_interval']
|
386
|
+
else
|
387
|
+
self.tcp_keepalive_interval = 10
|
387
388
|
end
|
388
389
|
|
389
390
|
if attributes.key?(:'tcp_keepalive_probes')
|
390
391
|
self.tcp_keepalive_probes = attributes[:'tcp_keepalive_probes']
|
392
|
+
else
|
393
|
+
self.tcp_keepalive_probes = 3
|
391
394
|
end
|
392
395
|
|
393
396
|
if attributes.key?(:'tcp_keepalive_time')
|
394
397
|
self.tcp_keepalive_time = attributes[:'tcp_keepalive_time']
|
398
|
+
else
|
399
|
+
self.tcp_keepalive_time = 300
|
395
400
|
end
|
396
401
|
|
397
402
|
if attributes.key?(:'use_ssl')
|
@@ -19,7 +19,7 @@ module Fastly
|
|
19
19
|
# Whether or not this backend should be automatically load balanced. If true, all backends with this setting that don't have a `request_condition` will be selected based on their `weight`.
|
20
20
|
attr_accessor :auto_loadbalance
|
21
21
|
|
22
|
-
# Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, the response received so far will be considered complete and the fetch will end. May be set at runtime using `bereq.between_bytes_timeout`.
|
22
|
+
# Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend. If exceeded, for Delivery services, the response received so far will be considered complete and the fetch will end. For Compute services, timeout expiration is treated as a failure of the backend connection, and an error is generated. May be set at runtime using `bereq.between_bytes_timeout`.
|
23
23
|
attr_accessor :between_bytes_timeout
|
24
24
|
|
25
25
|
# Unused.
|
@@ -67,7 +67,7 @@ module Fastly
|
|
67
67
|
# Port on which the backend server is listening for connections from Fastly. Setting `port` to 80 or 443 will also set `use_ssl` automatically (to false and true respectively), unless explicitly overridden by setting `use_ssl` in the same request.
|
68
68
|
attr_accessor :port
|
69
69
|
|
70
|
-
# Prefer IPv6 connections to origins for hostname backends.
|
70
|
+
# Prefer IPv6 connections to origins for hostname backends. Default is 'false' for Delivery services and 'true' for Compute services.
|
71
71
|
attr_accessor :prefer_ipv6
|
72
72
|
|
73
73
|
# Name of a Condition, which if satisfied, will select this backend during a request. If set, will override any `auto_loadbalance` setting. By default, the first backend added to a service is selected for all requests.
|
@@ -76,7 +76,7 @@ module Fastly
|
|
76
76
|
# Value that when shared across backends will enable those backends to share the same health check.
|
77
77
|
attr_accessor :share_key
|
78
78
|
|
79
|
-
# Identifier of the POP to use as a [shield](https://
|
79
|
+
# Identifier of the POP to use as a [shield](https://www.fastly.com/documentation/guides/getting-started/hosts/shielding/).
|
80
80
|
attr_accessor :shield
|
81
81
|
|
82
82
|
# CA certificate attached to origin.
|
@@ -251,7 +251,6 @@ module Fastly
|
|
251
251
|
:'max_tls_version',
|
252
252
|
:'min_tls_version',
|
253
253
|
:'override_host',
|
254
|
-
:'prefer_ipv6',
|
255
254
|
:'share_key',
|
256
255
|
:'shield',
|
257
256
|
:'ssl_ca_cert',
|
@@ -425,14 +424,20 @@ module Fastly
|
|
425
424
|
|
426
425
|
if attributes.key?(:'tcp_keepalive_interval')
|
427
426
|
self.tcp_keepalive_interval = attributes[:'tcp_keepalive_interval']
|
427
|
+
else
|
428
|
+
self.tcp_keepalive_interval = 10
|
428
429
|
end
|
429
430
|
|
430
431
|
if attributes.key?(:'tcp_keepalive_probes')
|
431
432
|
self.tcp_keepalive_probes = attributes[:'tcp_keepalive_probes']
|
433
|
+
else
|
434
|
+
self.tcp_keepalive_probes = 3
|
432
435
|
end
|
433
436
|
|
434
437
|
if attributes.key?(:'tcp_keepalive_time')
|
435
438
|
self.tcp_keepalive_time = attributes[:'tcp_keepalive_time']
|
439
|
+
else
|
440
|
+
self.tcp_keepalive_time = 300
|
436
441
|
end
|
437
442
|
|
438
443
|
if attributes.key?(:'use_ssl')
|
@@ -13,6 +13,7 @@ require 'time'
|
|
13
13
|
|
14
14
|
module Fastly
|
15
15
|
class DdosProtectionAttributeStats
|
16
|
+
# Name of an attribute type used in traffic stats. Currently, supported values are source_ip, country_code, host, asn, source_ip_prefix, user_agent, method_path.
|
16
17
|
attr_accessor :name
|
17
18
|
|
18
19
|
# Values for traffic attribute.
|
@@ -34,7 +35,7 @@ module Fastly
|
|
34
35
|
# Attribute type mapping.
|
35
36
|
def self.fastly_types
|
36
37
|
{
|
37
|
-
:'name' => :'
|
38
|
+
:'name' => :'String',
|
38
39
|
:'values' => :'Array<DdosProtectionAttributeValue>'
|
39
40
|
}
|
40
41
|
end
|
@@ -0,0 +1,309 @@
|
|
1
|
+
=begin
|
2
|
+
#Fastly API
|
3
|
+
|
4
|
+
#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/)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: oss@fastly.com
|
8
|
+
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'date'
|
12
|
+
require 'time'
|
13
|
+
|
14
|
+
module Fastly
|
15
|
+
class DdosProtectionInvalidRequest
|
16
|
+
attr_accessor :title
|
17
|
+
|
18
|
+
attr_accessor :status
|
19
|
+
|
20
|
+
attr_accessor :detail
|
21
|
+
|
22
|
+
attr_accessor :errors
|
23
|
+
|
24
|
+
class EnumAttributeValidator
|
25
|
+
attr_reader :datatype
|
26
|
+
attr_reader :allowable_values
|
27
|
+
|
28
|
+
def initialize(datatype, allowable_values)
|
29
|
+
@allowable_values = allowable_values.map do |value|
|
30
|
+
case datatype.to_s
|
31
|
+
when /Integer/i
|
32
|
+
value.to_i
|
33
|
+
when /Float/i
|
34
|
+
value.to_f
|
35
|
+
else
|
36
|
+
value
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def valid?(value)
|
42
|
+
!value || allowable_values.include?(value)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
47
|
+
def self.attribute_map
|
48
|
+
{
|
49
|
+
:'title' => :'title',
|
50
|
+
:'status' => :'status',
|
51
|
+
:'detail' => :'detail',
|
52
|
+
:'errors' => :'errors'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Returns all the JSON keys this model knows about
|
57
|
+
def self.acceptable_attributes
|
58
|
+
attribute_map.values
|
59
|
+
end
|
60
|
+
|
61
|
+
# Attribute type mapping.
|
62
|
+
def self.fastly_types
|
63
|
+
{
|
64
|
+
:'title' => :'String',
|
65
|
+
:'status' => :'Integer',
|
66
|
+
:'detail' => :'String',
|
67
|
+
:'errors' => :'Array<DdosProtectionErrorErrors>'
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
# List of attributes with nullable: true
|
72
|
+
def self.fastly_nullable
|
73
|
+
Set.new([
|
74
|
+
])
|
75
|
+
end
|
76
|
+
|
77
|
+
# Initializes the object
|
78
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
79
|
+
def initialize(attributes = {})
|
80
|
+
if (!attributes.is_a?(Hash))
|
81
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::DdosProtectionInvalidRequest` initialize method"
|
82
|
+
end
|
83
|
+
|
84
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
85
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
86
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
87
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::DdosProtectionInvalidRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
88
|
+
end
|
89
|
+
h[k.to_sym] = v
|
90
|
+
}
|
91
|
+
|
92
|
+
if attributes.key?(:'title')
|
93
|
+
self.title = attributes[:'title']
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.key?(:'status')
|
97
|
+
self.status = attributes[:'status']
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.key?(:'detail')
|
101
|
+
self.detail = attributes[:'detail']
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.key?(:'errors')
|
105
|
+
if (value = attributes[:'errors']).is_a?(Array)
|
106
|
+
self.errors = value
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
112
|
+
# @return Array for valid properties with the reasons
|
113
|
+
def list_invalid_properties
|
114
|
+
invalid_properties = Array.new
|
115
|
+
if @title.nil?
|
116
|
+
invalid_properties.push('invalid value for "title", title cannot be nil.')
|
117
|
+
end
|
118
|
+
|
119
|
+
if @status.nil?
|
120
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
121
|
+
end
|
122
|
+
|
123
|
+
if @detail.nil?
|
124
|
+
invalid_properties.push('invalid value for "detail", detail cannot be nil.')
|
125
|
+
end
|
126
|
+
|
127
|
+
if @errors.nil?
|
128
|
+
invalid_properties.push('invalid value for "errors", errors cannot be nil.')
|
129
|
+
end
|
130
|
+
|
131
|
+
invalid_properties
|
132
|
+
end
|
133
|
+
|
134
|
+
# Check to see if the all the properties in the model are valid
|
135
|
+
# @return true if the model is valid
|
136
|
+
def valid?
|
137
|
+
return false if @title.nil?
|
138
|
+
return false if @status.nil?
|
139
|
+
status_validator = EnumAttributeValidator.new('Integer', [400])
|
140
|
+
return false unless status_validator.valid?(@status)
|
141
|
+
return false if @detail.nil?
|
142
|
+
return false if @errors.nil?
|
143
|
+
true
|
144
|
+
end
|
145
|
+
|
146
|
+
# Custom attribute writer method checking allowed values (enum).
|
147
|
+
# @param [Object] status Object to be assigned
|
148
|
+
def status=(status)
|
149
|
+
validator = EnumAttributeValidator.new('Integer', [400])
|
150
|
+
unless validator.valid?(status)
|
151
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
152
|
+
end
|
153
|
+
@status = status
|
154
|
+
end
|
155
|
+
|
156
|
+
# Custom attribute writer method with validation
|
157
|
+
# @param [Object] errors Value to be assigned
|
158
|
+
def errors=(errors)
|
159
|
+
if errors.nil?
|
160
|
+
fail ArgumentError, 'errors cannot be nil'
|
161
|
+
end
|
162
|
+
|
163
|
+
@errors = errors
|
164
|
+
end
|
165
|
+
|
166
|
+
# Checks equality by comparing each attribute.
|
167
|
+
# @param [Object] Object to be compared
|
168
|
+
def ==(o)
|
169
|
+
return true if self.equal?(o)
|
170
|
+
self.class == o.class &&
|
171
|
+
title == o.title &&
|
172
|
+
status == o.status &&
|
173
|
+
detail == o.detail &&
|
174
|
+
errors == o.errors
|
175
|
+
end
|
176
|
+
|
177
|
+
# @see the `==` method
|
178
|
+
# @param [Object] Object to be compared
|
179
|
+
def eql?(o)
|
180
|
+
self == o
|
181
|
+
end
|
182
|
+
|
183
|
+
# Calculates hash code according to all attributes.
|
184
|
+
# @return [Integer] Hash code
|
185
|
+
def hash
|
186
|
+
[title, status, detail, errors].hash
|
187
|
+
end
|
188
|
+
|
189
|
+
# Builds the object from hash
|
190
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
191
|
+
# @return [Object] Returns the model itself
|
192
|
+
def self.build_from_hash(attributes)
|
193
|
+
new.build_from_hash(attributes)
|
194
|
+
end
|
195
|
+
|
196
|
+
# Builds the object from hash
|
197
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
198
|
+
# @return [Object] Returns the model itself
|
199
|
+
def build_from_hash(attributes)
|
200
|
+
return nil unless attributes.is_a?(Hash)
|
201
|
+
self.class.fastly_types.each_pair do |key, type|
|
202
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
|
203
|
+
self.send("#{key}=", nil)
|
204
|
+
elsif type =~ /\AArray<(.*)>/i
|
205
|
+
# check to ensure the input is an array given that the attribute
|
206
|
+
# is documented as an array but the input is not
|
207
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
208
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
209
|
+
end
|
210
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
211
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
self
|
216
|
+
end
|
217
|
+
|
218
|
+
# Deserializes the data based on type
|
219
|
+
# @param string type Data type
|
220
|
+
# @param string value Value to be deserialized
|
221
|
+
# @return [Object] Deserialized data
|
222
|
+
def _deserialize(type, value)
|
223
|
+
case type.to_sym
|
224
|
+
when :Time
|
225
|
+
Time.parse(value)
|
226
|
+
when :Date
|
227
|
+
Date.parse(value)
|
228
|
+
when :String
|
229
|
+
value.to_s
|
230
|
+
when :Integer
|
231
|
+
value.to_i
|
232
|
+
when :Float
|
233
|
+
value.to_f
|
234
|
+
when :Boolean
|
235
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
236
|
+
true
|
237
|
+
else
|
238
|
+
false
|
239
|
+
end
|
240
|
+
when :Object
|
241
|
+
# generic object (usually a Hash), return directly
|
242
|
+
value
|
243
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
244
|
+
inner_type = Regexp.last_match[:inner_type]
|
245
|
+
value.map { |v| _deserialize(inner_type, v) }
|
246
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
247
|
+
k_type = Regexp.last_match[:k_type]
|
248
|
+
v_type = Regexp.last_match[:v_type]
|
249
|
+
{}.tap do |hash|
|
250
|
+
value.each do |k, v|
|
251
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
else # model
|
255
|
+
# models (e.g. Pet) or oneOf
|
256
|
+
klass = Fastly.const_get(type)
|
257
|
+
klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
# Returns the string representation of the object
|
262
|
+
# @return [String] String presentation of the object
|
263
|
+
def to_s
|
264
|
+
to_hash.to_s
|
265
|
+
end
|
266
|
+
|
267
|
+
# to_body is an alias to to_hash (backward compatibility)
|
268
|
+
# @return [Hash] Returns the object in the form of hash
|
269
|
+
def to_body
|
270
|
+
to_hash
|
271
|
+
end
|
272
|
+
|
273
|
+
# Returns the object in the form of hash
|
274
|
+
# @return [Hash] Returns the object in the form of hash
|
275
|
+
def to_hash
|
276
|
+
hash = {}
|
277
|
+
self.class.attribute_map.each_pair do |attr, param|
|
278
|
+
value = self.send(attr)
|
279
|
+
if value.nil?
|
280
|
+
is_nullable = self.class.fastly_nullable.include?(attr)
|
281
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
282
|
+
end
|
283
|
+
|
284
|
+
hash[param] = _to_hash(value)
|
285
|
+
end
|
286
|
+
hash
|
287
|
+
end
|
288
|
+
|
289
|
+
# Outputs non-array value in the form of hash
|
290
|
+
# For object, use to_hash. Otherwise, just return the value
|
291
|
+
# @param [Object] value Any valid value
|
292
|
+
# @return [Hash] Returns the value in the form of hash
|
293
|
+
def _to_hash(value)
|
294
|
+
if value.is_a?(Array)
|
295
|
+
value.compact.map { |v| _to_hash(v) }
|
296
|
+
elsif value.is_a?(Hash)
|
297
|
+
{}.tap do |hash|
|
298
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
299
|
+
end
|
300
|
+
elsif value.respond_to? :to_hash
|
301
|
+
value.to_hash
|
302
|
+
else
|
303
|
+
value
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
end
|
308
|
+
|
309
|
+
end
|