From cee7eb9398d595182253b3f5dda04b1287a07b23 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 19 Feb 2024 05:01:39 +0000 Subject: [PATCH] Generated v8.0.1 --- CHANGELOG.md | 7 + README.md | 2 +- docs/CreateResponseObjectRequest.md | 16 + docs/ResponseObjectApi.md | 4 + docs/TlsConfigurationResponseAttributes.md | 2 +- ...TlsConfigurationResponseAttributesAllOf.md | 2 +- lib/fastly.rb | 1 + lib/fastly/api/response_object_api.rb | 12 +- .../models/create_response_object_request.rb | 280 ++++++++++++++++++ .../tls_configuration_response_attributes.rb | 2 +- ...onfiguration_response_attributes_all_of.rb | 2 +- lib/fastly/version.rb | 2 +- sig.json | 2 +- 13 files changed, 323 insertions(+), 11 deletions(-) create mode 100644 docs/CreateResponseObjectRequest.md create mode 100644 lib/fastly/models/create_response_object_request.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index c615e810..5cc4ba9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [v8.0.1](https://github.com/fastly/fastly-ruby/releases/tag/release/v8.0.1) (2024-02-19) + +**Bug fixes:** + +- fix(response_object): strongly type response_object create_update requests +- fix(tls_configurations): fix `tls_protocols` field to be a string array type + ## [v8.0.0](https://github.com/fastly/fastly-ruby/releases/tag/release/v8.0.0) (2023-11-29) **Breaking:** diff --git a/README.md b/README.md index 6d13c887..ceb065e9 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.0.0' +gem 'fastly', '~> 8.0.1' ``` Then run `bundle install`. diff --git a/docs/CreateResponseObjectRequest.md b/docs/CreateResponseObjectRequest.md new file mode 100644 index 00000000..65497a0a --- /dev/null +++ b/docs/CreateResponseObjectRequest.md @@ -0,0 +1,16 @@ +# Fastly::CreateResponseObjectRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | The name of the response object to create. | [optional] | +| **status** | **String** | The status code the response will have. Defaults to 200. | [optional] | +| **response** | **String** | The status text the response will have. Defaults to 'OK'. | [optional] | +| **content** | **String** | The content the response will deliver. | [optional] | +| **content_type** | **String** | The MIME type of your response content. | [optional] | +| **request_condition** | **String** | Condition which, if met, will select this configuration during a request. Optional. | [optional] | +| **cache_condition** | **String** | Name of the cache condition controlling when this configuration applies. | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/ResponseObjectApi.md b/docs/ResponseObjectApi.md index 893c0ce3..ad9a7129 100644 --- a/docs/ResponseObjectApi.md +++ b/docs/ResponseObjectApi.md @@ -32,6 +32,7 @@ api_instance = Fastly::ResponseObjectApi.new opts = { service_id: 'service_id_example', # String | Alphanumeric string identifying the service. version_id: 56, # Integer | Integer identifying a service version. + create_response_object_request: Fastly::CreateResponseObjectRequest.new, # CreateResponseObjectRequest | } begin @@ -49,6 +50,7 @@ end | ---- | ---- | ----------- | ----- | | **service_id** | **String** | Alphanumeric string identifying the service. | | | **version_id** | **Integer** | Integer identifying a service version. | | +| **create_response_object_request** | [**CreateResponseObjectRequest**](CreateResponseObjectRequest.md) | | [optional] | ### Return type @@ -193,6 +195,7 @@ opts = { service_id: 'service_id_example', # String | Alphanumeric string identifying the service. version_id: 56, # Integer | Integer identifying a service version. response_object_name: 'response_object_name_example', # String | Name for the request settings. + create_response_object_request: Fastly::CreateResponseObjectRequest.new, # CreateResponseObjectRequest | } begin @@ -211,6 +214,7 @@ end | **service_id** | **String** | Alphanumeric string identifying the service. | | | **version_id** | **Integer** | Integer identifying a service version. | | | **response_object_name** | **String** | Name for the request settings. | | +| **create_response_object_request** | [**CreateResponseObjectRequest**](CreateResponseObjectRequest.md) | | [optional] | ### Return type diff --git a/docs/TlsConfigurationResponseAttributes.md b/docs/TlsConfigurationResponseAttributes.md index 7e665671..783f2ac9 100644 --- a/docs/TlsConfigurationResponseAttributes.md +++ b/docs/TlsConfigurationResponseAttributes.md @@ -9,7 +9,7 @@ | **updated_at** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] | | **default** | **Boolean** | Signifies whether or not Fastly will use this configuration as a default when creating a new [TLS Activation](/reference/api/tls/custom-certs/activations/). | [optional][readonly] | | **http_protocols** | **Array<String>** | HTTP protocols available on your configuration. | [optional][readonly] | -| **tls_protocols** | **Array<Float>** | TLS protocols available on your configuration. | [optional][readonly] | +| **tls_protocols** | **Array<String>** | TLS protocols available on your configuration. | [optional][readonly] | | **bulk** | **Boolean** | Signifies whether the configuration is used for Platform TLS or not. | [optional][readonly] | [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/TlsConfigurationResponseAttributesAllOf.md b/docs/TlsConfigurationResponseAttributesAllOf.md index 8f2b6c25..ae68a6ae 100644 --- a/docs/TlsConfigurationResponseAttributesAllOf.md +++ b/docs/TlsConfigurationResponseAttributesAllOf.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **default** | **Boolean** | Signifies whether or not Fastly will use this configuration as a default when creating a new [TLS Activation](/reference/api/tls/custom-certs/activations/). | [optional][readonly] | | **http_protocols** | **Array<String>** | HTTP protocols available on your configuration. | [optional][readonly] | -| **tls_protocols** | **Array<Float>** | TLS protocols available on your configuration. | [optional][readonly] | +| **tls_protocols** | **Array<String>** | TLS protocols available on your configuration. | [optional][readonly] | | **bulk** | **Boolean** | Signifies whether the configuration is used for Platform TLS or not. | [optional][readonly] | [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/lib/fastly.rb b/lib/fastly.rb index 7fe517ac..91c505d3 100644 --- a/lib/fastly.rb +++ b/lib/fastly.rb @@ -78,6 +78,7 @@ require 'fastly/models/contact_response' require 'fastly/models/contact_response_all_of' require 'fastly/models/content' +require 'fastly/models/create_response_object_request' require 'fastly/models/customer' require 'fastly/models/customer_response' require 'fastly/models/customer_response_all_of' diff --git a/lib/fastly/api/response_object_api.rb b/lib/fastly/api/response_object_api.rb index 1dafe50a..314d0f0e 100644 --- a/lib/fastly/api/response_object_api.rb +++ b/lib/fastly/api/response_object_api.rb @@ -21,6 +21,7 @@ def initialize(api_client = ApiClient.default) # Creates a new Response Object. # @option opts [String] :service_id Alphanumeric string identifying the service. (required) # @option opts [Integer] :version_id Integer identifying a service version. (required) + # @option opts [CreateResponseObjectRequest] :create_response_object_request # @return [ResponseObjectResponse] def create_response_object(opts = {}) data, _status_code, _headers = create_response_object_with_http_info(opts) @@ -31,6 +32,7 @@ def create_response_object(opts = {}) # Creates a new Response Object. # @option opts [String] :service_id Alphanumeric string identifying the service. (required) # @option opts [Integer] :version_id Integer identifying a service version. (required) + # @option opts [CreateResponseObjectRequest] :create_response_object_request # @return [Array<(ResponseObjectResponse, Integer, Hash)>] ResponseObjectResponse data, response status code and response headers def create_response_object_with_http_info(opts = {}) if @api_client.config.debugging @@ -58,7 +60,7 @@ def create_response_object_with_http_info(opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end @@ -67,7 +69,7 @@ def create_response_object_with_http_info(opts = {}) form_params = opts[:form_params] || {} # http body (model) - post_body = opts[:debug_body] + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_response_object_request']) # return_type return_type = opts[:debug_return_type] || 'ResponseObjectResponse' @@ -321,6 +323,7 @@ def list_response_objects_with_http_info(opts = {}) # @option opts [String] :service_id Alphanumeric string identifying the service. (required) # @option opts [Integer] :version_id Integer identifying a service version. (required) # @option opts [String] :response_object_name Name for the request settings. (required) + # @option opts [CreateResponseObjectRequest] :create_response_object_request # @return [ResponseObjectResponse] def update_response_object(opts = {}) data, _status_code, _headers = update_response_object_with_http_info(opts) @@ -332,6 +335,7 @@ def update_response_object(opts = {}) # @option opts [String] :service_id Alphanumeric string identifying the service. (required) # @option opts [Integer] :version_id Integer identifying a service version. (required) # @option opts [String] :response_object_name Name for the request settings. (required) + # @option opts [CreateResponseObjectRequest] :create_response_object_request # @return [Array<(ResponseObjectResponse, Integer, Hash)>] ResponseObjectResponse data, response status code and response headers def update_response_object_with_http_info(opts = {}) if @api_client.config.debugging @@ -364,7 +368,7 @@ def update_response_object_with_http_info(opts = {}) # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end @@ -373,7 +377,7 @@ def update_response_object_with_http_info(opts = {}) form_params = opts[:form_params] || {} # http body (model) - post_body = opts[:debug_body] + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_response_object_request']) # return_type return_type = opts[:debug_return_type] || 'ResponseObjectResponse' diff --git a/lib/fastly/models/create_response_object_request.rb b/lib/fastly/models/create_response_object_request.rb new file mode 100644 index 00000000..aaef8b0b --- /dev/null +++ b/lib/fastly/models/create_response_object_request.rb @@ -0,0 +1,280 @@ +=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://developer.fastly.com/reference/api/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class CreateResponseObjectRequest + # The name of the response object to create. + attr_accessor :name + + # The status code the response will have. Defaults to 200. + attr_accessor :status + + # The status text the response will have. Defaults to 'OK'. + attr_accessor :response + + # The content the response will deliver. + attr_accessor :content + + # The MIME type of your response content. + attr_accessor :content_type + + # Condition which, if met, will select this configuration during a request. Optional. + attr_accessor :request_condition + + # Name of the cache condition controlling when this configuration applies. + attr_accessor :cache_condition + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'status' => :'status', + :'response' => :'response', + :'content' => :'content', + :'content_type' => :'content_type', + :'request_condition' => :'request_condition', + :'cache_condition' => :'cache_condition' + } + 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', + :'status' => :'String', + :'response' => :'String', + :'content' => :'String', + :'content_type' => :'String', + :'request_condition' => :'String', + :'cache_condition' => :'String' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + :'content_type', + :'request_condition', + :'cache_condition' + ]) + 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::CreateResponseObjectRequest` 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::CreateResponseObjectRequest`. 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?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'response') + self.response = attributes[:'response'] + end + + if attributes.key?(:'content') + self.content = attributes[:'content'] + end + + if attributes.key?(:'content_type') + self.content_type = attributes[:'content_type'] + end + + if attributes.key?(:'request_condition') + self.request_condition = attributes[:'request_condition'] + end + + if attributes.key?(:'cache_condition') + self.cache_condition = attributes[:'cache_condition'] + 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 && + status == o.status && + response == o.response && + content == o.content && + content_type == o.content_type && + request_condition == o.request_condition && + cache_condition == o.cache_condition + 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, status, response, content, content_type, request_condition, cache_condition].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_configuration_response_attributes.rb b/lib/fastly/models/tls_configuration_response_attributes.rb index 7b3c6f88..79001acd 100644 --- a/lib/fastly/models/tls_configuration_response_attributes.rb +++ b/lib/fastly/models/tls_configuration_response_attributes.rb @@ -60,7 +60,7 @@ def self.fastly_types :'updated_at' => :'Time', :'default' => :'Boolean', :'http_protocols' => :'Array', - :'tls_protocols' => :'Array', + :'tls_protocols' => :'Array', :'bulk' => :'Boolean' } end diff --git a/lib/fastly/models/tls_configuration_response_attributes_all_of.rb b/lib/fastly/models/tls_configuration_response_attributes_all_of.rb index aec48b35..b847a180 100644 --- a/lib/fastly/models/tls_configuration_response_attributes_all_of.rb +++ b/lib/fastly/models/tls_configuration_response_attributes_all_of.rb @@ -45,7 +45,7 @@ def self.fastly_types { :'default' => :'Boolean', :'http_protocols' => :'Array', - :'tls_protocols' => :'Array', + :'tls_protocols' => :'Array', :'bulk' => :'Boolean' } end diff --git a/lib/fastly/version.rb b/lib/fastly/version.rb index 6e44c43f..41d9f327 100644 --- a/lib/fastly/version.rb +++ b/lib/fastly/version.rb @@ -9,5 +9,5 @@ =end module Fastly - VERSION = '8.0.0' + VERSION = '8.0.1' end diff --git a/sig.json b/sig.json index d05cd161..203b64ec 100644 --- a/sig.json +++ b/sig.json @@ -1 +1 @@ -{"G": "4ae2b660", "D": "2452c3f1"} +{"G": "40613202", "D": "01d08f3f"}