diff --git a/.gitignore b/.gitignore index d78a16a2..6a6c61fe 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ build-iPhoneSimulator/ /.bundle/ /vendor/bundle /lib/bundler/man/ +vendor # for a library or gem, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: diff --git a/AuditApi/VERSION b/AuditApi/VERSION index 26e33797..e0102586 100644 --- a/AuditApi/VERSION +++ b/AuditApi/VERSION @@ -1 +1 @@ -2.0.4 \ No newline at end of file +2.0.5 diff --git a/AuditApi/lib/pnap_audit_api.rb b/AuditApi/lib/pnap_audit_api.rb index dda91563..d7664063 100644 --- a/AuditApi/lib/pnap_audit_api.rb +++ b/AuditApi/lib/pnap_audit_api.rb @@ -6,13 +6,14 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end # Common files require 'pnap_audit_api/api_client' require 'pnap_audit_api/api_error' +require 'pnap_audit_api/api_model_base' require 'pnap_audit_api/version' require 'pnap_audit_api/configuration' diff --git a/AuditApi/lib/pnap_audit_api/api/events_api.rb b/AuditApi/lib/pnap_audit_api/api/events_api.rb index 41fdaa56..2f29461d 100644 --- a/AuditApi/lib/pnap_audit_api/api/events_api.rb +++ b/AuditApi/lib/pnap_audit_api/api/events_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -74,7 +74,7 @@ def events_get_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} diff --git a/AuditApi/lib/pnap_audit_api/api_client.rb b/AuditApi/lib/pnap_audit_api/api_client.rb index 0e50d421..0dfa08bd 100644 --- a/AuditApi/lib/pnap_audit_api/api_client.rb +++ b/AuditApi/lib/pnap_audit_api/api_client.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -52,7 +52,8 @@ def self.default # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers. def call_api(http_method, path, opts = {}) request = build_request(http_method, path, opts) - tempfile = download_file(request) if opts[:return_type] == 'File' + tempfile = nil + (download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File' response = request.run if @config.debugging @@ -191,19 +192,17 @@ def download_file(request) chunk.force_encoding(encoding) tempfile.write(chunk) end - # run the request to ensure the tempfile is created successfully before returning it - request.run - if tempfile + request.on_complete do + if !tempfile + fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + end tempfile.close @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ "will be deleted automatically with GC. It's also recommended to delete the temp file "\ "explicitly with `tempfile.delete`" - else - fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + yield tempfile if block_given? end - - tempfile end # Check if the given MIME is a JSON MIME. @@ -215,7 +214,7 @@ def download_file(request) # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type. @@ -282,9 +281,13 @@ def convert_to_type(data, return_type) data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else - # models (e.g. Pet) or oneOf + # models (e.g. Pet) or oneOf/anyOf klass = AuditApi.const_get(return_type) - klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of) + klass.build(data) + else + klass.build_from_hash(data) + end end end @@ -294,7 +297,7 @@ def convert_to_type(data, return_type) # @param [String] filename the filename to be sanitized # @return [String] the sanitized filename def sanitize_filename(filename) - filename.gsub(/.*[\/\\]/, '') + filename.split(/[\/\\]/).last end def build_request_url(path, opts = {}) @@ -394,4 +397,4 @@ def build_collection_param(param, collection_format) end end end -end +end \ No newline at end of file diff --git a/AuditApi/lib/pnap_audit_api/api_error.rb b/AuditApi/lib/pnap_audit_api/api_error.rb index 2fd02a3d..e5dc5476 100644 --- a/AuditApi/lib/pnap_audit_api/api_error.rb +++ b/AuditApi/lib/pnap_audit_api/api_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/AuditApi/lib/pnap_audit_api/api_model_base.rb b/AuditApi/lib/pnap_audit_api/api_model_base.rb new file mode 100644 index 00000000..e7fcdd30 --- /dev/null +++ b/AuditApi/lib/pnap_audit_api/api_model_base.rb @@ -0,0 +1,88 @@ +=begin +#Audit Log API + +#The Audit Logs API lets you read audit log entries and track API calls or activities in the Bare Metal Cloud Portal.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/audit/v1/) + +The version of the OpenAPI document: 1.0 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +module AuditApi + class ApiModelBase + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._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 = AuditApi.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 + + # 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/AuditApi/lib/pnap_audit_api/configuration.rb b/AuditApi/lib/pnap_audit_api/configuration.rb index c861eb2f..98054419 100644 --- a/AuditApi/lib/pnap_audit_api/configuration.rb +++ b/AuditApi/lib/pnap_audit_api/configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -79,6 +79,14 @@ class Configuration # @return [true, false] attr_accessor :debugging + # Set this to ignore operation servers for the API client. This is useful when you need to + # send requests to a different server than the one specified in the OpenAPI document. + # Will default to the base url defined in the spec but can be overridden by setting + # `scheme`, `host`, `base_path` directly. + # Default to false. + # @return [true, false] + attr_accessor :ignore_operation_servers + # Defines the logger used for debugging. # Default to `Rails.logger` (when in Rails) or logging to STDOUT. # @@ -166,6 +174,7 @@ def initialize @timeout = 0 @params_encoding = nil @debugging = false + @ignore_operation_servers = false @inject_format = false @force_ending_format = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) @@ -200,6 +209,7 @@ def base_path=(base_path) # Returns base URL for specified operation based on server settings def base_url(operation = nil) + return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers if operation_server_settings.key?(operation) then index = server_operation_index.fetch(operation, server_index) server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) diff --git a/AuditApi/lib/pnap_audit_api/models/error.rb b/AuditApi/lib/pnap_audit_api/models/error.rb index cd1f58ac..931676ff 100644 --- a/AuditApi/lib/pnap_audit_api/models/error.rb +++ b/AuditApi/lib/pnap_audit_api/models/error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module AuditApi - class Error + class Error < ApiModelBase # The description detailing the cause of the error code. attr_accessor :message @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `AuditApi::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `AuditApi::Error`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -96,6 +102,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] message Value to be assigned + def message=(message) + if message.nil? + fail ArgumentError, 'message cannot be nil' + end + + @message = message + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -140,61 +156,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = AuditApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -211,24 +172,6 @@ def to_hash 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/AuditApi/lib/pnap_audit_api/models/event.rb b/AuditApi/lib/pnap_audit_api/models/event.rb index 4f7adf9c..2b98db24 100644 --- a/AuditApi/lib/pnap_audit_api/models/event.rb +++ b/AuditApi/lib/pnap_audit_api/models/event.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module AuditApi # The event log. - class Event + class Event < ApiModelBase # The name of the event. attr_accessor :name @@ -33,9 +33,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -61,9 +66,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `AuditApi::Event`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `AuditApi::Event`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -110,6 +116,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] timestamp Value to be assigned + def timestamp=(timestamp) + if timestamp.nil? + fail ArgumentError, 'timestamp cannot be nil' + end + + @timestamp = timestamp + end + + # Custom attribute writer method with validation + # @param [Object] user_info Value to be assigned + def user_info=(user_info) + if user_info.nil? + fail ArgumentError, 'user_info cannot be nil' + end + + @user_info = user_info + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -155,61 +181,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = AuditApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -226,24 +197,6 @@ def to_hash 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/AuditApi/lib/pnap_audit_api/models/user_info.rb b/AuditApi/lib/pnap_audit_api/models/user_info.rb index 8ae34217..adb44684 100644 --- a/AuditApi/lib/pnap_audit_api/models/user_info.rb +++ b/AuditApi/lib/pnap_audit_api/models/user_info.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module AuditApi # Details related to the user / application performing this request - class UserInfo + class UserInfo < ApiModelBase # The BMC account ID attr_accessor :account_id @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `AuditApi::UserInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `AuditApi::UserInfo`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -111,6 +117,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] account_id Value to be assigned + def account_id=(account_id) + if account_id.nil? + fail ArgumentError, 'account_id cannot be nil' + end + + @account_id = account_id + end + + # Custom attribute writer method with validation + # @param [Object] username Value to be assigned + def username=(username) + if username.nil? + fail ArgumentError, 'username cannot be nil' + end + + @username = username + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -156,61 +182,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = AuditApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -227,24 +198,6 @@ def to_hash 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/AuditApi/lib/pnap_audit_api/version.rb b/AuditApi/lib/pnap_audit_api/version.rb index b9167c61..65eaf869 100644 --- a/AuditApi/lib/pnap_audit_api/version.rb +++ b/AuditApi/lib/pnap_audit_api/version.rb @@ -6,8 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 - +Generator version: 7.20.0 =end def get_version() diff --git a/AuditApi/pnap_audit_api.gemspec b/AuditApi/pnap_audit_api.gemspec index 1bd3858e..d112c551 100644 --- a/AuditApi/pnap_audit_api.gemspec +++ b/AuditApi/pnap_audit_api.gemspec @@ -8,7 +8,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -19,14 +19,14 @@ Gem::Specification.new do |s| s.name = "pnap_audit_api" s.version = AuditApi::VERSION s.platform = Gem::Platform::RUBY - s.authors = ["PhoenixNAP"] + s.authors = ["OpenAPI-Generator"] s.email = ["support@phoenixnap.com"] - s.homepage = "https://phoenixnap.com/bare-metal-cloud" + s.homepage = "https://openapi-generator.tech" s.summary = "Audit Log API Ruby Gem" - s.description = "Audit Log API Ruby Gem" + s.description = "The Audit Logs API lets you read audit log entries and track API calls or activities in the Bare Metal Cloud Portal.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/audit/v1/) " s.license = "MPL-2.0" s.required_ruby_version = ">= 2.7" - s.metadata = { "source_code_uri" => "https://github.com/phoenixnap/ruby-sdk-bmc" } + s.metadata = {} s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' @@ -36,4 +36,4 @@ Gem::Specification.new do |s| s.test_files = `find spec/*`.split("\n") s.executables = [] s.require_paths = ["lib"] -end +end \ No newline at end of file diff --git a/AuditApi/spec/api/events_api_spec.rb b/AuditApi/spec/api/events_api_spec.rb index 0575fe0d..bff6f049 100644 --- a/AuditApi/spec/api/events_api_spec.rb +++ b/AuditApi/spec/api/events_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/AuditApi/spec/models/error_spec.rb b/AuditApi/spec/models/error_spec.rb index f860c52f..ea63a78c 100644 --- a/AuditApi/spec/models/error_spec.rb +++ b/AuditApi/spec/models/error_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe AuditApi::Error do - let(:instance) { AuditApi::Error.new } + #let(:instance) { AuditApi::Error.new } describe 'test an instance of Error' do it 'should create an instance of Error' do diff --git a/AuditApi/spec/models/event_spec.rb b/AuditApi/spec/models/event_spec.rb index 7814465d..9d41acdf 100644 --- a/AuditApi/spec/models/event_spec.rb +++ b/AuditApi/spec/models/event_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe AuditApi::Event do - let(:instance) { AuditApi::Event.new } + #let(:instance) { AuditApi::Event.new } describe 'test an instance of Event' do it 'should create an instance of Event' do diff --git a/AuditApi/spec/models/user_info_spec.rb b/AuditApi/spec/models/user_info_spec.rb index 94e749f0..4c364428 100644 --- a/AuditApi/spec/models/user_info_spec.rb +++ b/AuditApi/spec/models/user_info_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe AuditApi::UserInfo do - let(:instance) { AuditApi::UserInfo.new } + #let(:instance) { AuditApi::UserInfo.new } describe 'test an instance of UserInfo' do it 'should create an instance of UserInfo' do diff --git a/AuditApi/spec/spec_helper.rb b/AuditApi/spec/spec_helper.rb index 9ae56e67..0c1346ad 100644 --- a/AuditApi/spec/spec_helper.rb +++ b/AuditApi/spec/spec_helper.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BillingApi/README.md b/BillingApi/README.md index 10f37e5a..dcc3b959 100644 --- a/BillingApi/README.md +++ b/BillingApi/README.md @@ -153,25 +153,33 @@ Class | Method | HTTP request | Description - [BillingApi::LocationEnum](docs/LocationEnum.md) - [BillingApi::OperatingSystemDetails](docs/OperatingSystemDetails.md) - [BillingApi::OperatingSystemRecord](docs/OperatingSystemRecord.md) + - [BillingApi::PackageDetails](docs/PackageDetails.md) + - [BillingApi::PackageQuantity](docs/PackageQuantity.md) - [BillingApi::PackageUnitEnum](docs/PackageUnitEnum.md) - [BillingApi::PriceUnitEnum](docs/PriceUnitEnum.md) - [BillingApi::PricingPlan](docs/PricingPlan.md) - [BillingApi::Product](docs/Product.md) - [BillingApi::ProductAvailability](docs/ProductAvailability.md) - [BillingApi::ProductCategoryEnum](docs/ProductCategoryEnum.md) + - [BillingApi::ProductLocationEnum](docs/ProductLocationEnum.md) - [BillingApi::ProductsGet200ResponseInner](docs/ProductsGet200ResponseInner.md) - [BillingApi::PromoCreditDetails](docs/PromoCreditDetails.md) - [BillingApi::PublicSubnetDetails](docs/PublicSubnetDetails.md) - [BillingApi::PublicSubnetRecord](docs/PublicSubnetRecord.md) + - [BillingApi::Quantity](docs/Quantity.md) + - [BillingApi::QuantityUnitEnum](docs/QuantityUnitEnum.md) - [BillingApi::RatedUsageGet200ResponseInner](docs/RatedUsageGet200ResponseInner.md) - [BillingApi::RatedUsageProductCategoryEnum](docs/RatedUsageProductCategoryEnum.md) - [BillingApi::RatedUsageRecord](docs/RatedUsageRecord.md) - [BillingApi::Reservation](docs/Reservation.md) - [BillingApi::ReservationAutoRenewDisableRequest](docs/ReservationAutoRenewDisableRequest.md) + - [BillingApi::ReservationDetails](docs/ReservationDetails.md) - [BillingApi::ReservationInvoicingModelEnum](docs/ReservationInvoicingModelEnum.md) - [BillingApi::ReservationModelEnum](docs/ReservationModelEnum.md) - [BillingApi::ReservationProductCategoryEnum](docs/ReservationProductCategoryEnum.md) - [BillingApi::ReservationRequest](docs/ReservationRequest.md) + - [BillingApi::ReservationStateEnum](docs/ReservationStateEnum.md) + - [BillingApi::ReservationTerm](docs/ReservationTerm.md) - [BillingApi::ServerDetails](docs/ServerDetails.md) - [BillingApi::ServerProduct](docs/ServerProduct.md) - [BillingApi::ServerProductMetadata](docs/ServerProductMetadata.md) @@ -181,6 +189,7 @@ Class | Method | HTTP request | Description - [BillingApi::SystemCreditCauseEnum](docs/SystemCreditCauseEnum.md) - [BillingApi::SystemCreditDetails](docs/SystemCreditDetails.md) - [BillingApi::ThresholdConfigurationDetails](docs/ThresholdConfigurationDetails.md) + - [BillingApi::Utilization](docs/Utilization.md) ## Documentation for Authorization diff --git a/BillingApi/VERSION b/BillingApi/VERSION index 8f9174b4..4a36342f 100644 --- a/BillingApi/VERSION +++ b/BillingApi/VERSION @@ -1 +1 @@ -2.1.2 \ No newline at end of file +3.0.0 diff --git a/BillingApi/docs/BandwidthRecord.md b/BillingApi/docs/BandwidthRecord.md index 0541137a..75762b0d 100644 --- a/BillingApi/docs/BandwidthRecord.md +++ b/BillingApi/docs/BandwidthRecord.md @@ -19,9 +19,10 @@ | **unit_price_description** | **String** | User friendly description of the unit price. | | | **quantity** | **Float** | The number of units being charged. | | | **active** | **Boolean** | A flag indicating whether the rated usage record is still active. | | -| **usage_session_id** | **String** | The usage session ID is used to correlate rated usage records across periods of time. For example, a server used for over a month will generate multiple rated usage records. The entire usage session cost can be computed by aggregating the records having the same usage session ID. It is usual to have one rated usage record per month or invoice. | | -| **correlation_id** | **String** | Holds usage record id | | +| **usage_session_id** | **String** | The usage session ID is used to correlate rated usage records across periods of time. For example, a server used for over a month will generate multiple rated usage records. The entire usage session cost can be computed by aggregating the records having the same usage session ID. It is usual to have one rated usage record per month or invoice. | [optional] | +| **correlation_id** | **String** | Holds usage record id | [optional] | | **reservation_id** | **String** | Reservation id associated with this rated usage record. | [optional] | +| **reservation_details** | [**ReservationDetails**](ReservationDetails.md) | | [optional] | | **discount_details** | [**ApplicableDiscountDetails**](ApplicableDiscountDetails.md) | | [optional] | | **credit_details** | [**Array<CreditDetails>**](CreditDetails.md) | | [optional] | | **metadata** | [**BandwidthDetails**](BandwidthDetails.md) | | | @@ -50,6 +51,7 @@ instance = BillingApi::BandwidthRecord.new( usage_session_id: ec4a9d49-1cef-49e9-b85e-b560f88bcd26, correlation_id: ec4a9d49-1cef-49e9-b85e-b560f88bcd26, reservation_id: c32a24a1-5949-4b60-99c0-c8aaa3a92b04, + reservation_details: null, discount_details: null, credit_details: null, metadata: null diff --git a/BillingApi/docs/LocationAvailabilityDetail.md b/BillingApi/docs/LocationAvailabilityDetail.md index 3740628d..e6e8a8e1 100644 --- a/BillingApi/docs/LocationAvailabilityDetail.md +++ b/BillingApi/docs/LocationAvailabilityDetail.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **location** | [**LocationEnum**](LocationEnum.md) | | | +| **location** | [**ProductLocationEnum**](ProductLocationEnum.md) | | | | **min_quantity_requested** | **Float** | Requested quantity. | | | **min_quantity_available** | **Boolean** | Is product available in specific location for requested quantity | | | **available_quantity** | **Float** | Total available quantity of product in specific location. Max value is 10. | | diff --git a/BillingApi/docs/OperatingSystemRecord.md b/BillingApi/docs/OperatingSystemRecord.md index 83bbdf90..90c4ea2b 100644 --- a/BillingApi/docs/OperatingSystemRecord.md +++ b/BillingApi/docs/OperatingSystemRecord.md @@ -19,9 +19,10 @@ | **unit_price_description** | **String** | User friendly description of the unit price. | | | **quantity** | **Float** | The number of units being charged. | | | **active** | **Boolean** | A flag indicating whether the rated usage record is still active. | | -| **usage_session_id** | **String** | The usage session ID is used to correlate rated usage records across periods of time. For example, a server used for over a month will generate multiple rated usage records. The entire usage session cost can be computed by aggregating the records having the same usage session ID. It is usual to have one rated usage record per month or invoice. | | -| **correlation_id** | **String** | Holds usage record id | | +| **usage_session_id** | **String** | The usage session ID is used to correlate rated usage records across periods of time. For example, a server used for over a month will generate multiple rated usage records. The entire usage session cost can be computed by aggregating the records having the same usage session ID. It is usual to have one rated usage record per month or invoice. | [optional] | +| **correlation_id** | **String** | Holds usage record id | [optional] | | **reservation_id** | **String** | Reservation id associated with this rated usage record. | [optional] | +| **reservation_details** | [**ReservationDetails**](ReservationDetails.md) | | [optional] | | **discount_details** | [**ApplicableDiscountDetails**](ApplicableDiscountDetails.md) | | [optional] | | **credit_details** | [**Array<CreditDetails>**](CreditDetails.md) | | [optional] | | **metadata** | [**OperatingSystemDetails**](OperatingSystemDetails.md) | | | @@ -50,6 +51,7 @@ instance = BillingApi::OperatingSystemRecord.new( usage_session_id: ec4a9d49-1cef-49e9-b85e-b560f88bcd26, correlation_id: ec4a9d49-1cef-49e9-b85e-b560f88bcd26, reservation_id: c32a24a1-5949-4b60-99c0-c8aaa3a92b04, + reservation_details: null, discount_details: null, credit_details: null, metadata: null diff --git a/BillingApi/docs/PackageDetails.md b/BillingApi/docs/PackageDetails.md new file mode 100644 index 00000000..456f6481 --- /dev/null +++ b/BillingApi/docs/PackageDetails.md @@ -0,0 +1,20 @@ +# BillingApi::PackageDetails + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **package_quantity** | [**PackageQuantity**](PackageQuantity.md) | | [optional] | +| **package_unit** | [**PackageUnitEnum**](PackageUnitEnum.md) | | [optional] | + +## Example + +```ruby +require 'pnap_billing_api' + +instance = BillingApi::PackageDetails.new( + package_quantity: null, + package_unit: null +) +``` + diff --git a/BillingApi/docs/PackageQuantity.md b/BillingApi/docs/PackageQuantity.md new file mode 100644 index 00000000..f4887c01 --- /dev/null +++ b/BillingApi/docs/PackageQuantity.md @@ -0,0 +1,20 @@ +# BillingApi::PackageQuantity + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **min** | **Float** | Minimum package quantity. | | +| **max** | **Float** | Maximum package quantity. | | + +## Example + +```ruby +require 'pnap_billing_api' + +instance = BillingApi::PackageQuantity.new( + min: 0, + max: 100 +) +``` + diff --git a/BillingApi/docs/PricingPlan.md b/BillingApi/docs/PricingPlan.md index 080e1999..147ed30f 100644 --- a/BillingApi/docs/PricingPlan.md +++ b/BillingApi/docs/PricingPlan.md @@ -14,6 +14,7 @@ | **correlated_product_code** | **String** | Product code of the product this product is correlated with | [optional] | | **package_quantity** | **Float** | Package size per month. | [optional] | | **package_unit** | [**PackageUnitEnum**](PackageUnitEnum.md) | | [optional] | +| **package_details** | [**PackageDetails**](PackageDetails.md) | | [optional] | ## Example @@ -30,7 +31,8 @@ instance = BillingApi::PricingPlan.new( applicable_discounts: null, correlated_product_code: s1.c1.small, package_quantity: 50, - package_unit: null + package_unit: null, + package_details: null ) ``` diff --git a/BillingApi/docs/ProductAvailabilityApi.md b/BillingApi/docs/ProductAvailabilityApi.md index bf3ee158..1e76c6d3 100644 --- a/BillingApi/docs/ProductAvailabilityApi.md +++ b/BillingApi/docs/ProductAvailabilityApi.md @@ -31,9 +31,9 @@ opts = { product_category: ['SERVER'], # Array | Product category. Currently only SERVER category is supported. product_code: ['inner_example'], # Array | show_only_min_quantity_available: true, # Boolean | Show only locations where product with requested quantity is available or all locations where product is offered. - location: [BillingApi::LocationEnum::PHX], # Array | + location: [BillingApi::ProductLocationEnum::PHX], # Array | solution: ['SERVER_RANCHER'], # Array | - min_quantity: 2 # Float | Minimal quantity of product needed. Minimum, maximum and default values might differ for different products. For servers, they are 1, 10 and 1 respectively. + min_quantity: 2 # Float | Minimum quantity of the product that can be requested. For servers the allowed quantity range is 1 to 10. } begin @@ -70,9 +70,9 @@ end | **product_category** | [**Array<String>**](String.md) | Product category. Currently only SERVER category is supported. | [optional] | | **product_code** | [**Array<String>**](String.md) | | [optional] | | **show_only_min_quantity_available** | **Boolean** | Show only locations where product with requested quantity is available or all locations where product is offered. | [optional][default to true] | -| **location** | [**Array<LocationEnum>**](LocationEnum.md) | | [optional] | +| **location** | [**Array<ProductLocationEnum>**](ProductLocationEnum.md) | | [optional] | | **solution** | [**Array<String>**](String.md) | | [optional] | -| **min_quantity** | **Float** | Minimal quantity of product needed. Minimum, maximum and default values might differ for different products. For servers, they are 1, 10 and 1 respectively. | [optional] | +| **min_quantity** | **Float** | Minimum quantity of the product that can be requested. For servers the allowed quantity range is 1 to 10. | [optional] | ### Return type diff --git a/BillingApi/docs/ProductLocationEnum.md b/BillingApi/docs/ProductLocationEnum.md new file mode 100644 index 00000000..52557d5e --- /dev/null +++ b/BillingApi/docs/ProductLocationEnum.md @@ -0,0 +1,15 @@ +# BillingApi::ProductLocationEnum + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'pnap_billing_api' + +instance = BillingApi::ProductLocationEnum.new() +``` + diff --git a/BillingApi/docs/PublicSubnetRecord.md b/BillingApi/docs/PublicSubnetRecord.md index 9551d356..d816f462 100644 --- a/BillingApi/docs/PublicSubnetRecord.md +++ b/BillingApi/docs/PublicSubnetRecord.md @@ -19,9 +19,10 @@ | **unit_price_description** | **String** | User friendly description of the unit price. | | | **quantity** | **Float** | The number of units being charged. | | | **active** | **Boolean** | A flag indicating whether the rated usage record is still active. | | -| **usage_session_id** | **String** | The usage session ID is used to correlate rated usage records across periods of time. For example, a server used for over a month will generate multiple rated usage records. The entire usage session cost can be computed by aggregating the records having the same usage session ID. It is usual to have one rated usage record per month or invoice. | | -| **correlation_id** | **String** | Holds usage record id | | +| **usage_session_id** | **String** | The usage session ID is used to correlate rated usage records across periods of time. For example, a server used for over a month will generate multiple rated usage records. The entire usage session cost can be computed by aggregating the records having the same usage session ID. It is usual to have one rated usage record per month or invoice. | [optional] | +| **correlation_id** | **String** | Holds usage record id | [optional] | | **reservation_id** | **String** | Reservation id associated with this rated usage record. | [optional] | +| **reservation_details** | [**ReservationDetails**](ReservationDetails.md) | | [optional] | | **discount_details** | [**ApplicableDiscountDetails**](ApplicableDiscountDetails.md) | | [optional] | | **credit_details** | [**Array<CreditDetails>**](CreditDetails.md) | | [optional] | | **metadata** | [**PublicSubnetDetails**](PublicSubnetDetails.md) | | | @@ -50,6 +51,7 @@ instance = BillingApi::PublicSubnetRecord.new( usage_session_id: ec4a9d49-1cef-49e9-b85e-b560f88bcd26, correlation_id: ec4a9d49-1cef-49e9-b85e-b560f88bcd26, reservation_id: c32a24a1-5949-4b60-99c0-c8aaa3a92b04, + reservation_details: null, discount_details: null, credit_details: null, metadata: null diff --git a/BillingApi/docs/Quantity.md b/BillingApi/docs/Quantity.md new file mode 100644 index 00000000..f0daef5a --- /dev/null +++ b/BillingApi/docs/Quantity.md @@ -0,0 +1,20 @@ +# BillingApi::Quantity + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | **Float** | Quantity size. | | +| **unit** | [**QuantityUnitEnum**](QuantityUnitEnum.md) | | | + +## Example + +```ruby +require 'pnap_billing_api' + +instance = BillingApi::Quantity.new( + quantity: 30, + unit: null +) +``` + diff --git a/BillingApi/docs/QuantityUnitEnum.md b/BillingApi/docs/QuantityUnitEnum.md new file mode 100644 index 00000000..61571718 --- /dev/null +++ b/BillingApi/docs/QuantityUnitEnum.md @@ -0,0 +1,15 @@ +# BillingApi::QuantityUnitEnum + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'pnap_billing_api' + +instance = BillingApi::QuantityUnitEnum.new() +``` + diff --git a/BillingApi/docs/RatedUsageRecord.md b/BillingApi/docs/RatedUsageRecord.md index 2cc02df8..afe40d23 100644 --- a/BillingApi/docs/RatedUsageRecord.md +++ b/BillingApi/docs/RatedUsageRecord.md @@ -19,9 +19,10 @@ | **unit_price_description** | **String** | User friendly description of the unit price. | | | **quantity** | **Float** | The number of units being charged. | | | **active** | **Boolean** | A flag indicating whether the rated usage record is still active. | | -| **usage_session_id** | **String** | The usage session ID is used to correlate rated usage records across periods of time. For example, a server used for over a month will generate multiple rated usage records. The entire usage session cost can be computed by aggregating the records having the same usage session ID. It is usual to have one rated usage record per month or invoice. | | -| **correlation_id** | **String** | Holds usage record id | | +| **usage_session_id** | **String** | The usage session ID is used to correlate rated usage records across periods of time. For example, a server used for over a month will generate multiple rated usage records. The entire usage session cost can be computed by aggregating the records having the same usage session ID. It is usual to have one rated usage record per month or invoice. | [optional] | +| **correlation_id** | **String** | Holds usage record id | [optional] | | **reservation_id** | **String** | Reservation id associated with this rated usage record. | [optional] | +| **reservation_details** | [**ReservationDetails**](ReservationDetails.md) | | [optional] | | **discount_details** | [**ApplicableDiscountDetails**](ApplicableDiscountDetails.md) | | [optional] | | **credit_details** | [**Array<CreditDetails>**](CreditDetails.md) | | [optional] | @@ -49,6 +50,7 @@ instance = BillingApi::RatedUsageRecord.new( usage_session_id: ec4a9d49-1cef-49e9-b85e-b560f88bcd26, correlation_id: ec4a9d49-1cef-49e9-b85e-b560f88bcd26, reservation_id: c32a24a1-5949-4b60-99c0-c8aaa3a92b04, + reservation_details: null, discount_details: null, credit_details: null ) diff --git a/BillingApi/docs/Reservation.md b/BillingApi/docs/Reservation.md index 1e8a8c2b..e5b3c62c 100644 --- a/BillingApi/docs/Reservation.md +++ b/BillingApi/docs/Reservation.md @@ -5,11 +5,14 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | The reservation identifier. | | -| **product_code** | **String** | The code identifying the product. This code has significant across all locations. | | +| **product_code** | **String** | The code identifying the product. The same code is used for this product across all locations. | | | **product_category** | [**ReservationProductCategoryEnum**](ReservationProductCategoryEnum.md) | | | | **location** | [**LocationEnum**](LocationEnum.md) | | | | **reservation_model** | [**ReservationModelEnum**](ReservationModelEnum.md) | | | +| **term** | [**ReservationTerm**](ReservationTerm.md) | | [optional] | +| **reservation_state** | [**ReservationStateEnum**](ReservationStateEnum.md) | | | | **initial_invoice_model** | [**ReservationInvoicingModelEnum**](ReservationInvoicingModelEnum.md) | | [optional] | +| **quantity** | [**Quantity**](Quantity.md) | | | | **start_date_time** | **Time** | The point in time (in UTC) when the reservation starts. | | | **end_date_time** | **Time** | The point in time (in UTC) when the reservation end. | [optional] | | **last_renewal_date_time** | **Time** | The point in time (in UTC) when the reservation was renewed last. | [optional] | @@ -20,6 +23,7 @@ | **price_unit** | [**PriceUnitEnum**](PriceUnitEnum.md) | | | | **assigned_resource_id** | **String** | The resource ID currently being assigned to Reservation. | [optional] | | **next_billing_date** | **Date** | Next billing date for Reservation. | [optional] | +| **utilization** | [**Utilization**](Utilization.md) | | [optional] | ## Example @@ -32,7 +36,10 @@ instance = BillingApi::Reservation.new( product_category: null, location: null, reservation_model: null, + term: null, + reservation_state: null, initial_invoice_model: null, + quantity: null, start_date_time: 2020-03-19T16:39Z, end_date_time: 2020-04-19T16:39Z, last_renewal_date_time: 2020-03-19T16:39Z, @@ -42,7 +49,8 @@ instance = BillingApi::Reservation.new( price: 175, price_unit: null, assigned_resource_id: 83604275-bdba-490a-b87a-978e8dffdb14, - next_billing_date: Sun Apr 19 00:00:00 UTC 2020 + next_billing_date: Sun Apr 19 00:00:00 UTC 2020, + utilization: null ) ``` diff --git a/BillingApi/docs/ReservationDetails.md b/BillingApi/docs/ReservationDetails.md new file mode 100644 index 00000000..29e6e55e --- /dev/null +++ b/BillingApi/docs/ReservationDetails.md @@ -0,0 +1,20 @@ +# BillingApi::ReservationDetails + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | The Reservation identifier. | [optional] | +| **quantity** | [**Quantity**](Quantity.md) | | [optional] | + +## Example + +```ruby +require 'pnap_billing_api' + +instance = BillingApi::ReservationDetails.new( + id: 83604275-bdba-490a-b87a-978e8dffdb14, + quantity: null +) +``` + diff --git a/BillingApi/docs/ReservationRequest.md b/BillingApi/docs/ReservationRequest.md index e6e8c465..21585dd8 100644 --- a/BillingApi/docs/ReservationRequest.md +++ b/BillingApi/docs/ReservationRequest.md @@ -5,6 +5,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **sku** | **String** | The sku code of product pricing plan. | | +| **quantity** | [**Quantity**](Quantity.md) | | | ## Example @@ -12,7 +13,8 @@ require 'pnap_billing_api' instance = BillingApi::ReservationRequest.new( - sku: XXX-XXX-XXX + sku: XXX-XXX-XXX, + quantity: null ) ``` diff --git a/BillingApi/docs/ReservationStateEnum.md b/BillingApi/docs/ReservationStateEnum.md new file mode 100644 index 00000000..b117cf95 --- /dev/null +++ b/BillingApi/docs/ReservationStateEnum.md @@ -0,0 +1,15 @@ +# BillingApi::ReservationStateEnum + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'pnap_billing_api' + +instance = BillingApi::ReservationStateEnum.new() +``` + diff --git a/BillingApi/docs/ReservationTerm.md b/BillingApi/docs/ReservationTerm.md new file mode 100644 index 00000000..da602902 --- /dev/null +++ b/BillingApi/docs/ReservationTerm.md @@ -0,0 +1,20 @@ +# BillingApi::ReservationTerm + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **length_in_months** | **Integer** | Term's length, expressed in months. | | +| **reservation_model** | [**ReservationModelEnum**](ReservationModelEnum.md) | | | + +## Example + +```ruby +require 'pnap_billing_api' + +instance = BillingApi::ReservationTerm.new( + length_in_months: 12, + reservation_model: null +) +``` + diff --git a/BillingApi/docs/ReservationsApi.md b/BillingApi/docs/ReservationsApi.md index c91afa18..cfbff6b5 100644 --- a/BillingApi/docs/ReservationsApi.md +++ b/BillingApi/docs/ReservationsApi.md @@ -104,7 +104,7 @@ end api_instance = BillingApi::ReservationsApi.new opts = { - reservation_request: BillingApi::ReservationRequest.new({sku: 'XXX-XXX-XXX'}) # ReservationRequest | + reservation_request: BillingApi::ReservationRequest.new({sku: 'XXX-XXX-XXX', quantity: BillingApi::Quantity.new({quantity: 30, unit: BillingApi::QuantityUnitEnum::TB})}) # ReservationRequest | } begin @@ -318,7 +318,7 @@ end api_instance = BillingApi::ReservationsApi.new id = 'd90bbea9-5725-47ce-879e-d3905bafac2a' # String | Resource id. opts = { - reservation_request: BillingApi::ReservationRequest.new({sku: 'XXX-XXX-XXX'}) # ReservationRequest | + reservation_request: BillingApi::ReservationRequest.new({sku: 'XXX-XXX-XXX', quantity: BillingApi::Quantity.new({quantity: 30, unit: BillingApi::QuantityUnitEnum::TB})}) # ReservationRequest | } begin diff --git a/BillingApi/docs/ServerRecord.md b/BillingApi/docs/ServerRecord.md index c348c486..0902e827 100644 --- a/BillingApi/docs/ServerRecord.md +++ b/BillingApi/docs/ServerRecord.md @@ -19,9 +19,10 @@ | **unit_price_description** | **String** | User friendly description of the unit price. | | | **quantity** | **Float** | The number of units being charged. | | | **active** | **Boolean** | A flag indicating whether the rated usage record is still active. | | -| **usage_session_id** | **String** | The usage session ID is used to correlate rated usage records across periods of time. For example, a server used for over a month will generate multiple rated usage records. The entire usage session cost can be computed by aggregating the records having the same usage session ID. It is usual to have one rated usage record per month or invoice. | | -| **correlation_id** | **String** | Holds usage record id | | +| **usage_session_id** | **String** | The usage session ID is used to correlate rated usage records across periods of time. For example, a server used for over a month will generate multiple rated usage records. The entire usage session cost can be computed by aggregating the records having the same usage session ID. It is usual to have one rated usage record per month or invoice. | [optional] | +| **correlation_id** | **String** | Holds usage record id | [optional] | | **reservation_id** | **String** | Reservation id associated with this rated usage record. | [optional] | +| **reservation_details** | [**ReservationDetails**](ReservationDetails.md) | | [optional] | | **discount_details** | [**ApplicableDiscountDetails**](ApplicableDiscountDetails.md) | | [optional] | | **credit_details** | [**Array<CreditDetails>**](CreditDetails.md) | | [optional] | | **metadata** | [**ServerDetails**](ServerDetails.md) | | | @@ -50,6 +51,7 @@ instance = BillingApi::ServerRecord.new( usage_session_id: ec4a9d49-1cef-49e9-b85e-b560f88bcd26, correlation_id: ec4a9d49-1cef-49e9-b85e-b560f88bcd26, reservation_id: c32a24a1-5949-4b60-99c0-c8aaa3a92b04, + reservation_details: null, discount_details: null, credit_details: null, metadata: null diff --git a/BillingApi/docs/StorageDetails.md b/BillingApi/docs/StorageDetails.md index af81c844..fe0da945 100644 --- a/BillingApi/docs/StorageDetails.md +++ b/BillingApi/docs/StorageDetails.md @@ -4,12 +4,12 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **network_storage_id** | **String** | Network storage ID. | | -| **network_storage_name** | **String** | Network storage name. | | -| **volume_id** | **String** | Volume ID. | | -| **volume_name** | **String** | Volume name. | | +| **network_storage_id** | **String** | Network storage ID. | [optional] | +| **network_storage_name** | **String** | Network storage name. | [optional] | +| **volume_id** | **String** | Volume ID. | [optional] | +| **volume_name** | **String** | Volume name. | [optional] | | **capacity_in_gb** | **Integer** | Capacity in GB. | | -| **created_on** | **Time** | Timestamp when the record was created. | | +| **created_on** | **Time** | Timestamp when the record was created. | [optional] | ## Example diff --git a/BillingApi/docs/StorageRecord.md b/BillingApi/docs/StorageRecord.md index de83c887..7e89a9e7 100644 --- a/BillingApi/docs/StorageRecord.md +++ b/BillingApi/docs/StorageRecord.md @@ -19,9 +19,10 @@ | **unit_price_description** | **String** | User friendly description of the unit price. | | | **quantity** | **Float** | The number of units being charged. | | | **active** | **Boolean** | A flag indicating whether the rated usage record is still active. | | -| **usage_session_id** | **String** | The usage session ID is used to correlate rated usage records across periods of time. For example, a server used for over a month will generate multiple rated usage records. The entire usage session cost can be computed by aggregating the records having the same usage session ID. It is usual to have one rated usage record per month or invoice. | | -| **correlation_id** | **String** | Holds usage record id | | +| **usage_session_id** | **String** | The usage session ID is used to correlate rated usage records across periods of time. For example, a server used for over a month will generate multiple rated usage records. The entire usage session cost can be computed by aggregating the records having the same usage session ID. It is usual to have one rated usage record per month or invoice. | [optional] | +| **correlation_id** | **String** | Holds usage record id | [optional] | | **reservation_id** | **String** | Reservation id associated with this rated usage record. | [optional] | +| **reservation_details** | [**ReservationDetails**](ReservationDetails.md) | | [optional] | | **discount_details** | [**ApplicableDiscountDetails**](ApplicableDiscountDetails.md) | | [optional] | | **credit_details** | [**Array<CreditDetails>**](CreditDetails.md) | | [optional] | | **metadata** | [**StorageDetails**](StorageDetails.md) | | | @@ -50,6 +51,7 @@ instance = BillingApi::StorageRecord.new( usage_session_id: ec4a9d49-1cef-49e9-b85e-b560f88bcd26, correlation_id: ec4a9d49-1cef-49e9-b85e-b560f88bcd26, reservation_id: c32a24a1-5949-4b60-99c0-c8aaa3a92b04, + reservation_details: null, discount_details: null, credit_details: null, metadata: null diff --git a/BillingApi/docs/Utilization.md b/BillingApi/docs/Utilization.md new file mode 100644 index 00000000..9100cd62 --- /dev/null +++ b/BillingApi/docs/Utilization.md @@ -0,0 +1,20 @@ +# BillingApi::Utilization + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **quantity** | [**Quantity**](Quantity.md) | | | +| **percentage** | **Float** | | | + +## Example + +```ruby +require 'pnap_billing_api' + +instance = BillingApi::Utilization.new( + quantity: null, + percentage: 30 +) +``` + diff --git a/BillingApi/lib/pnap_billing_api.rb b/BillingApi/lib/pnap_billing_api.rb index 7aec5440..07319119 100644 --- a/BillingApi/lib/pnap_billing_api.rb +++ b/BillingApi/lib/pnap_billing_api.rb @@ -6,13 +6,14 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end # Common files require 'pnap_billing_api/api_client' require 'pnap_billing_api/api_error' +require 'pnap_billing_api/api_model_base' require 'pnap_billing_api/version' require 'pnap_billing_api/configuration' @@ -33,25 +34,33 @@ require 'pnap_billing_api/models/location_enum' require 'pnap_billing_api/models/operating_system_details' require 'pnap_billing_api/models/operating_system_record' +require 'pnap_billing_api/models/package_details' +require 'pnap_billing_api/models/package_quantity' require 'pnap_billing_api/models/package_unit_enum' require 'pnap_billing_api/models/price_unit_enum' require 'pnap_billing_api/models/pricing_plan' require 'pnap_billing_api/models/product' require 'pnap_billing_api/models/product_availability' require 'pnap_billing_api/models/product_category_enum' +require 'pnap_billing_api/models/product_location_enum' require 'pnap_billing_api/models/products_get200_response_inner' require 'pnap_billing_api/models/promo_credit_details' require 'pnap_billing_api/models/public_subnet_details' require 'pnap_billing_api/models/public_subnet_record' +require 'pnap_billing_api/models/quantity' +require 'pnap_billing_api/models/quantity_unit_enum' require 'pnap_billing_api/models/rated_usage_get200_response_inner' require 'pnap_billing_api/models/rated_usage_product_category_enum' require 'pnap_billing_api/models/rated_usage_record' require 'pnap_billing_api/models/reservation' require 'pnap_billing_api/models/reservation_auto_renew_disable_request' +require 'pnap_billing_api/models/reservation_details' require 'pnap_billing_api/models/reservation_invoicing_model_enum' require 'pnap_billing_api/models/reservation_model_enum' require 'pnap_billing_api/models/reservation_product_category_enum' require 'pnap_billing_api/models/reservation_request' +require 'pnap_billing_api/models/reservation_state_enum' +require 'pnap_billing_api/models/reservation_term' require 'pnap_billing_api/models/server_details' require 'pnap_billing_api/models/server_product' require 'pnap_billing_api/models/server_product_metadata' @@ -61,6 +70,7 @@ require 'pnap_billing_api/models/system_credit_cause_enum' require 'pnap_billing_api/models/system_credit_details' require 'pnap_billing_api/models/threshold_configuration_details' +require 'pnap_billing_api/models/utilization' # APIs require 'pnap_billing_api/api/billing_configurations_api' diff --git a/BillingApi/lib/pnap_billing_api/api/billing_configurations_api.rb b/BillingApi/lib/pnap_billing_api/api/billing_configurations_api.rb index 348289f7..ce0c6991 100644 --- a/BillingApi/lib/pnap_billing_api/api/billing_configurations_api.rb +++ b/BillingApi/lib/pnap_billing_api/api/billing_configurations_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -45,7 +45,7 @@ def account_billing_configuration_me_get_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} diff --git a/BillingApi/lib/pnap_billing_api/api/product_availability_api.rb b/BillingApi/lib/pnap_billing_api/api/product_availability_api.rb index 7fd524f8..f02082c5 100644 --- a/BillingApi/lib/pnap_billing_api/api/product_availability_api.rb +++ b/BillingApi/lib/pnap_billing_api/api/product_availability_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -25,9 +25,9 @@ def initialize(api_client = ApiClient.default) # @option opts [Array] :product_category Product category. Currently only SERVER category is supported. # @option opts [Array] :product_code # @option opts [Boolean] :show_only_min_quantity_available Show only locations where product with requested quantity is available or all locations where product is offered. (default to true) - # @option opts [Array] :location + # @option opts [Array] :location # @option opts [Array] :solution - # @option opts [Float] :min_quantity Minimal quantity of product needed. Minimum, maximum and default values might differ for different products. For servers, they are 1, 10 and 1 respectively. + # @option opts [Float] :min_quantity Minimum quantity of the product that can be requested. For servers the allowed quantity range is 1 to 10. # @return [Array] def product_availability_get(opts = {}) data, _status_code, _headers = product_availability_get_with_http_info(opts) @@ -40,9 +40,9 @@ def product_availability_get(opts = {}) # @option opts [Array] :product_category Product category. Currently only SERVER category is supported. # @option opts [Array] :product_code # @option opts [Boolean] :show_only_min_quantity_available Show only locations where product with requested quantity is available or all locations where product is offered. (default to true) - # @option opts [Array] :location + # @option opts [Array] :location # @option opts [Array] :solution - # @option opts [Float] :min_quantity Minimal quantity of product needed. Minimum, maximum and default values might differ for different products. For servers, they are 1, 10 and 1 respectively. + # @option opts [Float] :min_quantity Minimum quantity of the product that can be requested. For servers the allowed quantity range is 1 to 10. # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers def product_availability_get_with_http_info(opts = {}) if @api_client.config.debugging @@ -56,6 +56,14 @@ def product_availability_get_with_http_info(opts = {}) if @api_client.config.client_side_validation && opts[:'solution'] && !opts[:'solution'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"solution\", must include one of #{allowable_values}" end + if @api_client.config.client_side_validation && !opts[:'min_quantity'].nil? && opts[:'min_quantity'] > 10 + fail ArgumentError, 'invalid value for "opts[:"min_quantity"]" when calling ProductAvailabilityApi.product_availability_get, must be smaller than or equal to 10.' + end + + if @api_client.config.client_side_validation && !opts[:'min_quantity'].nil? && opts[:'min_quantity'] < 1 + fail ArgumentError, 'invalid value for "opts[:"min_quantity"]" when calling ProductAvailabilityApi.product_availability_get, must be greater than or equal to 1.' + end + # resource path local_var_path = '/product-availability' @@ -71,7 +79,7 @@ def product_availability_get_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} diff --git a/BillingApi/lib/pnap_billing_api/api/products_api.rb b/BillingApi/lib/pnap_billing_api/api/products_api.rb index ed113e84..981d31a9 100644 --- a/BillingApi/lib/pnap_billing_api/api/products_api.rb +++ b/BillingApi/lib/pnap_billing_api/api/products_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -57,7 +57,7 @@ def products_get_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} diff --git a/BillingApi/lib/pnap_billing_api/api/rated_usage_api.rb b/BillingApi/lib/pnap_billing_api/api/rated_usage_api.rb index 7da7f6a1..d119bca3 100644 --- a/BillingApi/lib/pnap_billing_api/api/rated_usage_api.rb +++ b/BillingApi/lib/pnap_billing_api/api/rated_usage_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -62,7 +62,7 @@ def rated_usage_get_with_http_info(from_year_month, to_year_month, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -122,7 +122,7 @@ def rated_usage_month_to_date_get_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} diff --git a/BillingApi/lib/pnap_billing_api/api/reservations_api.rb b/BillingApi/lib/pnap_billing_api/api/reservations_api.rb index 48acc7b2..02be2d02 100644 --- a/BillingApi/lib/pnap_billing_api/api/reservations_api.rb +++ b/BillingApi/lib/pnap_billing_api/api/reservations_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -48,7 +48,7 @@ def reservations_get_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -107,7 +107,7 @@ def reservations_post_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -177,7 +177,7 @@ def reservations_reservation_id_actions_auto_renew_disable_post_with_http_info(i # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -245,7 +245,7 @@ def reservations_reservation_id_actions_auto_renew_enable_post_with_http_info(id # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -310,7 +310,7 @@ def reservations_reservation_id_actions_convert_post_with_http_info(id, opts = { # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -378,7 +378,7 @@ def reservations_reservation_id_get_with_http_info(id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} diff --git a/BillingApi/lib/pnap_billing_api/api_client.rb b/BillingApi/lib/pnap_billing_api/api_client.rb index 1e1a46b7..31467a2d 100644 --- a/BillingApi/lib/pnap_billing_api/api_client.rb +++ b/BillingApi/lib/pnap_billing_api/api_client.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -52,7 +52,8 @@ def self.default # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers. def call_api(http_method, path, opts = {}) request = build_request(http_method, path, opts) - tempfile = download_file(request) if opts[:return_type] == 'File' + tempfile = nil + (download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File' response = request.run if @config.debugging @@ -191,19 +192,17 @@ def download_file(request) chunk.force_encoding(encoding) tempfile.write(chunk) end - # run the request to ensure the tempfile is created successfully before returning it - request.run - if tempfile + request.on_complete do + if !tempfile + fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + end tempfile.close @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ "will be deleted automatically with GC. It's also recommended to delete the temp file "\ "explicitly with `tempfile.delete`" - else - fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + yield tempfile if block_given? end - - tempfile end # Check if the given MIME is a JSON MIME. @@ -215,7 +214,7 @@ def download_file(request) # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type. @@ -282,9 +281,13 @@ def convert_to_type(data, return_type) data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else - # models (e.g. Pet) or oneOf + # models (e.g. Pet) or oneOf/anyOf klass = BillingApi.const_get(return_type) - klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of) + klass.build(data) + else + klass.build_from_hash(data) + end end end @@ -294,7 +297,7 @@ def convert_to_type(data, return_type) # @param [String] filename the filename to be sanitized # @return [String] the sanitized filename def sanitize_filename(filename) - filename.gsub(/.*[\/\\]/, '') + filename.split(/[\/\\]/).last end def build_request_url(path, opts = {}) @@ -394,4 +397,4 @@ def build_collection_param(param, collection_format) end end end -end +end \ No newline at end of file diff --git a/BillingApi/lib/pnap_billing_api/api_error.rb b/BillingApi/lib/pnap_billing_api/api_error.rb index 9b67f9a6..1a4a9f2e 100644 --- a/BillingApi/lib/pnap_billing_api/api_error.rb +++ b/BillingApi/lib/pnap_billing_api/api_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BillingApi/lib/pnap_billing_api/api_model_base.rb b/BillingApi/lib/pnap_billing_api/api_model_base.rb new file mode 100644 index 00000000..1cac7ee9 --- /dev/null +++ b/BillingApi/lib/pnap_billing_api/api_model_base.rb @@ -0,0 +1,88 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +module BillingApi + class ApiModelBase + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._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 = BillingApi.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 + + # 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/BillingApi/lib/pnap_billing_api/configuration.rb b/BillingApi/lib/pnap_billing_api/configuration.rb index 5c78bc19..ba71ba01 100644 --- a/BillingApi/lib/pnap_billing_api/configuration.rb +++ b/BillingApi/lib/pnap_billing_api/configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -79,6 +79,14 @@ class Configuration # @return [true, false] attr_accessor :debugging + # Set this to ignore operation servers for the API client. This is useful when you need to + # send requests to a different server than the one specified in the OpenAPI document. + # Will default to the base url defined in the spec but can be overridden by setting + # `scheme`, `host`, `base_path` directly. + # Default to false. + # @return [true, false] + attr_accessor :ignore_operation_servers + # Defines the logger used for debugging. # Default to `Rails.logger` (when in Rails) or logging to STDOUT. # @@ -166,6 +174,7 @@ def initialize @timeout = 0 @params_encoding = nil @debugging = false + @ignore_operation_servers = false @inject_format = false @force_ending_format = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) @@ -200,6 +209,7 @@ def base_path=(base_path) # Returns base URL for specified operation based on server settings def base_url(operation = nil) + return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers if operation_server_settings.key?(operation) then index = server_operation_index.fetch(operation, server_index) server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) diff --git a/BillingApi/lib/pnap_billing_api/models/applicable_discount_details.rb b/BillingApi/lib/pnap_billing_api/models/applicable_discount_details.rb index 0dfba145..dbe6a0aa 100644 --- a/BillingApi/lib/pnap_billing_api/models/applicable_discount_details.rb +++ b/BillingApi/lib/pnap_billing_api/models/applicable_discount_details.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module BillingApi - class ApplicableDiscountDetails + class ApplicableDiscountDetails < ApiModelBase # A unique code associated with the discount. attr_accessor :code @@ -58,9 +58,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -94,9 +99,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::ApplicableDiscountDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ApplicableDiscountDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -154,6 +160,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] code Value to be assigned + def code=(code) + if code.nil? + fail ArgumentError, 'code cannot be nil' + end + + @code = code + end + + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + @type = type + end + + # Custom attribute writer method with validation + # @param [Object] value Value to be assigned + def value=(value) + if value.nil? + fail ArgumentError, 'value cannot be nil' + end + + @value = value + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -200,61 +236,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -271,24 +252,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/applicable_discounts.rb b/BillingApi/lib/pnap_billing_api/models/applicable_discounts.rb index c8b497a0..99c29341 100644 --- a/BillingApi/lib/pnap_billing_api/models/applicable_discounts.rb +++ b/BillingApi/lib/pnap_billing_api/models/applicable_discounts.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BillingApi # Represents the applicable discount details for a product, including the discounted price and discount information. - class ApplicableDiscounts + class ApplicableDiscounts < ApiModelBase # The price of the product after applying a discount. attr_accessor :discounted_price @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::ApplicableDiscounts`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ApplicableDiscounts`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -133,61 +139,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -204,24 +155,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/bandwidth_details.rb b/BillingApi/lib/pnap_billing_api/models/bandwidth_details.rb index 0d403d2d..70fdae67 100644 --- a/BillingApi/lib/pnap_billing_api/models/bandwidth_details.rb +++ b/BillingApi/lib/pnap_billing_api/models/bandwidth_details.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BillingApi # Details of the bandwidth associated with this rated usage record. - class BandwidthDetails + class BandwidthDetails < ApiModelBase # The amount of GB consumed in ingress (IN). attr_accessor :ingress_gb @@ -60,9 +60,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -89,9 +94,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::BandwidthDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::BandwidthDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -144,6 +150,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] ingress_gb Value to be assigned + def ingress_gb=(ingress_gb) + if ingress_gb.nil? + fail ArgumentError, 'ingress_gb cannot be nil' + end + + @ingress_gb = ingress_gb + end + + # Custom attribute writer method with validation + # @param [Object] egress_gb Value to be assigned + def egress_gb=(egress_gb) + if egress_gb.nil? + fail ArgumentError, 'egress_gb cannot be nil' + end + + @egress_gb = egress_gb + end + # Custom attribute writer method checking allowed values (enum). # @param [Object] package_unit Object to be assigned def package_unit=(package_unit) @@ -200,61 +226,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -271,24 +242,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/bandwidth_record.rb b/BillingApi/lib/pnap_billing_api/models/bandwidth_record.rb index 34a5b4fd..84be442f 100644 --- a/BillingApi/lib/pnap_billing_api/models/bandwidth_record.rb +++ b/BillingApi/lib/pnap_billing_api/models/bandwidth_record.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module BillingApi - class BandwidthRecord + class BandwidthRecord < ApiModelBase # The unique identifier of the rated usage record. attr_accessor :id @@ -67,6 +67,8 @@ class BandwidthRecord # Reservation id associated with this rated usage record. attr_accessor :reservation_id + attr_accessor :reservation_details + attr_accessor :discount_details attr_accessor :credit_details @@ -116,15 +118,21 @@ def self.attribute_map :'usage_session_id' => :'usageSessionId', :'correlation_id' => :'correlationId', :'reservation_id' => :'reservationId', + :'reservation_details' => :'reservationDetails', :'discount_details' => :'discountDetails', :'credit_details' => :'creditDetails', :'metadata' => :'metadata' } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -148,6 +156,7 @@ def self.openapi_types :'usage_session_id' => :'String', :'correlation_id' => :'String', :'reservation_id' => :'String', + :'reservation_details' => :'ReservationDetails', :'discount_details' => :'ApplicableDiscountDetails', :'credit_details' => :'Array', :'metadata' => :'BandwidthDetails' @@ -175,9 +184,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::BandwidthRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::BandwidthRecord`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -268,20 +278,20 @@ def initialize(attributes = {}) if attributes.key?(:'usage_session_id') self.usage_session_id = attributes[:'usage_session_id'] - else - self.usage_session_id = nil end if attributes.key?(:'correlation_id') self.correlation_id = attributes[:'correlation_id'] - else - self.correlation_id = nil end if attributes.key?(:'reservation_id') self.reservation_id = attributes[:'reservation_id'] end + if attributes.key?(:'reservation_details') + self.reservation_details = attributes[:'reservation_details'] + end + if attributes.key?(:'discount_details') self.discount_details = attributes[:'discount_details'] end @@ -352,14 +362,6 @@ def list_invalid_properties invalid_properties.push('invalid value for "active", active cannot be nil.') end - if @usage_session_id.nil? - invalid_properties.push('invalid value for "usage_session_id", usage_session_id cannot be nil.') - end - - if @correlation_id.nil? - invalid_properties.push('invalid value for "correlation_id", correlation_id cannot be nil.') - end - if @metadata.nil? invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') end @@ -383,12 +385,140 @@ def valid? return false if @unit_price_description.nil? return false if @quantity.nil? return false if @active.nil? - return false if @usage_session_id.nil? - return false if @correlation_id.nil? return false if @metadata.nil? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] product_category Value to be assigned + def product_category=(product_category) + if product_category.nil? + fail ArgumentError, 'product_category cannot be nil' + end + + @product_category = product_category + end + + # Custom attribute writer method with validation + # @param [Object] product_code Value to be assigned + def product_code=(product_code) + if product_code.nil? + fail ArgumentError, 'product_code cannot be nil' + end + + @product_code = product_code + end + + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + + # Custom attribute writer method with validation + # @param [Object] start_date_time Value to be assigned + def start_date_time=(start_date_time) + if start_date_time.nil? + fail ArgumentError, 'start_date_time cannot be nil' + end + + @start_date_time = start_date_time + end + + # Custom attribute writer method with validation + # @param [Object] end_date_time Value to be assigned + def end_date_time=(end_date_time) + if end_date_time.nil? + fail ArgumentError, 'end_date_time cannot be nil' + end + + @end_date_time = end_date_time + end + + # Custom attribute writer method with validation + # @param [Object] cost Value to be assigned + def cost=(cost) + if cost.nil? + fail ArgumentError, 'cost cannot be nil' + end + + @cost = cost + end + + # Custom attribute writer method with validation + # @param [Object] price_model Value to be assigned + def price_model=(price_model) + if price_model.nil? + fail ArgumentError, 'price_model cannot be nil' + end + + @price_model = price_model + end + + # Custom attribute writer method with validation + # @param [Object] unit_price Value to be assigned + def unit_price=(unit_price) + if unit_price.nil? + fail ArgumentError, 'unit_price cannot be nil' + end + + @unit_price = unit_price + end + + # Custom attribute writer method with validation + # @param [Object] unit_price_description Value to be assigned + def unit_price_description=(unit_price_description) + if unit_price_description.nil? + fail ArgumentError, 'unit_price_description cannot be nil' + end + + @unit_price_description = unit_price_description + end + + # Custom attribute writer method with validation + # @param [Object] quantity Value to be assigned + def quantity=(quantity) + if quantity.nil? + fail ArgumentError, 'quantity cannot be nil' + end + + @quantity = quantity + end + + # Custom attribute writer method with validation + # @param [Object] active Value to be assigned + def active=(active) + if active.nil? + fail ArgumentError, 'active cannot be nil' + end + + @active = active + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if metadata.nil? + fail ArgumentError, 'metadata cannot be nil' + end + + @metadata = metadata + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -412,6 +542,7 @@ def ==(o) usage_session_id == o.usage_session_id && correlation_id == o.correlation_id && reservation_id == o.reservation_id && + reservation_details == o.reservation_details && discount_details == o.discount_details && credit_details == o.credit_details && metadata == o.metadata @@ -426,7 +557,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, product_category, product_code, location, year_month, start_date_time, end_date_time, cost, cost_before_discount, cost_description, price_model, unit_price, unit_price_description, quantity, active, usage_session_id, correlation_id, reservation_id, discount_details, credit_details, metadata].hash + [id, product_category, product_code, location, year_month, start_date_time, end_date_time, cost, cost_before_discount, cost_description, price_model, unit_price, unit_price_description, quantity, active, usage_session_id, correlation_id, reservation_id, reservation_details, discount_details, credit_details, metadata].hash end # Builds the object from hash @@ -452,61 +583,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -523,24 +599,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/configuration_details.rb b/BillingApi/lib/pnap_billing_api/models/configuration_details.rb index 582318c5..a91d4ff9 100644 --- a/BillingApi/lib/pnap_billing_api/models/configuration_details.rb +++ b/BillingApi/lib/pnap_billing_api/models/configuration_details.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BillingApi # Billing configuration details. - class ConfigurationDetails + class ConfigurationDetails < ApiModelBase attr_accessor :threshold_configuration # Attribute mapping from ruby-style variable name to JSON key. @@ -25,9 +25,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::ConfigurationDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ConfigurationDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -121,61 +127,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -192,24 +143,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/credit_details.rb b/BillingApi/lib/pnap_billing_api/models/credit_details.rb index 04756dc4..81b17a5d 100644 --- a/BillingApi/lib/pnap_billing_api/models/credit_details.rb +++ b/BillingApi/lib/pnap_billing_api/models/credit_details.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -38,8 +38,7 @@ def build(data) openapi_one_of.each do |klass| begin next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data + return find_and_cast_into_type(klass, data) rescue # rescue all errors so we keep iterating even if the current item lookup raises end end @@ -65,7 +64,7 @@ def find_and_cast_into_type(klass, data) when 'Time' return Time.parse(data) when 'Date' - return Date.parse(data) + return Date.iso8601(data) when 'String' return data if data.instance_of?(String) when 'Object' # "type: object" @@ -88,9 +87,9 @@ def find_and_cast_into_type(klass, data) return model if model else # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? + raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty? model = const.build_from_hash(data) - return model if model && model.valid? + return model if model end end end @@ -101,5 +100,4 @@ def find_and_cast_into_type(klass, data) end end end - end diff --git a/BillingApi/lib/pnap_billing_api/models/credit_details_base.rb b/BillingApi/lib/pnap_billing_api/models/credit_details_base.rb index 41d2f368..3717f40c 100644 --- a/BillingApi/lib/pnap_billing_api/models/credit_details_base.rb +++ b/BillingApi/lib/pnap_billing_api/models/credit_details_base.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BillingApi # Base credit details value object. - class CreditDetailsBase + class CreditDetailsBase < ApiModelBase # Amount applied. attr_accessor :applied_amount @@ -51,9 +51,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -78,9 +83,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::CreditDetailsBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::CreditDetailsBase`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -123,6 +129,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] applied_amount Value to be assigned + def applied_amount=(applied_amount) + if applied_amount.nil? + fail ArgumentError, 'applied_amount cannot be nil' + end + + @applied_amount = applied_amount + end + + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + @type = type + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -167,61 +193,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -238,24 +209,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/credit_type_enum.rb b/BillingApi/lib/pnap_billing_api/models/credit_type_enum.rb index 7fefb741..e0720365 100644 --- a/BillingApi/lib/pnap_billing_api/models/credit_type_enum.rb +++ b/BillingApi/lib/pnap_billing_api/models/credit_type_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BillingApi/lib/pnap_billing_api/models/discount_details.rb b/BillingApi/lib/pnap_billing_api/models/discount_details.rb index 80e96de1..3eefb1db 100644 --- a/BillingApi/lib/pnap_billing_api/models/discount_details.rb +++ b/BillingApi/lib/pnap_billing_api/models/discount_details.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BillingApi # Represents the details of a discount applied to a product or charge. - class DiscountDetails + class DiscountDetails < ApiModelBase # A unique code associated with the discount. attr_accessor :code @@ -55,9 +55,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -83,9 +88,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::DiscountDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::DiscountDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -139,6 +145,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] code Value to be assigned + def code=(code) + if code.nil? + fail ArgumentError, 'code cannot be nil' + end + + @code = code + end + + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + @type = type + end + + # Custom attribute writer method with validation + # @param [Object] value Value to be assigned + def value=(value) + if value.nil? + fail ArgumentError, 'value cannot be nil' + end + + @value = value + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -184,61 +220,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -255,24 +236,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/discount_type_enum.rb b/BillingApi/lib/pnap_billing_api/models/discount_type_enum.rb index 03e03db4..eef750b6 100644 --- a/BillingApi/lib/pnap_billing_api/models/discount_type_enum.rb +++ b/BillingApi/lib/pnap_billing_api/models/discount_type_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BillingApi/lib/pnap_billing_api/models/error.rb b/BillingApi/lib/pnap_billing_api/models/error.rb index 69233e68..126b40bf 100644 --- a/BillingApi/lib/pnap_billing_api/models/error.rb +++ b/BillingApi/lib/pnap_billing_api/models/error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module BillingApi - class Error + class Error < ApiModelBase # The description detailing the cause of the error code. attr_accessor :message @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::Error`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -96,6 +102,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] message Value to be assigned + def message=(message) + if message.nil? + fail ArgumentError, 'message cannot be nil' + end + + @message = message + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -140,61 +156,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -211,24 +172,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/gpu_configuration_metadata.rb b/BillingApi/lib/pnap_billing_api/models/gpu_configuration_metadata.rb index b947e468..2312d680 100644 --- a/BillingApi/lib/pnap_billing_api/models/gpu_configuration_metadata.rb +++ b/BillingApi/lib/pnap_billing_api/models/gpu_configuration_metadata.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BillingApi # GPU configuration details. - class GpuConfigurationMetadata + class GpuConfigurationMetadata < ApiModelBase # GPU card count. attr_accessor :count @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::GpuConfigurationMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::GpuConfigurationMetadata`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -132,61 +138,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -203,24 +154,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/location_availability_detail.rb b/BillingApi/lib/pnap_billing_api/models/location_availability_detail.rb index 55c79a9b..f7ef1eb4 100644 --- a/BillingApi/lib/pnap_billing_api/models/location_availability_detail.rb +++ b/BillingApi/lib/pnap_billing_api/models/location_availability_detail.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BillingApi # Info about location, solutions and availability for a product. - class LocationAvailabilityDetail + class LocationAvailabilityDetail < ApiModelBase attr_accessor :location # Requested quantity. @@ -63,15 +63,20 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. def self.openapi_types { - :'location' => :'LocationEnum', + :'location' => :'ProductLocationEnum', :'min_quantity_requested' => :'Float', :'min_quantity_available' => :'Boolean', :'available_quantity' => :'Float', @@ -93,9 +98,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::LocationAvailabilityDetail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::LocationAvailabilityDetail`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -173,6 +179,46 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + + # Custom attribute writer method with validation + # @param [Object] min_quantity_requested Value to be assigned + def min_quantity_requested=(min_quantity_requested) + if min_quantity_requested.nil? + fail ArgumentError, 'min_quantity_requested cannot be nil' + end + + @min_quantity_requested = min_quantity_requested + end + + # Custom attribute writer method with validation + # @param [Object] min_quantity_available Value to be assigned + def min_quantity_available=(min_quantity_available) + if min_quantity_available.nil? + fail ArgumentError, 'min_quantity_available cannot be nil' + end + + @min_quantity_available = min_quantity_available + end + + # Custom attribute writer method with validation + # @param [Object] available_quantity Value to be assigned + def available_quantity=(available_quantity) + if available_quantity.nil? + fail ArgumentError, 'available_quantity cannot be nil' + end + + @available_quantity = available_quantity + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -220,61 +266,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -291,24 +282,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/location_enum.rb b/BillingApi/lib/pnap_billing_api/models/location_enum.rb index 9bfb7667..eb023e58 100644 --- a/BillingApi/lib/pnap_billing_api/models/location_enum.rb +++ b/BillingApi/lib/pnap_billing_api/models/location_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BillingApi/lib/pnap_billing_api/models/operating_system_details.rb b/BillingApi/lib/pnap_billing_api/models/operating_system_details.rb index 57006783..8bff4cdd 100644 --- a/BillingApi/lib/pnap_billing_api/models/operating_system_details.rb +++ b/BillingApi/lib/pnap_billing_api/models/operating_system_details.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BillingApi # Details of the operating system associated with this rated usage record. - class OperatingSystemDetails + class OperatingSystemDetails < ApiModelBase # Number of cores. attr_accessor :cores @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::OperatingSystemDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::OperatingSystemDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -102,6 +108,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] cores Value to be assigned + def cores=(cores) + if cores.nil? + fail ArgumentError, 'cores cannot be nil' + end + + @cores = cores + end + + # Custom attribute writer method with validation + # @param [Object] correlation_id Value to be assigned + def correlation_id=(correlation_id) + if correlation_id.nil? + fail ArgumentError, 'correlation_id cannot be nil' + end + + @correlation_id = correlation_id + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -146,61 +172,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -217,24 +188,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/operating_system_record.rb b/BillingApi/lib/pnap_billing_api/models/operating_system_record.rb index 6cf24b7d..495d5b18 100644 --- a/BillingApi/lib/pnap_billing_api/models/operating_system_record.rb +++ b/BillingApi/lib/pnap_billing_api/models/operating_system_record.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module BillingApi - class OperatingSystemRecord + class OperatingSystemRecord < ApiModelBase # The unique identifier of the rated usage record. attr_accessor :id @@ -67,6 +67,8 @@ class OperatingSystemRecord # Reservation id associated with this rated usage record. attr_accessor :reservation_id + attr_accessor :reservation_details + attr_accessor :discount_details attr_accessor :credit_details @@ -116,15 +118,21 @@ def self.attribute_map :'usage_session_id' => :'usageSessionId', :'correlation_id' => :'correlationId', :'reservation_id' => :'reservationId', + :'reservation_details' => :'reservationDetails', :'discount_details' => :'discountDetails', :'credit_details' => :'creditDetails', :'metadata' => :'metadata' } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -148,6 +156,7 @@ def self.openapi_types :'usage_session_id' => :'String', :'correlation_id' => :'String', :'reservation_id' => :'String', + :'reservation_details' => :'ReservationDetails', :'discount_details' => :'ApplicableDiscountDetails', :'credit_details' => :'Array', :'metadata' => :'OperatingSystemDetails' @@ -175,9 +184,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::OperatingSystemRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::OperatingSystemRecord`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -268,20 +278,20 @@ def initialize(attributes = {}) if attributes.key?(:'usage_session_id') self.usage_session_id = attributes[:'usage_session_id'] - else - self.usage_session_id = nil end if attributes.key?(:'correlation_id') self.correlation_id = attributes[:'correlation_id'] - else - self.correlation_id = nil end if attributes.key?(:'reservation_id') self.reservation_id = attributes[:'reservation_id'] end + if attributes.key?(:'reservation_details') + self.reservation_details = attributes[:'reservation_details'] + end + if attributes.key?(:'discount_details') self.discount_details = attributes[:'discount_details'] end @@ -352,14 +362,6 @@ def list_invalid_properties invalid_properties.push('invalid value for "active", active cannot be nil.') end - if @usage_session_id.nil? - invalid_properties.push('invalid value for "usage_session_id", usage_session_id cannot be nil.') - end - - if @correlation_id.nil? - invalid_properties.push('invalid value for "correlation_id", correlation_id cannot be nil.') - end - if @metadata.nil? invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') end @@ -383,12 +385,140 @@ def valid? return false if @unit_price_description.nil? return false if @quantity.nil? return false if @active.nil? - return false if @usage_session_id.nil? - return false if @correlation_id.nil? return false if @metadata.nil? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] product_category Value to be assigned + def product_category=(product_category) + if product_category.nil? + fail ArgumentError, 'product_category cannot be nil' + end + + @product_category = product_category + end + + # Custom attribute writer method with validation + # @param [Object] product_code Value to be assigned + def product_code=(product_code) + if product_code.nil? + fail ArgumentError, 'product_code cannot be nil' + end + + @product_code = product_code + end + + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + + # Custom attribute writer method with validation + # @param [Object] start_date_time Value to be assigned + def start_date_time=(start_date_time) + if start_date_time.nil? + fail ArgumentError, 'start_date_time cannot be nil' + end + + @start_date_time = start_date_time + end + + # Custom attribute writer method with validation + # @param [Object] end_date_time Value to be assigned + def end_date_time=(end_date_time) + if end_date_time.nil? + fail ArgumentError, 'end_date_time cannot be nil' + end + + @end_date_time = end_date_time + end + + # Custom attribute writer method with validation + # @param [Object] cost Value to be assigned + def cost=(cost) + if cost.nil? + fail ArgumentError, 'cost cannot be nil' + end + + @cost = cost + end + + # Custom attribute writer method with validation + # @param [Object] price_model Value to be assigned + def price_model=(price_model) + if price_model.nil? + fail ArgumentError, 'price_model cannot be nil' + end + + @price_model = price_model + end + + # Custom attribute writer method with validation + # @param [Object] unit_price Value to be assigned + def unit_price=(unit_price) + if unit_price.nil? + fail ArgumentError, 'unit_price cannot be nil' + end + + @unit_price = unit_price + end + + # Custom attribute writer method with validation + # @param [Object] unit_price_description Value to be assigned + def unit_price_description=(unit_price_description) + if unit_price_description.nil? + fail ArgumentError, 'unit_price_description cannot be nil' + end + + @unit_price_description = unit_price_description + end + + # Custom attribute writer method with validation + # @param [Object] quantity Value to be assigned + def quantity=(quantity) + if quantity.nil? + fail ArgumentError, 'quantity cannot be nil' + end + + @quantity = quantity + end + + # Custom attribute writer method with validation + # @param [Object] active Value to be assigned + def active=(active) + if active.nil? + fail ArgumentError, 'active cannot be nil' + end + + @active = active + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if metadata.nil? + fail ArgumentError, 'metadata cannot be nil' + end + + @metadata = metadata + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -412,6 +542,7 @@ def ==(o) usage_session_id == o.usage_session_id && correlation_id == o.correlation_id && reservation_id == o.reservation_id && + reservation_details == o.reservation_details && discount_details == o.discount_details && credit_details == o.credit_details && metadata == o.metadata @@ -426,7 +557,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, product_category, product_code, location, year_month, start_date_time, end_date_time, cost, cost_before_discount, cost_description, price_model, unit_price, unit_price_description, quantity, active, usage_session_id, correlation_id, reservation_id, discount_details, credit_details, metadata].hash + [id, product_category, product_code, location, year_month, start_date_time, end_date_time, cost, cost_before_discount, cost_description, price_model, unit_price, unit_price_description, quantity, active, usage_session_id, correlation_id, reservation_id, reservation_details, discount_details, credit_details, metadata].hash end # Builds the object from hash @@ -452,61 +583,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -523,24 +599,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/package_details.rb b/BillingApi/lib/pnap_billing_api/models/package_details.rb new file mode 100644 index 00000000..9bf97226 --- /dev/null +++ b/BillingApi/lib/pnap_billing_api/models/package_details.rb @@ -0,0 +1,179 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'date' +require 'time' + +module BillingApi + # Represents details object which contains package quantity and its unit. + class PackageDetails < ApiModelBase + attr_accessor :package_quantity + + attr_accessor :package_unit + + 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 + { + :'package_quantity' => :'packageQuantity', + :'package_unit' => :'packageUnit' + } + end + + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + acceptable_attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'package_quantity' => :'PackageQuantity', + :'package_unit' => :'PackageUnitEnum' + } + end + + # List of attributes with nullable: true + def self.openapi_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 `BillingApi::PackageDetails` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::PackageDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'package_quantity') + self.package_quantity = attributes[:'package_quantity'] + end + + if attributes.key?(:'package_unit') + self.package_unit = attributes[:'package_unit'] + 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 + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + 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? + warn '[DEPRECATED] the `valid?` method is obsolete' + 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 && + package_quantity == o.package_quantity && + package_unit == o.package_unit + 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 + [package_quantity, package_unit].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) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{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[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_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.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + end + +end diff --git a/BillingApi/lib/pnap_billing_api/models/package_quantity.rb b/BillingApi/lib/pnap_billing_api/models/package_quantity.rb new file mode 100644 index 00000000..198959da --- /dev/null +++ b/BillingApi/lib/pnap_billing_api/models/package_quantity.rb @@ -0,0 +1,193 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'date' +require 'time' + +module BillingApi + # Represents the package size per month, for a product's pricing plan, including the min quantity and max quantity information. + class PackageQuantity < ApiModelBase + # Minimum package quantity. + attr_accessor :min + + # Maximum package quantity. + attr_accessor :max + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'min' => :'min', + :'max' => :'max' + } + end + + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + acceptable_attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'min' => :'Float', + :'max' => :'Float' + } + end + + # List of attributes with nullable: true + def self.openapi_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 `BillingApi::PackageQuantity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::PackageQuantity`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'min') + self.min = attributes[:'min'] + else + self.min = nil + end + + if attributes.key?(:'max') + self.max = attributes[:'max'] + else + self.max = nil + 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 + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @min.nil? + invalid_properties.push('invalid value for "min", min cannot be nil.') + end + + if @max.nil? + invalid_properties.push('invalid value for "max", max 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? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @min.nil? + return false if @max.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] min Value to be assigned + def min=(min) + if min.nil? + fail ArgumentError, 'min cannot be nil' + end + + @min = min + end + + # Custom attribute writer method with validation + # @param [Object] max Value to be assigned + def max=(max) + if max.nil? + fail ArgumentError, 'max cannot be nil' + end + + @max = max + 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 && + min == o.min && + max == o.max + 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 + [min, max].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) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{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[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_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.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + end + +end diff --git a/BillingApi/lib/pnap_billing_api/models/package_unit_enum.rb b/BillingApi/lib/pnap_billing_api/models/package_unit_enum.rb index c08b591f..95bb0760 100644 --- a/BillingApi/lib/pnap_billing_api/models/package_unit_enum.rb +++ b/BillingApi/lib/pnap_billing_api/models/package_unit_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BillingApi/lib/pnap_billing_api/models/price_unit_enum.rb b/BillingApi/lib/pnap_billing_api/models/price_unit_enum.rb index 3de7b32e..6aaecde3 100644 --- a/BillingApi/lib/pnap_billing_api/models/price_unit_enum.rb +++ b/BillingApi/lib/pnap_billing_api/models/price_unit_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -21,9 +21,10 @@ class PriceUnitEnum UNIT = "UNIT".freeze FLAT = "FLAT".freeze TB_PER_HOUR = "TB_PER_HOUR".freeze + TB_PER_MONTH = "TB_PER_MONTH".freeze def self.all_vars - @all_vars ||= [HOUR, MONTH, GB, UNIT, FLAT, TB_PER_HOUR].freeze + @all_vars ||= [HOUR, MONTH, GB, UNIT, FLAT, TB_PER_HOUR, TB_PER_MONTH].freeze end # Builds the enum from string diff --git a/BillingApi/lib/pnap_billing_api/models/pricing_plan.rb b/BillingApi/lib/pnap_billing_api/models/pricing_plan.rb index 597ec912..7037cbbe 100644 --- a/BillingApi/lib/pnap_billing_api/models/pricing_plan.rb +++ b/BillingApi/lib/pnap_billing_api/models/pricing_plan.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BillingApi # Pricing plan details. - class PricingPlan + class PricingPlan < ApiModelBase # The SKU identifying this pricing plan. attr_accessor :sku @@ -43,6 +43,8 @@ class PricingPlan attr_accessor :package_unit + attr_accessor :package_details + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -77,13 +79,19 @@ def self.attribute_map :'applicable_discounts' => :'applicableDiscounts', :'correlated_product_code' => :'correlatedProductCode', :'package_quantity' => :'packageQuantity', - :'package_unit' => :'packageUnit' + :'package_unit' => :'packageUnit', + :'package_details' => :'packageDetails' } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -98,7 +106,8 @@ def self.openapi_types :'applicable_discounts' => :'ApplicableDiscounts', :'correlated_product_code' => :'String', :'package_quantity' => :'Float', - :'package_unit' => :'PackageUnitEnum' + :'package_unit' => :'PackageUnitEnum', + :'package_details' => :'PackageDetails' } end @@ -116,9 +125,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::PricingPlan`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::PricingPlan`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -172,6 +182,10 @@ def initialize(attributes = {}) if attributes.key?(:'package_unit') self.package_unit = attributes[:'package_unit'] end + + if attributes.key?(:'package_details') + self.package_details = attributes[:'package_details'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -208,7 +222,7 @@ def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @sku.nil? return false if @location.nil? - location_validator = EnumAttributeValidator.new('String', ["PHX", "ASH", "NLD", "SGP", "CHI", "SEA", "AUS", "GLOBAL"]) + location_validator = EnumAttributeValidator.new('String', ["PHX", "ASH", "NLD", "SGP", "CHI", "SEA", "GLOBAL"]) return false unless location_validator.valid?(@location) return false if @pricing_model.nil? pricing_model_validator = EnumAttributeValidator.new('String', ["HOURLY", "METERED", "ONE_MONTH_RESERVATION", "TWELVE_MONTHS_RESERVATION", "TWENTY_FOUR_MONTHS_RESERVATION", "THIRTY_SIX_MONTHS_RESERVATION", "MONTHLY_PACKAGE", "FREE_TIER"]) @@ -218,10 +232,20 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] sku Value to be assigned + def sku=(sku) + if sku.nil? + fail ArgumentError, 'sku cannot be nil' + end + + @sku = sku + end + # Custom attribute writer method checking allowed values (enum). # @param [Object] location Object to be assigned def location=(location) - validator = EnumAttributeValidator.new('String', ["PHX", "ASH", "NLD", "SGP", "CHI", "SEA", "AUS", "GLOBAL"]) + validator = EnumAttributeValidator.new('String', ["PHX", "ASH", "NLD", "SGP", "CHI", "SEA", "GLOBAL"]) unless validator.valid?(location) fail ArgumentError, "invalid value for \"location\", must be one of #{validator.allowable_values}." end @@ -238,6 +262,26 @@ def pricing_model=(pricing_model) @pricing_model = pricing_model end + # Custom attribute writer method with validation + # @param [Object] price Value to be assigned + def price=(price) + if price.nil? + fail ArgumentError, 'price cannot be nil' + end + + @price = price + end + + # Custom attribute writer method with validation + # @param [Object] price_unit Value to be assigned + def price_unit=(price_unit) + if price_unit.nil? + fail ArgumentError, 'price_unit cannot be nil' + end + + @price_unit = price_unit + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -252,7 +296,8 @@ def ==(o) applicable_discounts == o.applicable_discounts && correlated_product_code == o.correlated_product_code && package_quantity == o.package_quantity && - package_unit == o.package_unit + package_unit == o.package_unit && + package_details == o.package_details end # @see the `==` method @@ -264,7 +309,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [sku, sku_description, location, pricing_model, price, price_unit, applicable_discounts, correlated_product_code, package_quantity, package_unit].hash + [sku, sku_description, location, pricing_model, price, price_unit, applicable_discounts, correlated_product_code, package_quantity, package_unit, package_details].hash end # Builds the object from hash @@ -290,61 +335,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -361,24 +351,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/product.rb b/BillingApi/lib/pnap_billing_api/models/product.rb index c46400f4..ae908f7d 100644 --- a/BillingApi/lib/pnap_billing_api/models/product.rb +++ b/BillingApi/lib/pnap_billing_api/models/product.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BillingApi # Product details - class Product + class Product < ApiModelBase # The code identifying the product. This code has significant across all locations. attr_accessor :product_code @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::Product`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::Product`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -113,6 +119,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] product_code Value to be assigned + def product_code=(product_code) + if product_code.nil? + fail ArgumentError, 'product_code cannot be nil' + end + + @product_code = product_code + end + + # Custom attribute writer method with validation + # @param [Object] product_category Value to be assigned + def product_category=(product_category) + if product_category.nil? + fail ArgumentError, 'product_category cannot be nil' + end + + @product_category = product_category + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -158,61 +184,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -229,24 +200,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/product_availability.rb b/BillingApi/lib/pnap_billing_api/models/product_availability.rb index 1164a827..7db6272e 100644 --- a/BillingApi/lib/pnap_billing_api/models/product_availability.rb +++ b/BillingApi/lib/pnap_billing_api/models/product_availability.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BillingApi # Product availability details. - class ProductAvailability + class ProductAvailability < ApiModelBase # Product code. attr_accessor :product_code @@ -33,9 +33,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -61,9 +66,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::ProductAvailability`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ProductAvailability`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -119,6 +125,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] product_code Value to be assigned + def product_code=(product_code) + if product_code.nil? + fail ArgumentError, 'product_code cannot be nil' + end + + @product_code = product_code + end + + # Custom attribute writer method with validation + # @param [Object] product_category Value to be assigned + def product_category=(product_category) + if product_category.nil? + fail ArgumentError, 'product_category cannot be nil' + end + + @product_category = product_category + end + + # Custom attribute writer method with validation + # @param [Object] location_availability_details Value to be assigned + def location_availability_details=(location_availability_details) + if location_availability_details.nil? + fail ArgumentError, 'location_availability_details cannot be nil' + end + + @location_availability_details = location_availability_details + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -164,61 +200,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -235,24 +216,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/product_category_enum.rb b/BillingApi/lib/pnap_billing_api/models/product_category_enum.rb index 7a2b7b36..4a00ceb4 100644 --- a/BillingApi/lib/pnap_billing_api/models/product_category_enum.rb +++ b/BillingApi/lib/pnap_billing_api/models/product_category_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BillingApi/lib/pnap_billing_api/models/product_location_enum.rb b/BillingApi/lib/pnap_billing_api/models/product_location_enum.rb new file mode 100644 index 00000000..52256389 --- /dev/null +++ b/BillingApi/lib/pnap_billing_api/models/product_location_enum.rb @@ -0,0 +1,44 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'date' +require 'time' + +module BillingApi + class ProductLocationEnum + PHX = "PHX".freeze + ASH = "ASH".freeze + NLD = "NLD".freeze + SGP = "SGP".freeze + CHI = "CHI".freeze + SEA = "SEA".freeze + + def self.all_vars + @all_vars ||= [PHX, ASH, NLD, SGP, CHI, SEA].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if ProductLocationEnum.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #ProductLocationEnum" + end + end +end diff --git a/BillingApi/lib/pnap_billing_api/models/products_get200_response_inner.rb b/BillingApi/lib/pnap_billing_api/models/products_get200_response_inner.rb index 9d802900..6921e493 100644 --- a/BillingApi/lib/pnap_billing_api/models/products_get200_response_inner.rb +++ b/BillingApi/lib/pnap_billing_api/models/products_get200_response_inner.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -57,5 +57,4 @@ def build(data) end end end - end diff --git a/BillingApi/lib/pnap_billing_api/models/promo_credit_details.rb b/BillingApi/lib/pnap_billing_api/models/promo_credit_details.rb index 84dea626..821a8d41 100644 --- a/BillingApi/lib/pnap_billing_api/models/promo_credit_details.rb +++ b/BillingApi/lib/pnap_billing_api/models/promo_credit_details.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module BillingApi - class PromoCreditDetails + class PromoCreditDetails < ApiModelBase # Amount applied. attr_accessor :applied_amount @@ -58,9 +58,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -94,9 +99,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::PromoCreditDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::PromoCreditDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -161,6 +167,46 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] applied_amount Value to be assigned + def applied_amount=(applied_amount) + if applied_amount.nil? + fail ArgumentError, 'applied_amount cannot be nil' + end + + @applied_amount = applied_amount + end + + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + @type = type + end + + # Custom attribute writer method with validation + # @param [Object] coupon_id Value to be assigned + def coupon_id=(coupon_id) + if coupon_id.nil? + fail ArgumentError, 'coupon_id cannot be nil' + end + + @coupon_id = coupon_id + end + + # Custom attribute writer method with validation + # @param [Object] coupon_code Value to be assigned + def coupon_code=(coupon_code) + if coupon_code.nil? + fail ArgumentError, 'coupon_code cannot be nil' + end + + @coupon_code = coupon_code + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -207,61 +253,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -278,24 +269,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/public_subnet_details.rb b/BillingApi/lib/pnap_billing_api/models/public_subnet_details.rb index 78034c50..0ea16530 100644 --- a/BillingApi/lib/pnap_billing_api/models/public_subnet_details.rb +++ b/BillingApi/lib/pnap_billing_api/models/public_subnet_details.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BillingApi # Details of public subnets. - class PublicSubnetDetails + class PublicSubnetDetails < ApiModelBase # Public Subnet identifier as returned by the BMC API. attr_accessor :id @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::PublicSubnetDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::PublicSubnetDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -111,6 +117,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] cidr Value to be assigned + def cidr=(cidr) + if cidr.nil? + fail ArgumentError, 'cidr cannot be nil' + end + + @cidr = cidr + end + + # Custom attribute writer method with validation + # @param [Object] size Value to be assigned + def size=(size) + if size.nil? + fail ArgumentError, 'size cannot be nil' + end + + @size = size + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -156,61 +182,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -227,24 +198,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/public_subnet_record.rb b/BillingApi/lib/pnap_billing_api/models/public_subnet_record.rb index 81d9e9f8..269546ba 100644 --- a/BillingApi/lib/pnap_billing_api/models/public_subnet_record.rb +++ b/BillingApi/lib/pnap_billing_api/models/public_subnet_record.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module BillingApi - class PublicSubnetRecord + class PublicSubnetRecord < ApiModelBase # The unique identifier of the rated usage record. attr_accessor :id @@ -67,6 +67,8 @@ class PublicSubnetRecord # Reservation id associated with this rated usage record. attr_accessor :reservation_id + attr_accessor :reservation_details + attr_accessor :discount_details attr_accessor :credit_details @@ -116,15 +118,21 @@ def self.attribute_map :'usage_session_id' => :'usageSessionId', :'correlation_id' => :'correlationId', :'reservation_id' => :'reservationId', + :'reservation_details' => :'reservationDetails', :'discount_details' => :'discountDetails', :'credit_details' => :'creditDetails', :'metadata' => :'metadata' } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -148,6 +156,7 @@ def self.openapi_types :'usage_session_id' => :'String', :'correlation_id' => :'String', :'reservation_id' => :'String', + :'reservation_details' => :'ReservationDetails', :'discount_details' => :'ApplicableDiscountDetails', :'credit_details' => :'Array', :'metadata' => :'PublicSubnetDetails' @@ -175,9 +184,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::PublicSubnetRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::PublicSubnetRecord`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -268,20 +278,20 @@ def initialize(attributes = {}) if attributes.key?(:'usage_session_id') self.usage_session_id = attributes[:'usage_session_id'] - else - self.usage_session_id = nil end if attributes.key?(:'correlation_id') self.correlation_id = attributes[:'correlation_id'] - else - self.correlation_id = nil end if attributes.key?(:'reservation_id') self.reservation_id = attributes[:'reservation_id'] end + if attributes.key?(:'reservation_details') + self.reservation_details = attributes[:'reservation_details'] + end + if attributes.key?(:'discount_details') self.discount_details = attributes[:'discount_details'] end @@ -352,14 +362,6 @@ def list_invalid_properties invalid_properties.push('invalid value for "active", active cannot be nil.') end - if @usage_session_id.nil? - invalid_properties.push('invalid value for "usage_session_id", usage_session_id cannot be nil.') - end - - if @correlation_id.nil? - invalid_properties.push('invalid value for "correlation_id", correlation_id cannot be nil.') - end - if @metadata.nil? invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') end @@ -383,12 +385,140 @@ def valid? return false if @unit_price_description.nil? return false if @quantity.nil? return false if @active.nil? - return false if @usage_session_id.nil? - return false if @correlation_id.nil? return false if @metadata.nil? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] product_category Value to be assigned + def product_category=(product_category) + if product_category.nil? + fail ArgumentError, 'product_category cannot be nil' + end + + @product_category = product_category + end + + # Custom attribute writer method with validation + # @param [Object] product_code Value to be assigned + def product_code=(product_code) + if product_code.nil? + fail ArgumentError, 'product_code cannot be nil' + end + + @product_code = product_code + end + + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + + # Custom attribute writer method with validation + # @param [Object] start_date_time Value to be assigned + def start_date_time=(start_date_time) + if start_date_time.nil? + fail ArgumentError, 'start_date_time cannot be nil' + end + + @start_date_time = start_date_time + end + + # Custom attribute writer method with validation + # @param [Object] end_date_time Value to be assigned + def end_date_time=(end_date_time) + if end_date_time.nil? + fail ArgumentError, 'end_date_time cannot be nil' + end + + @end_date_time = end_date_time + end + + # Custom attribute writer method with validation + # @param [Object] cost Value to be assigned + def cost=(cost) + if cost.nil? + fail ArgumentError, 'cost cannot be nil' + end + + @cost = cost + end + + # Custom attribute writer method with validation + # @param [Object] price_model Value to be assigned + def price_model=(price_model) + if price_model.nil? + fail ArgumentError, 'price_model cannot be nil' + end + + @price_model = price_model + end + + # Custom attribute writer method with validation + # @param [Object] unit_price Value to be assigned + def unit_price=(unit_price) + if unit_price.nil? + fail ArgumentError, 'unit_price cannot be nil' + end + + @unit_price = unit_price + end + + # Custom attribute writer method with validation + # @param [Object] unit_price_description Value to be assigned + def unit_price_description=(unit_price_description) + if unit_price_description.nil? + fail ArgumentError, 'unit_price_description cannot be nil' + end + + @unit_price_description = unit_price_description + end + + # Custom attribute writer method with validation + # @param [Object] quantity Value to be assigned + def quantity=(quantity) + if quantity.nil? + fail ArgumentError, 'quantity cannot be nil' + end + + @quantity = quantity + end + + # Custom attribute writer method with validation + # @param [Object] active Value to be assigned + def active=(active) + if active.nil? + fail ArgumentError, 'active cannot be nil' + end + + @active = active + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if metadata.nil? + fail ArgumentError, 'metadata cannot be nil' + end + + @metadata = metadata + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -412,6 +542,7 @@ def ==(o) usage_session_id == o.usage_session_id && correlation_id == o.correlation_id && reservation_id == o.reservation_id && + reservation_details == o.reservation_details && discount_details == o.discount_details && credit_details == o.credit_details && metadata == o.metadata @@ -426,7 +557,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, product_category, product_code, location, year_month, start_date_time, end_date_time, cost, cost_before_discount, cost_description, price_model, unit_price, unit_price_description, quantity, active, usage_session_id, correlation_id, reservation_id, discount_details, credit_details, metadata].hash + [id, product_category, product_code, location, year_month, start_date_time, end_date_time, cost, cost_before_discount, cost_description, price_model, unit_price, unit_price_description, quantity, active, usage_session_id, correlation_id, reservation_id, reservation_details, discount_details, credit_details, metadata].hash end # Builds the object from hash @@ -452,61 +583,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -523,24 +599,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/quantity.rb b/BillingApi/lib/pnap_billing_api/models/quantity.rb new file mode 100644 index 00000000..93dbbccd --- /dev/null +++ b/BillingApi/lib/pnap_billing_api/models/quantity.rb @@ -0,0 +1,223 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'date' +require 'time' + +module BillingApi + # Represents the quantity. + class Quantity < ApiModelBase + # Quantity size. + attr_accessor :quantity + + attr_accessor :unit + + 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 + { + :'quantity' => :'quantity', + :'unit' => :'unit' + } + end + + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + acceptable_attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Float', + :'unit' => :'QuantityUnitEnum' + } + end + + # List of attributes with nullable: true + def self.openapi_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 `BillingApi::Quantity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::Quantity`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + else + self.quantity = nil + end + + if attributes.key?(:'unit') + self.unit = attributes[:'unit'] + else + self.unit = nil + 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 + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @quantity.nil? + invalid_properties.push('invalid value for "quantity", quantity cannot be nil.') + end + + if @quantity < 1 + invalid_properties.push('invalid value for "quantity", must be greater than or equal to 1.') + end + + if @unit.nil? + invalid_properties.push('invalid value for "unit", unit 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? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @quantity.nil? + return false if @quantity < 1 + return false if @unit.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] quantity Value to be assigned + def quantity=(quantity) + if quantity.nil? + fail ArgumentError, 'quantity cannot be nil' + end + + if quantity < 1 + fail ArgumentError, 'invalid value for "quantity", must be greater than or equal to 1.' + end + + @quantity = quantity + end + + # Custom attribute writer method with validation + # @param [Object] unit Value to be assigned + def unit=(unit) + if unit.nil? + fail ArgumentError, 'unit cannot be nil' + end + + @unit = unit + 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 && + quantity == o.quantity && + unit == o.unit + 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 + [quantity, unit].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) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{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[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_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.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + end + +end diff --git a/BillingApi/lib/pnap_billing_api/models/quantity_unit_enum.rb b/BillingApi/lib/pnap_billing_api/models/quantity_unit_enum.rb new file mode 100644 index 00000000..b278bc4a --- /dev/null +++ b/BillingApi/lib/pnap_billing_api/models/quantity_unit_enum.rb @@ -0,0 +1,40 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'date' +require 'time' + +module BillingApi + class QuantityUnitEnum + TB = "TB".freeze + COUNT = "COUNT".freeze + + def self.all_vars + @all_vars ||= [TB, COUNT].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if QuantityUnitEnum.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #QuantityUnitEnum" + end + end +end diff --git a/BillingApi/lib/pnap_billing_api/models/rated_usage_get200_response_inner.rb b/BillingApi/lib/pnap_billing_api/models/rated_usage_get200_response_inner.rb index 1244d28e..b19bccd5 100644 --- a/BillingApi/lib/pnap_billing_api/models/rated_usage_get200_response_inner.rb +++ b/BillingApi/lib/pnap_billing_api/models/rated_usage_get200_response_inner.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -60,5 +60,4 @@ def build(data) end end end - end diff --git a/BillingApi/lib/pnap_billing_api/models/rated_usage_product_category_enum.rb b/BillingApi/lib/pnap_billing_api/models/rated_usage_product_category_enum.rb index a98283cb..ba451aa4 100644 --- a/BillingApi/lib/pnap_billing_api/models/rated_usage_product_category_enum.rb +++ b/BillingApi/lib/pnap_billing_api/models/rated_usage_product_category_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BillingApi/lib/pnap_billing_api/models/rated_usage_record.rb b/BillingApi/lib/pnap_billing_api/models/rated_usage_record.rb index 672dabb4..aefbc958 100644 --- a/BillingApi/lib/pnap_billing_api/models/rated_usage_record.rb +++ b/BillingApi/lib/pnap_billing_api/models/rated_usage_record.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BillingApi # Rated usage record. - class RatedUsageRecord + class RatedUsageRecord < ApiModelBase # The unique identifier of the rated usage record. attr_accessor :id @@ -68,6 +68,8 @@ class RatedUsageRecord # Reservation id associated with this rated usage record. attr_accessor :reservation_id + attr_accessor :reservation_details + attr_accessor :discount_details attr_accessor :credit_details @@ -115,14 +117,20 @@ def self.attribute_map :'usage_session_id' => :'usageSessionId', :'correlation_id' => :'correlationId', :'reservation_id' => :'reservationId', + :'reservation_details' => :'reservationDetails', :'discount_details' => :'discountDetails', :'credit_details' => :'creditDetails' } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -146,6 +154,7 @@ def self.openapi_types :'usage_session_id' => :'String', :'correlation_id' => :'String', :'reservation_id' => :'String', + :'reservation_details' => :'ReservationDetails', :'discount_details' => :'ApplicableDiscountDetails', :'credit_details' => :'Array' } @@ -165,9 +174,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::RatedUsageRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::RatedUsageRecord`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -258,20 +268,20 @@ def initialize(attributes = {}) if attributes.key?(:'usage_session_id') self.usage_session_id = attributes[:'usage_session_id'] - else - self.usage_session_id = nil end if attributes.key?(:'correlation_id') self.correlation_id = attributes[:'correlation_id'] - else - self.correlation_id = nil end if attributes.key?(:'reservation_id') self.reservation_id = attributes[:'reservation_id'] end + if attributes.key?(:'reservation_details') + self.reservation_details = attributes[:'reservation_details'] + end + if attributes.key?(:'discount_details') self.discount_details = attributes[:'discount_details'] end @@ -336,14 +346,6 @@ def list_invalid_properties invalid_properties.push('invalid value for "active", active cannot be nil.') end - if @usage_session_id.nil? - invalid_properties.push('invalid value for "usage_session_id", usage_session_id cannot be nil.') - end - - if @correlation_id.nil? - invalid_properties.push('invalid value for "correlation_id", correlation_id cannot be nil.') - end - invalid_properties end @@ -363,11 +365,129 @@ def valid? return false if @unit_price_description.nil? return false if @quantity.nil? return false if @active.nil? - return false if @usage_session_id.nil? - return false if @correlation_id.nil? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] product_category Value to be assigned + def product_category=(product_category) + if product_category.nil? + fail ArgumentError, 'product_category cannot be nil' + end + + @product_category = product_category + end + + # Custom attribute writer method with validation + # @param [Object] product_code Value to be assigned + def product_code=(product_code) + if product_code.nil? + fail ArgumentError, 'product_code cannot be nil' + end + + @product_code = product_code + end + + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + + # Custom attribute writer method with validation + # @param [Object] start_date_time Value to be assigned + def start_date_time=(start_date_time) + if start_date_time.nil? + fail ArgumentError, 'start_date_time cannot be nil' + end + + @start_date_time = start_date_time + end + + # Custom attribute writer method with validation + # @param [Object] end_date_time Value to be assigned + def end_date_time=(end_date_time) + if end_date_time.nil? + fail ArgumentError, 'end_date_time cannot be nil' + end + + @end_date_time = end_date_time + end + + # Custom attribute writer method with validation + # @param [Object] cost Value to be assigned + def cost=(cost) + if cost.nil? + fail ArgumentError, 'cost cannot be nil' + end + + @cost = cost + end + + # Custom attribute writer method with validation + # @param [Object] price_model Value to be assigned + def price_model=(price_model) + if price_model.nil? + fail ArgumentError, 'price_model cannot be nil' + end + + @price_model = price_model + end + + # Custom attribute writer method with validation + # @param [Object] unit_price Value to be assigned + def unit_price=(unit_price) + if unit_price.nil? + fail ArgumentError, 'unit_price cannot be nil' + end + + @unit_price = unit_price + end + + # Custom attribute writer method with validation + # @param [Object] unit_price_description Value to be assigned + def unit_price_description=(unit_price_description) + if unit_price_description.nil? + fail ArgumentError, 'unit_price_description cannot be nil' + end + + @unit_price_description = unit_price_description + end + + # Custom attribute writer method with validation + # @param [Object] quantity Value to be assigned + def quantity=(quantity) + if quantity.nil? + fail ArgumentError, 'quantity cannot be nil' + end + + @quantity = quantity + end + + # Custom attribute writer method with validation + # @param [Object] active Value to be assigned + def active=(active) + if active.nil? + fail ArgumentError, 'active cannot be nil' + end + + @active = active + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -391,6 +511,7 @@ def ==(o) usage_session_id == o.usage_session_id && correlation_id == o.correlation_id && reservation_id == o.reservation_id && + reservation_details == o.reservation_details && discount_details == o.discount_details && credit_details == o.credit_details end @@ -404,7 +525,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, product_category, product_code, location, year_month, start_date_time, end_date_time, cost, cost_before_discount, cost_description, price_model, unit_price, unit_price_description, quantity, active, usage_session_id, correlation_id, reservation_id, discount_details, credit_details].hash + [id, product_category, product_code, location, year_month, start_date_time, end_date_time, cost, cost_before_discount, cost_description, price_model, unit_price, unit_price_description, quantity, active, usage_session_id, correlation_id, reservation_id, reservation_details, discount_details, credit_details].hash end # Builds the object from hash @@ -430,61 +551,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -501,24 +567,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/reservation.rb b/BillingApi/lib/pnap_billing_api/models/reservation.rb index 07496e5b..ba923cbe 100644 --- a/BillingApi/lib/pnap_billing_api/models/reservation.rb +++ b/BillingApi/lib/pnap_billing_api/models/reservation.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,11 +15,11 @@ module BillingApi # Reservation details - class Reservation + class Reservation < ApiModelBase # The reservation identifier. attr_accessor :id - # The code identifying the product. This code has significant across all locations. + # The code identifying the product. The same code is used for this product across all locations. attr_accessor :product_code attr_accessor :product_category @@ -28,8 +28,14 @@ class Reservation attr_accessor :reservation_model + attr_accessor :term + + attr_accessor :reservation_state + attr_accessor :initial_invoice_model + attr_accessor :quantity + # The point in time (in UTC) when the reservation starts. attr_accessor :start_date_time @@ -59,6 +65,8 @@ class Reservation # Next billing date for Reservation. attr_accessor :next_billing_date + attr_accessor :utilization + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -89,7 +97,10 @@ def self.attribute_map :'product_category' => :'productCategory', :'location' => :'location', :'reservation_model' => :'reservationModel', + :'term' => :'term', + :'reservation_state' => :'reservationState', :'initial_invoice_model' => :'initialInvoiceModel', + :'quantity' => :'quantity', :'start_date_time' => :'startDateTime', :'end_date_time' => :'endDateTime', :'last_renewal_date_time' => :'lastRenewalDateTime', @@ -99,13 +110,19 @@ def self.attribute_map :'price' => :'price', :'price_unit' => :'priceUnit', :'assigned_resource_id' => :'assignedResourceId', - :'next_billing_date' => :'nextBillingDate' + :'next_billing_date' => :'nextBillingDate', + :'utilization' => :'utilization' } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -116,7 +133,10 @@ def self.openapi_types :'product_category' => :'ReservationProductCategoryEnum', :'location' => :'LocationEnum', :'reservation_model' => :'ReservationModelEnum', + :'term' => :'ReservationTerm', + :'reservation_state' => :'ReservationStateEnum', :'initial_invoice_model' => :'ReservationInvoicingModelEnum', + :'quantity' => :'Quantity', :'start_date_time' => :'Time', :'end_date_time' => :'Time', :'last_renewal_date_time' => :'Time', @@ -126,7 +146,8 @@ def self.openapi_types :'price' => :'Float', :'price_unit' => :'PriceUnitEnum', :'assigned_resource_id' => :'String', - :'next_billing_date' => :'Date' + :'next_billing_date' => :'Date', + :'utilization' => :'Utilization' } end @@ -144,9 +165,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::Reservation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::Reservation`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -181,10 +203,26 @@ def initialize(attributes = {}) self.reservation_model = nil end + if attributes.key?(:'term') + self.term = attributes[:'term'] + end + + if attributes.key?(:'reservation_state') + self.reservation_state = attributes[:'reservation_state'] + else + self.reservation_state = nil + end + if attributes.key?(:'initial_invoice_model') self.initial_invoice_model = attributes[:'initial_invoice_model'] end + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + else + self.quantity = nil + end + if attributes.key?(:'start_date_time') self.start_date_time = attributes[:'start_date_time'] else @@ -234,6 +272,10 @@ def initialize(attributes = {}) if attributes.key?(:'next_billing_date') self.next_billing_date = attributes[:'next_billing_date'] end + + if attributes.key?(:'utilization') + self.utilization = attributes[:'utilization'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -261,6 +303,14 @@ def list_invalid_properties invalid_properties.push('invalid value for "reservation_model", reservation_model cannot be nil.') end + if @reservation_state.nil? + invalid_properties.push('invalid value for "reservation_state", reservation_state cannot be nil.') + end + + if @quantity.nil? + invalid_properties.push('invalid value for "quantity", quantity cannot be nil.') + end + if @start_date_time.nil? invalid_properties.push('invalid value for "start_date_time", start_date_time cannot be nil.') end @@ -293,6 +343,8 @@ def valid? return false if @product_category.nil? return false if @location.nil? return false if @reservation_model.nil? + return false if @reservation_state.nil? + return false if @quantity.nil? return false if @start_date_time.nil? return false if @auto_renew.nil? return false if @sku.nil? @@ -301,6 +353,126 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] product_code Value to be assigned + def product_code=(product_code) + if product_code.nil? + fail ArgumentError, 'product_code cannot be nil' + end + + @product_code = product_code + end + + # Custom attribute writer method with validation + # @param [Object] product_category Value to be assigned + def product_category=(product_category) + if product_category.nil? + fail ArgumentError, 'product_category cannot be nil' + end + + @product_category = product_category + end + + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + + # Custom attribute writer method with validation + # @param [Object] reservation_model Value to be assigned + def reservation_model=(reservation_model) + if reservation_model.nil? + fail ArgumentError, 'reservation_model cannot be nil' + end + + @reservation_model = reservation_model + end + + # Custom attribute writer method with validation + # @param [Object] reservation_state Value to be assigned + def reservation_state=(reservation_state) + if reservation_state.nil? + fail ArgumentError, 'reservation_state cannot be nil' + end + + @reservation_state = reservation_state + end + + # Custom attribute writer method with validation + # @param [Object] quantity Value to be assigned + def quantity=(quantity) + if quantity.nil? + fail ArgumentError, 'quantity cannot be nil' + end + + @quantity = quantity + end + + # Custom attribute writer method with validation + # @param [Object] start_date_time Value to be assigned + def start_date_time=(start_date_time) + if start_date_time.nil? + fail ArgumentError, 'start_date_time cannot be nil' + end + + @start_date_time = start_date_time + end + + # Custom attribute writer method with validation + # @param [Object] auto_renew Value to be assigned + def auto_renew=(auto_renew) + if auto_renew.nil? + fail ArgumentError, 'auto_renew cannot be nil' + end + + @auto_renew = auto_renew + end + + # Custom attribute writer method with validation + # @param [Object] sku Value to be assigned + def sku=(sku) + if sku.nil? + fail ArgumentError, 'sku cannot be nil' + end + + @sku = sku + end + + # Custom attribute writer method with validation + # @param [Object] price Value to be assigned + def price=(price) + if price.nil? + fail ArgumentError, 'price cannot be nil' + end + + @price = price + end + + # Custom attribute writer method with validation + # @param [Object] price_unit Value to be assigned + def price_unit=(price_unit) + if price_unit.nil? + fail ArgumentError, 'price_unit cannot be nil' + end + + @price_unit = price_unit + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -311,7 +483,10 @@ def ==(o) product_category == o.product_category && location == o.location && reservation_model == o.reservation_model && + term == o.term && + reservation_state == o.reservation_state && initial_invoice_model == o.initial_invoice_model && + quantity == o.quantity && start_date_time == o.start_date_time && end_date_time == o.end_date_time && last_renewal_date_time == o.last_renewal_date_time && @@ -321,7 +496,8 @@ def ==(o) price == o.price && price_unit == o.price_unit && assigned_resource_id == o.assigned_resource_id && - next_billing_date == o.next_billing_date + next_billing_date == o.next_billing_date && + utilization == o.utilization end # @see the `==` method @@ -333,7 +509,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, product_code, product_category, location, reservation_model, initial_invoice_model, start_date_time, end_date_time, last_renewal_date_time, next_renewal_date_time, auto_renew, sku, price, price_unit, assigned_resource_id, next_billing_date].hash + [id, product_code, product_category, location, reservation_model, term, reservation_state, initial_invoice_model, quantity, start_date_time, end_date_time, last_renewal_date_time, next_renewal_date_time, auto_renew, sku, price, price_unit, assigned_resource_id, next_billing_date, utilization].hash end # Builds the object from hash @@ -359,61 +535,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -430,24 +551,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/reservation_auto_renew_disable_request.rb b/BillingApi/lib/pnap_billing_api/models/reservation_auto_renew_disable_request.rb index 3e90d103..8f3a514d 100644 --- a/BillingApi/lib/pnap_billing_api/models/reservation_auto_renew_disable_request.rb +++ b/BillingApi/lib/pnap_billing_api/models/reservation_auto_renew_disable_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BillingApi # Disabling auto-renewal for reservation request. - class ReservationAutoRenewDisableRequest + class ReservationAutoRenewDisableRequest < ApiModelBase attr_accessor :auto_renew_disable_reason # Attribute mapping from ruby-style variable name to JSON key. @@ -25,9 +25,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::ReservationAutoRenewDisableRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ReservationAutoRenewDisableRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -121,61 +127,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -192,24 +143,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/reservation_details.rb b/BillingApi/lib/pnap_billing_api/models/reservation_details.rb new file mode 100644 index 00000000..1e367b2e --- /dev/null +++ b/BillingApi/lib/pnap_billing_api/models/reservation_details.rb @@ -0,0 +1,158 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'date' +require 'time' + +module BillingApi + # Details of a Reservation entry inside Rated Usage. + class ReservationDetails < ApiModelBase + # The Reservation identifier. + attr_accessor :id + + attr_accessor :quantity + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'quantity' => :'quantity' + } + end + + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + acceptable_attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'quantity' => :'Quantity' + } + end + + # List of attributes with nullable: true + def self.openapi_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 `BillingApi::ReservationDetails` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ReservationDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + 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 + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + 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? + warn '[DEPRECATED] the `valid?` method is obsolete' + 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 && + quantity == o.quantity + 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, quantity].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) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{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[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_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.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + end + +end diff --git a/BillingApi/lib/pnap_billing_api/models/reservation_invoicing_model_enum.rb b/BillingApi/lib/pnap_billing_api/models/reservation_invoicing_model_enum.rb index 2a1c4030..f94dcbc6 100644 --- a/BillingApi/lib/pnap_billing_api/models/reservation_invoicing_model_enum.rb +++ b/BillingApi/lib/pnap_billing_api/models/reservation_invoicing_model_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BillingApi/lib/pnap_billing_api/models/reservation_model_enum.rb b/BillingApi/lib/pnap_billing_api/models/reservation_model_enum.rb index ec90c6ed..dd56430a 100644 --- a/BillingApi/lib/pnap_billing_api/models/reservation_model_enum.rb +++ b/BillingApi/lib/pnap_billing_api/models/reservation_model_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -19,10 +19,11 @@ class ReservationModelEnum TWELVE_MONTHS_RESERVATION = "TWELVE_MONTHS_RESERVATION".freeze TWENTY_FOUR_MONTHS_RESERVATION = "TWENTY_FOUR_MONTHS_RESERVATION".freeze THIRTY_SIX_MONTHS_RESERVATION = "THIRTY_SIX_MONTHS_RESERVATION".freeze + CUSTOM_TERM = "CUSTOM_TERM".freeze FREE_TIER = "FREE_TIER".freeze def self.all_vars - @all_vars ||= [ONE_MONTH_RESERVATION, TWELVE_MONTHS_RESERVATION, TWENTY_FOUR_MONTHS_RESERVATION, THIRTY_SIX_MONTHS_RESERVATION, FREE_TIER].freeze + @all_vars ||= [ONE_MONTH_RESERVATION, TWELVE_MONTHS_RESERVATION, TWENTY_FOUR_MONTHS_RESERVATION, THIRTY_SIX_MONTHS_RESERVATION, CUSTOM_TERM, FREE_TIER].freeze end # Builds the enum from string diff --git a/BillingApi/lib/pnap_billing_api/models/reservation_product_category_enum.rb b/BillingApi/lib/pnap_billing_api/models/reservation_product_category_enum.rb index 1227d438..9d727079 100644 --- a/BillingApi/lib/pnap_billing_api/models/reservation_product_category_enum.rb +++ b/BillingApi/lib/pnap_billing_api/models/reservation_product_category_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -17,9 +17,10 @@ module BillingApi class ReservationProductCategoryEnum SERVER = "server".freeze BANDWIDTH = "bandwidth".freeze + STORAGE = "storage".freeze def self.all_vars - @all_vars ||= [SERVER, BANDWIDTH].freeze + @all_vars ||= [SERVER, BANDWIDTH, STORAGE].freeze end # Builds the enum from string diff --git a/BillingApi/lib/pnap_billing_api/models/reservation_request.rb b/BillingApi/lib/pnap_billing_api/models/reservation_request.rb index 98fbd451..86af5d30 100644 --- a/BillingApi/lib/pnap_billing_api/models/reservation_request.rb +++ b/BillingApi/lib/pnap_billing_api/models/reservation_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,26 +15,35 @@ module BillingApi # Reservation request. - class ReservationRequest + class ReservationRequest < ApiModelBase # The sku code of product pricing plan. attr_accessor :sku + attr_accessor :quantity + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'sku' => :'sku' + :'sku' => :'sku', + :'quantity' => :'quantity' } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. def self.openapi_types { - :'sku' => :'String' + :'sku' => :'String', + :'quantity' => :'Quantity' } end @@ -52,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::ReservationRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ReservationRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -64,6 +74,12 @@ def initialize(attributes = {}) else self.sku = nil end + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + else + self.quantity = nil + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -75,6 +91,10 @@ def list_invalid_properties invalid_properties.push('invalid value for "sku", sku cannot be nil.') end + if @quantity.nil? + invalid_properties.push('invalid value for "quantity", quantity cannot be nil.') + end + invalid_properties end @@ -83,15 +103,37 @@ def list_invalid_properties def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @sku.nil? + return false if @quantity.nil? true end + # Custom attribute writer method with validation + # @param [Object] sku Value to be assigned + def sku=(sku) + if sku.nil? + fail ArgumentError, 'sku cannot be nil' + end + + @sku = sku + end + + # Custom attribute writer method with validation + # @param [Object] quantity Value to be assigned + def quantity=(quantity) + if quantity.nil? + fail ArgumentError, 'quantity cannot be nil' + end + + @quantity = quantity + 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 && - sku == o.sku + sku == o.sku && + quantity == o.quantity end # @see the `==` method @@ -103,7 +145,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [sku].hash + [sku, quantity].hash end # Builds the object from hash @@ -129,61 +171,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -200,24 +187,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/reservation_state_enum.rb b/BillingApi/lib/pnap_billing_api/models/reservation_state_enum.rb new file mode 100644 index 00000000..2766765e --- /dev/null +++ b/BillingApi/lib/pnap_billing_api/models/reservation_state_enum.rb @@ -0,0 +1,44 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'date' +require 'time' + +module BillingApi + class ReservationStateEnum + REQUESTED = "REQUESTED".freeze + DECLINED = "DECLINED".freeze + IN_REVIEW = "IN_REVIEW".freeze + SETTING_UP = "SETTING_UP".freeze + ACTIVE = "ACTIVE".freeze + EXPIRED = "EXPIRED".freeze + + def self.all_vars + @all_vars ||= [REQUESTED, DECLINED, IN_REVIEW, SETTING_UP, ACTIVE, EXPIRED].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if ReservationStateEnum.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #ReservationStateEnum" + end + end +end diff --git a/BillingApi/lib/pnap_billing_api/models/reservation_term.rb b/BillingApi/lib/pnap_billing_api/models/reservation_term.rb new file mode 100644 index 00000000..20f5a784 --- /dev/null +++ b/BillingApi/lib/pnap_billing_api/models/reservation_term.rb @@ -0,0 +1,214 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'date' +require 'time' + +module BillingApi + # The Reservation term. + class ReservationTerm < ApiModelBase + # Term's length, expressed in months. + attr_accessor :length_in_months + + attr_accessor :reservation_model + + 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 + { + :'length_in_months' => :'lengthInMonths', + :'reservation_model' => :'reservationModel' + } + end + + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + acceptable_attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'length_in_months' => :'Integer', + :'reservation_model' => :'ReservationModelEnum' + } + end + + # List of attributes with nullable: true + def self.openapi_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 `BillingApi::ReservationTerm` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ReservationTerm`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'length_in_months') + self.length_in_months = attributes[:'length_in_months'] + else + self.length_in_months = nil + end + + if attributes.key?(:'reservation_model') + self.reservation_model = attributes[:'reservation_model'] + else + self.reservation_model = nil + 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 + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @length_in_months.nil? + invalid_properties.push('invalid value for "length_in_months", length_in_months cannot be nil.') + end + + if @reservation_model.nil? + invalid_properties.push('invalid value for "reservation_model", reservation_model 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? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @length_in_months.nil? + return false if @reservation_model.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] length_in_months Value to be assigned + def length_in_months=(length_in_months) + if length_in_months.nil? + fail ArgumentError, 'length_in_months cannot be nil' + end + + @length_in_months = length_in_months + end + + # Custom attribute writer method with validation + # @param [Object] reservation_model Value to be assigned + def reservation_model=(reservation_model) + if reservation_model.nil? + fail ArgumentError, 'reservation_model cannot be nil' + end + + @reservation_model = reservation_model + 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 && + length_in_months == o.length_in_months && + reservation_model == o.reservation_model + 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 + [length_in_months, reservation_model].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) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{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[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_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.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + end + +end diff --git a/BillingApi/lib/pnap_billing_api/models/server_details.rb b/BillingApi/lib/pnap_billing_api/models/server_details.rb index 2defd78f..0f6e0267 100644 --- a/BillingApi/lib/pnap_billing_api/models/server_details.rb +++ b/BillingApi/lib/pnap_billing_api/models/server_details.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BillingApi # Details of the server associated with this rated usage record. - class ServerDetails + class ServerDetails < ApiModelBase # The server identifier as returned by the BMC API. attr_accessor :id @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::ServerDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ServerDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -102,6 +108,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] hostname Value to be assigned + def hostname=(hostname) + if hostname.nil? + fail ArgumentError, 'hostname cannot be nil' + end + + @hostname = hostname + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -146,61 +172,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -217,24 +188,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/server_product.rb b/BillingApi/lib/pnap_billing_api/models/server_product.rb index a1fc1706..130ceb7a 100644 --- a/BillingApi/lib/pnap_billing_api/models/server_product.rb +++ b/BillingApi/lib/pnap_billing_api/models/server_product.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module BillingApi - class ServerProduct + class ServerProduct < ApiModelBase # The code identifying the product. This code has significant across all locations. attr_accessor :product_code @@ -36,9 +36,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -72,9 +77,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::ServerProduct`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ServerProduct`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -134,6 +140,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] product_code Value to be assigned + def product_code=(product_code) + if product_code.nil? + fail ArgumentError, 'product_code cannot be nil' + end + + @product_code = product_code + end + + # Custom attribute writer method with validation + # @param [Object] product_category Value to be assigned + def product_category=(product_category) + if product_category.nil? + fail ArgumentError, 'product_category cannot be nil' + end + + @product_category = product_category + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if metadata.nil? + fail ArgumentError, 'metadata cannot be nil' + end + + @metadata = metadata + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -180,61 +216,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -251,24 +232,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/server_product_metadata.rb b/BillingApi/lib/pnap_billing_api/models/server_product_metadata.rb index 2d8fc002..fcb793c8 100644 --- a/BillingApi/lib/pnap_billing_api/models/server_product_metadata.rb +++ b/BillingApi/lib/pnap_billing_api/models/server_product_metadata.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BillingApi # Details of the server product. - class ServerProductMetadata + class ServerProductMetadata < ApiModelBase # RAM in GB. attr_accessor :ram_in_gb @@ -54,9 +54,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -87,9 +92,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::ServerProductMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ServerProductMetadata`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -193,6 +199,76 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] ram_in_gb Value to be assigned + def ram_in_gb=(ram_in_gb) + if ram_in_gb.nil? + fail ArgumentError, 'ram_in_gb cannot be nil' + end + + @ram_in_gb = ram_in_gb + end + + # Custom attribute writer method with validation + # @param [Object] cpu Value to be assigned + def cpu=(cpu) + if cpu.nil? + fail ArgumentError, 'cpu cannot be nil' + end + + @cpu = cpu + end + + # Custom attribute writer method with validation + # @param [Object] cpu_count Value to be assigned + def cpu_count=(cpu_count) + if cpu_count.nil? + fail ArgumentError, 'cpu_count cannot be nil' + end + + @cpu_count = cpu_count + end + + # Custom attribute writer method with validation + # @param [Object] cores_per_cpu Value to be assigned + def cores_per_cpu=(cores_per_cpu) + if cores_per_cpu.nil? + fail ArgumentError, 'cores_per_cpu cannot be nil' + end + + @cores_per_cpu = cores_per_cpu + end + + # Custom attribute writer method with validation + # @param [Object] cpu_frequency Value to be assigned + def cpu_frequency=(cpu_frequency) + if cpu_frequency.nil? + fail ArgumentError, 'cpu_frequency cannot be nil' + end + + @cpu_frequency = cpu_frequency + end + + # Custom attribute writer method with validation + # @param [Object] network Value to be assigned + def network=(network) + if network.nil? + fail ArgumentError, 'network cannot be nil' + end + + @network = network + end + + # Custom attribute writer method with validation + # @param [Object] storage Value to be assigned + def storage=(storage) + if storage.nil? + fail ArgumentError, 'storage cannot be nil' + end + + @storage = storage + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -243,61 +319,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -314,24 +335,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/server_record.rb b/BillingApi/lib/pnap_billing_api/models/server_record.rb index 1e5bd6b7..00ae09ef 100644 --- a/BillingApi/lib/pnap_billing_api/models/server_record.rb +++ b/BillingApi/lib/pnap_billing_api/models/server_record.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module BillingApi - class ServerRecord + class ServerRecord < ApiModelBase # The unique identifier of the rated usage record. attr_accessor :id @@ -67,6 +67,8 @@ class ServerRecord # Reservation id associated with this rated usage record. attr_accessor :reservation_id + attr_accessor :reservation_details + attr_accessor :discount_details attr_accessor :credit_details @@ -116,15 +118,21 @@ def self.attribute_map :'usage_session_id' => :'usageSessionId', :'correlation_id' => :'correlationId', :'reservation_id' => :'reservationId', + :'reservation_details' => :'reservationDetails', :'discount_details' => :'discountDetails', :'credit_details' => :'creditDetails', :'metadata' => :'metadata' } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -148,6 +156,7 @@ def self.openapi_types :'usage_session_id' => :'String', :'correlation_id' => :'String', :'reservation_id' => :'String', + :'reservation_details' => :'ReservationDetails', :'discount_details' => :'ApplicableDiscountDetails', :'credit_details' => :'Array', :'metadata' => :'ServerDetails' @@ -175,9 +184,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::ServerRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ServerRecord`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -268,20 +278,20 @@ def initialize(attributes = {}) if attributes.key?(:'usage_session_id') self.usage_session_id = attributes[:'usage_session_id'] - else - self.usage_session_id = nil end if attributes.key?(:'correlation_id') self.correlation_id = attributes[:'correlation_id'] - else - self.correlation_id = nil end if attributes.key?(:'reservation_id') self.reservation_id = attributes[:'reservation_id'] end + if attributes.key?(:'reservation_details') + self.reservation_details = attributes[:'reservation_details'] + end + if attributes.key?(:'discount_details') self.discount_details = attributes[:'discount_details'] end @@ -352,14 +362,6 @@ def list_invalid_properties invalid_properties.push('invalid value for "active", active cannot be nil.') end - if @usage_session_id.nil? - invalid_properties.push('invalid value for "usage_session_id", usage_session_id cannot be nil.') - end - - if @correlation_id.nil? - invalid_properties.push('invalid value for "correlation_id", correlation_id cannot be nil.') - end - if @metadata.nil? invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') end @@ -383,12 +385,140 @@ def valid? return false if @unit_price_description.nil? return false if @quantity.nil? return false if @active.nil? - return false if @usage_session_id.nil? - return false if @correlation_id.nil? return false if @metadata.nil? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] product_category Value to be assigned + def product_category=(product_category) + if product_category.nil? + fail ArgumentError, 'product_category cannot be nil' + end + + @product_category = product_category + end + + # Custom attribute writer method with validation + # @param [Object] product_code Value to be assigned + def product_code=(product_code) + if product_code.nil? + fail ArgumentError, 'product_code cannot be nil' + end + + @product_code = product_code + end + + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + + # Custom attribute writer method with validation + # @param [Object] start_date_time Value to be assigned + def start_date_time=(start_date_time) + if start_date_time.nil? + fail ArgumentError, 'start_date_time cannot be nil' + end + + @start_date_time = start_date_time + end + + # Custom attribute writer method with validation + # @param [Object] end_date_time Value to be assigned + def end_date_time=(end_date_time) + if end_date_time.nil? + fail ArgumentError, 'end_date_time cannot be nil' + end + + @end_date_time = end_date_time + end + + # Custom attribute writer method with validation + # @param [Object] cost Value to be assigned + def cost=(cost) + if cost.nil? + fail ArgumentError, 'cost cannot be nil' + end + + @cost = cost + end + + # Custom attribute writer method with validation + # @param [Object] price_model Value to be assigned + def price_model=(price_model) + if price_model.nil? + fail ArgumentError, 'price_model cannot be nil' + end + + @price_model = price_model + end + + # Custom attribute writer method with validation + # @param [Object] unit_price Value to be assigned + def unit_price=(unit_price) + if unit_price.nil? + fail ArgumentError, 'unit_price cannot be nil' + end + + @unit_price = unit_price + end + + # Custom attribute writer method with validation + # @param [Object] unit_price_description Value to be assigned + def unit_price_description=(unit_price_description) + if unit_price_description.nil? + fail ArgumentError, 'unit_price_description cannot be nil' + end + + @unit_price_description = unit_price_description + end + + # Custom attribute writer method with validation + # @param [Object] quantity Value to be assigned + def quantity=(quantity) + if quantity.nil? + fail ArgumentError, 'quantity cannot be nil' + end + + @quantity = quantity + end + + # Custom attribute writer method with validation + # @param [Object] active Value to be assigned + def active=(active) + if active.nil? + fail ArgumentError, 'active cannot be nil' + end + + @active = active + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if metadata.nil? + fail ArgumentError, 'metadata cannot be nil' + end + + @metadata = metadata + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -412,6 +542,7 @@ def ==(o) usage_session_id == o.usage_session_id && correlation_id == o.correlation_id && reservation_id == o.reservation_id && + reservation_details == o.reservation_details && discount_details == o.discount_details && credit_details == o.credit_details && metadata == o.metadata @@ -426,7 +557,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, product_category, product_code, location, year_month, start_date_time, end_date_time, cost, cost_before_discount, cost_description, price_model, unit_price, unit_price_description, quantity, active, usage_session_id, correlation_id, reservation_id, discount_details, credit_details, metadata].hash + [id, product_category, product_code, location, year_month, start_date_time, end_date_time, cost, cost_before_discount, cost_description, price_model, unit_price, unit_price_description, quantity, active, usage_session_id, correlation_id, reservation_id, reservation_details, discount_details, credit_details, metadata].hash end # Builds the object from hash @@ -452,61 +583,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -523,24 +599,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/storage_details.rb b/BillingApi/lib/pnap_billing_api/models/storage_details.rb index 4a530acf..b2d11d7a 100644 --- a/BillingApi/lib/pnap_billing_api/models/storage_details.rb +++ b/BillingApi/lib/pnap_billing_api/models/storage_details.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BillingApi # Details of the storage associated with this rated usage record. - class StorageDetails + class StorageDetails < ApiModelBase # Network storage ID. attr_accessor :network_storage_id @@ -46,9 +46,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -77,35 +82,28 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::StorageDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::StorageDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'network_storage_id') self.network_storage_id = attributes[:'network_storage_id'] - else - self.network_storage_id = nil end if attributes.key?(:'network_storage_name') self.network_storage_name = attributes[:'network_storage_name'] - else - self.network_storage_name = nil end if attributes.key?(:'volume_id') self.volume_id = attributes[:'volume_id'] - else - self.volume_id = nil end if attributes.key?(:'volume_name') self.volume_name = attributes[:'volume_name'] - else - self.volume_name = nil end if attributes.key?(:'capacity_in_gb') @@ -116,8 +114,6 @@ def initialize(attributes = {}) if attributes.key?(:'created_on') self.created_on = attributes[:'created_on'] - else - self.created_on = nil end end @@ -126,30 +122,10 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @network_storage_id.nil? - invalid_properties.push('invalid value for "network_storage_id", network_storage_id cannot be nil.') - end - - if @network_storage_name.nil? - invalid_properties.push('invalid value for "network_storage_name", network_storage_name cannot be nil.') - end - - if @volume_id.nil? - invalid_properties.push('invalid value for "volume_id", volume_id cannot be nil.') - end - - if @volume_name.nil? - invalid_properties.push('invalid value for "volume_name", volume_name cannot be nil.') - end - if @capacity_in_gb.nil? invalid_properties.push('invalid value for "capacity_in_gb", capacity_in_gb cannot be nil.') end - if @created_on.nil? - invalid_properties.push('invalid value for "created_on", created_on cannot be nil.') - end - invalid_properties end @@ -157,15 +133,20 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @network_storage_id.nil? - return false if @network_storage_name.nil? - return false if @volume_id.nil? - return false if @volume_name.nil? return false if @capacity_in_gb.nil? - return false if @created_on.nil? true end + # Custom attribute writer method with validation + # @param [Object] capacity_in_gb Value to be assigned + def capacity_in_gb=(capacity_in_gb) + if capacity_in_gb.nil? + fail ArgumentError, 'capacity_in_gb cannot be nil' + end + + @capacity_in_gb = capacity_in_gb + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -214,61 +195,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -285,24 +211,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/storage_record.rb b/BillingApi/lib/pnap_billing_api/models/storage_record.rb index e4cf2809..39003848 100644 --- a/BillingApi/lib/pnap_billing_api/models/storage_record.rb +++ b/BillingApi/lib/pnap_billing_api/models/storage_record.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module BillingApi - class StorageRecord + class StorageRecord < ApiModelBase # The unique identifier of the rated usage record. attr_accessor :id @@ -67,6 +67,8 @@ class StorageRecord # Reservation id associated with this rated usage record. attr_accessor :reservation_id + attr_accessor :reservation_details + attr_accessor :discount_details attr_accessor :credit_details @@ -116,15 +118,21 @@ def self.attribute_map :'usage_session_id' => :'usageSessionId', :'correlation_id' => :'correlationId', :'reservation_id' => :'reservationId', + :'reservation_details' => :'reservationDetails', :'discount_details' => :'discountDetails', :'credit_details' => :'creditDetails', :'metadata' => :'metadata' } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -148,6 +156,7 @@ def self.openapi_types :'usage_session_id' => :'String', :'correlation_id' => :'String', :'reservation_id' => :'String', + :'reservation_details' => :'ReservationDetails', :'discount_details' => :'ApplicableDiscountDetails', :'credit_details' => :'Array', :'metadata' => :'StorageDetails' @@ -175,9 +184,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::StorageRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::StorageRecord`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -268,20 +278,20 @@ def initialize(attributes = {}) if attributes.key?(:'usage_session_id') self.usage_session_id = attributes[:'usage_session_id'] - else - self.usage_session_id = nil end if attributes.key?(:'correlation_id') self.correlation_id = attributes[:'correlation_id'] - else - self.correlation_id = nil end if attributes.key?(:'reservation_id') self.reservation_id = attributes[:'reservation_id'] end + if attributes.key?(:'reservation_details') + self.reservation_details = attributes[:'reservation_details'] + end + if attributes.key?(:'discount_details') self.discount_details = attributes[:'discount_details'] end @@ -352,14 +362,6 @@ def list_invalid_properties invalid_properties.push('invalid value for "active", active cannot be nil.') end - if @usage_session_id.nil? - invalid_properties.push('invalid value for "usage_session_id", usage_session_id cannot be nil.') - end - - if @correlation_id.nil? - invalid_properties.push('invalid value for "correlation_id", correlation_id cannot be nil.') - end - if @metadata.nil? invalid_properties.push('invalid value for "metadata", metadata cannot be nil.') end @@ -383,12 +385,140 @@ def valid? return false if @unit_price_description.nil? return false if @quantity.nil? return false if @active.nil? - return false if @usage_session_id.nil? - return false if @correlation_id.nil? return false if @metadata.nil? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] product_category Value to be assigned + def product_category=(product_category) + if product_category.nil? + fail ArgumentError, 'product_category cannot be nil' + end + + @product_category = product_category + end + + # Custom attribute writer method with validation + # @param [Object] product_code Value to be assigned + def product_code=(product_code) + if product_code.nil? + fail ArgumentError, 'product_code cannot be nil' + end + + @product_code = product_code + end + + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + + # Custom attribute writer method with validation + # @param [Object] start_date_time Value to be assigned + def start_date_time=(start_date_time) + if start_date_time.nil? + fail ArgumentError, 'start_date_time cannot be nil' + end + + @start_date_time = start_date_time + end + + # Custom attribute writer method with validation + # @param [Object] end_date_time Value to be assigned + def end_date_time=(end_date_time) + if end_date_time.nil? + fail ArgumentError, 'end_date_time cannot be nil' + end + + @end_date_time = end_date_time + end + + # Custom attribute writer method with validation + # @param [Object] cost Value to be assigned + def cost=(cost) + if cost.nil? + fail ArgumentError, 'cost cannot be nil' + end + + @cost = cost + end + + # Custom attribute writer method with validation + # @param [Object] price_model Value to be assigned + def price_model=(price_model) + if price_model.nil? + fail ArgumentError, 'price_model cannot be nil' + end + + @price_model = price_model + end + + # Custom attribute writer method with validation + # @param [Object] unit_price Value to be assigned + def unit_price=(unit_price) + if unit_price.nil? + fail ArgumentError, 'unit_price cannot be nil' + end + + @unit_price = unit_price + end + + # Custom attribute writer method with validation + # @param [Object] unit_price_description Value to be assigned + def unit_price_description=(unit_price_description) + if unit_price_description.nil? + fail ArgumentError, 'unit_price_description cannot be nil' + end + + @unit_price_description = unit_price_description + end + + # Custom attribute writer method with validation + # @param [Object] quantity Value to be assigned + def quantity=(quantity) + if quantity.nil? + fail ArgumentError, 'quantity cannot be nil' + end + + @quantity = quantity + end + + # Custom attribute writer method with validation + # @param [Object] active Value to be assigned + def active=(active) + if active.nil? + fail ArgumentError, 'active cannot be nil' + end + + @active = active + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if metadata.nil? + fail ArgumentError, 'metadata cannot be nil' + end + + @metadata = metadata + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -412,6 +542,7 @@ def ==(o) usage_session_id == o.usage_session_id && correlation_id == o.correlation_id && reservation_id == o.reservation_id && + reservation_details == o.reservation_details && discount_details == o.discount_details && credit_details == o.credit_details && metadata == o.metadata @@ -426,7 +557,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, product_category, product_code, location, year_month, start_date_time, end_date_time, cost, cost_before_discount, cost_description, price_model, unit_price, unit_price_description, quantity, active, usage_session_id, correlation_id, reservation_id, discount_details, credit_details, metadata].hash + [id, product_category, product_code, location, year_month, start_date_time, end_date_time, cost, cost_before_discount, cost_description, price_model, unit_price, unit_price_description, quantity, active, usage_session_id, correlation_id, reservation_id, reservation_details, discount_details, credit_details, metadata].hash end # Builds the object from hash @@ -452,61 +583,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -523,24 +599,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/system_credit_cause_enum.rb b/BillingApi/lib/pnap_billing_api/models/system_credit_cause_enum.rb index e502522e..06f336a9 100644 --- a/BillingApi/lib/pnap_billing_api/models/system_credit_cause_enum.rb +++ b/BillingApi/lib/pnap_billing_api/models/system_credit_cause_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BillingApi/lib/pnap_billing_api/models/system_credit_details.rb b/BillingApi/lib/pnap_billing_api/models/system_credit_details.rb index 3190f4ed..7f11491a 100644 --- a/BillingApi/lib/pnap_billing_api/models/system_credit_details.rb +++ b/BillingApi/lib/pnap_billing_api/models/system_credit_details.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module BillingApi - class SystemCreditDetails + class SystemCreditDetails < ApiModelBase # Amount applied. attr_accessor :applied_amount @@ -53,9 +53,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -88,9 +93,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::SystemCreditDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::SystemCreditDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -144,6 +150,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] applied_amount Value to be assigned + def applied_amount=(applied_amount) + if applied_amount.nil? + fail ArgumentError, 'applied_amount cannot be nil' + end + + @applied_amount = applied_amount + end + + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + @type = type + end + + # Custom attribute writer method with validation + # @param [Object] cause Value to be assigned + def cause=(cause) + if cause.nil? + fail ArgumentError, 'cause cannot be nil' + end + + @cause = cause + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -189,61 +225,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -260,24 +241,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/threshold_configuration_details.rb b/BillingApi/lib/pnap_billing_api/models/threshold_configuration_details.rb index 652f75a1..3e5039dd 100644 --- a/BillingApi/lib/pnap_billing_api/models/threshold_configuration_details.rb +++ b/BillingApi/lib/pnap_billing_api/models/threshold_configuration_details.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BillingApi # Threshold billing configuration. - class ThresholdConfigurationDetails + class ThresholdConfigurationDetails < ApiModelBase # Threshold billing amount. attr_accessor :threshold_amount @@ -26,9 +26,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BillingApi::ThresholdConfigurationDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::ThresholdConfigurationDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -86,6 +92,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] threshold_amount Value to be assigned + def threshold_amount=(threshold_amount) + if threshold_amount.nil? + fail ArgumentError, 'threshold_amount cannot be nil' + end + + @threshold_amount = threshold_amount + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -129,61 +145,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BillingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -200,24 +161,6 @@ def to_hash 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/BillingApi/lib/pnap_billing_api/models/utilization.rb b/BillingApi/lib/pnap_billing_api/models/utilization.rb new file mode 100644 index 00000000..4c54ba86 --- /dev/null +++ b/BillingApi/lib/pnap_billing_api/models/utilization.rb @@ -0,0 +1,208 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'date' +require 'time' + +module BillingApi + class Utilization < ApiModelBase + attr_accessor :quantity + + attr_accessor :percentage + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'quantity' => :'quantity', + :'percentage' => :'percentage' + } + end + + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + acceptable_attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'quantity' => :'Quantity', + :'percentage' => :'Float' + } + end + + # List of attributes with nullable: true + def self.openapi_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 `BillingApi::Utilization` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BillingApi::Utilization`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'quantity') + self.quantity = attributes[:'quantity'] + else + self.quantity = nil + end + + if attributes.key?(:'percentage') + self.percentage = attributes[:'percentage'] + else + self.percentage = nil + 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 + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @quantity.nil? + invalid_properties.push('invalid value for "quantity", quantity cannot be nil.') + end + + if @percentage.nil? + invalid_properties.push('invalid value for "percentage", percentage cannot be nil.') + end + + if @percentage > 100 + invalid_properties.push('invalid value for "percentage", must be smaller than or equal to 100.') + end + + if @percentage < 0 + invalid_properties.push('invalid value for "percentage", must be greater than or equal to 0.') + 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? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @quantity.nil? + return false if @percentage.nil? + return false if @percentage > 100 + return false if @percentage < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] quantity Value to be assigned + def quantity=(quantity) + if quantity.nil? + fail ArgumentError, 'quantity cannot be nil' + end + + @quantity = quantity + end + + # Custom attribute writer method with validation + # @param [Object] percentage Value to be assigned + def percentage=(percentage) + if percentage.nil? + fail ArgumentError, 'percentage cannot be nil' + end + + if percentage > 100 + fail ArgumentError, 'invalid value for "percentage", must be smaller than or equal to 100.' + end + + if percentage < 0 + fail ArgumentError, 'invalid value for "percentage", must be greater than or equal to 0.' + end + + @percentage = percentage + 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 && + quantity == o.quantity && + percentage == o.percentage + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [quantity, percentage].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{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[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_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.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + end + +end diff --git a/BillingApi/lib/pnap_billing_api/version.rb b/BillingApi/lib/pnap_billing_api/version.rb index a63f0b3e..85c40878 100644 --- a/BillingApi/lib/pnap_billing_api/version.rb +++ b/BillingApi/lib/pnap_billing_api/version.rb @@ -6,8 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 - +Generator version: 7.20.0 =end def get_version() diff --git a/BillingApi/pnap_billing_api.gemspec b/BillingApi/pnap_billing_api.gemspec index be4e9610..dd4799ac 100644 --- a/BillingApi/pnap_billing_api.gemspec +++ b/BillingApi/pnap_billing_api.gemspec @@ -8,7 +8,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -19,14 +19,14 @@ Gem::Specification.new do |s| s.name = "pnap_billing_api" s.version = BillingApi::VERSION s.platform = Gem::Platform::RUBY - s.authors = ["PhoenixNAP"] + s.authors = ["OpenAPI-Generator"] s.email = ["support@phoenixnap.com"] - s.homepage = "https://phoenixnap.com/bare-metal-cloud" + s.homepage = "https://openapi-generator.tech" s.summary = "Billing API Ruby Gem" - s.description = "Billing API Ruby Gem" + s.description = "Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) " s.license = "MPL-2.0" s.required_ruby_version = ">= 2.7" - s.metadata = { "source_code_uri" => "https://github.com/phoenixnap/ruby-sdk-bmc" } + s.metadata = {} s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' @@ -36,4 +36,4 @@ Gem::Specification.new do |s| s.test_files = `find spec/*`.split("\n") s.executables = [] s.require_paths = ["lib"] -end +end \ No newline at end of file diff --git a/BillingApi/spec/api/billing_configurations_api_spec.rb b/BillingApi/spec/api/billing_configurations_api_spec.rb index 74551b8b..d7d11602 100644 --- a/BillingApi/spec/api/billing_configurations_api_spec.rb +++ b/BillingApi/spec/api/billing_configurations_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BillingApi/spec/api/product_availability_api_spec.rb b/BillingApi/spec/api/product_availability_api_spec.rb index 06879c9c..19a42cd6 100644 --- a/BillingApi/spec/api/product_availability_api_spec.rb +++ b/BillingApi/spec/api/product_availability_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -39,9 +39,9 @@ # @option opts [Array] :product_category Product category. Currently only SERVER category is supported. # @option opts [Array] :product_code # @option opts [Boolean] :show_only_min_quantity_available Show only locations where product with requested quantity is available or all locations where product is offered. - # @option opts [Array] :location + # @option opts [Array] :location # @option opts [Array] :solution - # @option opts [Float] :min_quantity Minimal quantity of product needed. Minimum, maximum and default values might differ for different products. For servers, they are 1, 10 and 1 respectively. + # @option opts [Float] :min_quantity Minimum quantity of the product that can be requested. For servers the allowed quantity range is 1 to 10. # @return [Array] describe 'product_availability_get test' do it 'should work' do diff --git a/BillingApi/spec/api/products_api_spec.rb b/BillingApi/spec/api/products_api_spec.rb index babf419d..c30574d3 100644 --- a/BillingApi/spec/api/products_api_spec.rb +++ b/BillingApi/spec/api/products_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BillingApi/spec/api/rated_usage_api_spec.rb b/BillingApi/spec/api/rated_usage_api_spec.rb index 221447e8..f6a06252 100644 --- a/BillingApi/spec/api/rated_usage_api_spec.rb +++ b/BillingApi/spec/api/rated_usage_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BillingApi/spec/api/reservations_api_spec.rb b/BillingApi/spec/api/reservations_api_spec.rb index 12d01252..23d22f6d 100644 --- a/BillingApi/spec/api/reservations_api_spec.rb +++ b/BillingApi/spec/api/reservations_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BillingApi/spec/models/applicable_discount_details_spec.rb b/BillingApi/spec/models/applicable_discount_details_spec.rb index fd42d3e9..4d7d9273 100644 --- a/BillingApi/spec/models/applicable_discount_details_spec.rb +++ b/BillingApi/spec/models/applicable_discount_details_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::ApplicableDiscountDetails do - let(:instance) { BillingApi::ApplicableDiscountDetails.new } + #let(:instance) { BillingApi::ApplicableDiscountDetails.new } describe 'test an instance of ApplicableDiscountDetails' do it 'should create an instance of ApplicableDiscountDetails' do diff --git a/BillingApi/spec/models/applicable_discounts_spec.rb b/BillingApi/spec/models/applicable_discounts_spec.rb index e093127f..abc03f4f 100644 --- a/BillingApi/spec/models/applicable_discounts_spec.rb +++ b/BillingApi/spec/models/applicable_discounts_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::ApplicableDiscounts do - let(:instance) { BillingApi::ApplicableDiscounts.new } + #let(:instance) { BillingApi::ApplicableDiscounts.new } describe 'test an instance of ApplicableDiscounts' do it 'should create an instance of ApplicableDiscounts' do diff --git a/BillingApi/spec/models/bandwidth_details_spec.rb b/BillingApi/spec/models/bandwidth_details_spec.rb index fe8f9655..cab830c0 100644 --- a/BillingApi/spec/models/bandwidth_details_spec.rb +++ b/BillingApi/spec/models/bandwidth_details_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::BandwidthDetails do - let(:instance) { BillingApi::BandwidthDetails.new } + #let(:instance) { BillingApi::BandwidthDetails.new } describe 'test an instance of BandwidthDetails' do it 'should create an instance of BandwidthDetails' do diff --git a/BillingApi/spec/models/bandwidth_record_spec.rb b/BillingApi/spec/models/bandwidth_record_spec.rb index 8baa6a99..312b0e48 100644 --- a/BillingApi/spec/models/bandwidth_record_spec.rb +++ b/BillingApi/spec/models/bandwidth_record_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::BandwidthRecord do - let(:instance) { BillingApi::BandwidthRecord.new } + #let(:instance) { BillingApi::BandwidthRecord.new } describe 'test an instance of BandwidthRecord' do it 'should create an instance of BandwidthRecord' do @@ -135,6 +135,12 @@ end end + describe 'test attribute "reservation_details"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + describe 'test attribute "discount_details"' do it 'should work' do # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ diff --git a/BillingApi/spec/models/configuration_details_spec.rb b/BillingApi/spec/models/configuration_details_spec.rb index 2e016abd..aff6b32c 100644 --- a/BillingApi/spec/models/configuration_details_spec.rb +++ b/BillingApi/spec/models/configuration_details_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::ConfigurationDetails do - let(:instance) { BillingApi::ConfigurationDetails.new } + #let(:instance) { BillingApi::ConfigurationDetails.new } describe 'test an instance of ConfigurationDetails' do it 'should create an instance of ConfigurationDetails' do diff --git a/BillingApi/spec/models/credit_details_base_spec.rb b/BillingApi/spec/models/credit_details_base_spec.rb index 0dfc8c95..23ae2eae 100644 --- a/BillingApi/spec/models/credit_details_base_spec.rb +++ b/BillingApi/spec/models/credit_details_base_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::CreditDetailsBase do - let(:instance) { BillingApi::CreditDetailsBase.new } + #let(:instance) { BillingApi::CreditDetailsBase.new } describe 'test an instance of CreditDetailsBase' do it 'should create an instance of CreditDetailsBase' do diff --git a/BillingApi/spec/models/credit_details_spec.rb b/BillingApi/spec/models/credit_details_spec.rb index 7fa3e98d..b0b960c9 100644 --- a/BillingApi/spec/models/credit_details_spec.rb +++ b/BillingApi/spec/models/credit_details_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BillingApi/spec/models/credit_type_enum_spec.rb b/BillingApi/spec/models/credit_type_enum_spec.rb index 32d5ec22..479159ef 100644 --- a/BillingApi/spec/models/credit_type_enum_spec.rb +++ b/BillingApi/spec/models/credit_type_enum_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::CreditTypeEnum do - let(:instance) { BillingApi::CreditTypeEnum.new } + #let(:instance) { BillingApi::CreditTypeEnum.new } describe 'test an instance of CreditTypeEnum' do it 'should create an instance of CreditTypeEnum' do diff --git a/BillingApi/spec/models/discount_details_spec.rb b/BillingApi/spec/models/discount_details_spec.rb index 42f6159e..8715152b 100644 --- a/BillingApi/spec/models/discount_details_spec.rb +++ b/BillingApi/spec/models/discount_details_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::DiscountDetails do - let(:instance) { BillingApi::DiscountDetails.new } + #let(:instance) { BillingApi::DiscountDetails.new } describe 'test an instance of DiscountDetails' do it 'should create an instance of DiscountDetails' do diff --git a/BillingApi/spec/models/discount_type_enum_spec.rb b/BillingApi/spec/models/discount_type_enum_spec.rb index a5452c16..628f9513 100644 --- a/BillingApi/spec/models/discount_type_enum_spec.rb +++ b/BillingApi/spec/models/discount_type_enum_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::DiscountTypeEnum do - let(:instance) { BillingApi::DiscountTypeEnum.new } + #let(:instance) { BillingApi::DiscountTypeEnum.new } describe 'test an instance of DiscountTypeEnum' do it 'should create an instance of DiscountTypeEnum' do diff --git a/BillingApi/spec/models/error_spec.rb b/BillingApi/spec/models/error_spec.rb index 22006856..4d3b7033 100644 --- a/BillingApi/spec/models/error_spec.rb +++ b/BillingApi/spec/models/error_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::Error do - let(:instance) { BillingApi::Error.new } + #let(:instance) { BillingApi::Error.new } describe 'test an instance of Error' do it 'should create an instance of Error' do diff --git a/BillingApi/spec/models/gpu_configuration_metadata_spec.rb b/BillingApi/spec/models/gpu_configuration_metadata_spec.rb index ed328625..a05e4b72 100644 --- a/BillingApi/spec/models/gpu_configuration_metadata_spec.rb +++ b/BillingApi/spec/models/gpu_configuration_metadata_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::GpuConfigurationMetadata do - let(:instance) { BillingApi::GpuConfigurationMetadata.new } + #let(:instance) { BillingApi::GpuConfigurationMetadata.new } describe 'test an instance of GpuConfigurationMetadata' do it 'should create an instance of GpuConfigurationMetadata' do diff --git a/BillingApi/spec/models/location_availability_detail_spec.rb b/BillingApi/spec/models/location_availability_detail_spec.rb index 9cdc685f..74278343 100644 --- a/BillingApi/spec/models/location_availability_detail_spec.rb +++ b/BillingApi/spec/models/location_availability_detail_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::LocationAvailabilityDetail do - let(:instance) { BillingApi::LocationAvailabilityDetail.new } + #let(:instance) { BillingApi::LocationAvailabilityDetail.new } describe 'test an instance of LocationAvailabilityDetail' do it 'should create an instance of LocationAvailabilityDetail' do diff --git a/BillingApi/spec/models/location_enum_spec.rb b/BillingApi/spec/models/location_enum_spec.rb index 914a757e..8da4ddd6 100644 --- a/BillingApi/spec/models/location_enum_spec.rb +++ b/BillingApi/spec/models/location_enum_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::LocationEnum do - let(:instance) { BillingApi::LocationEnum.new } + #let(:instance) { BillingApi::LocationEnum.new } describe 'test an instance of LocationEnum' do it 'should create an instance of LocationEnum' do diff --git a/BillingApi/spec/models/operating_system_details_spec.rb b/BillingApi/spec/models/operating_system_details_spec.rb index ac4dd3e1..8dbb214a 100644 --- a/BillingApi/spec/models/operating_system_details_spec.rb +++ b/BillingApi/spec/models/operating_system_details_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::OperatingSystemDetails do - let(:instance) { BillingApi::OperatingSystemDetails.new } + #let(:instance) { BillingApi::OperatingSystemDetails.new } describe 'test an instance of OperatingSystemDetails' do it 'should create an instance of OperatingSystemDetails' do diff --git a/BillingApi/spec/models/operating_system_record_spec.rb b/BillingApi/spec/models/operating_system_record_spec.rb index e24dea7d..e4c48a7d 100644 --- a/BillingApi/spec/models/operating_system_record_spec.rb +++ b/BillingApi/spec/models/operating_system_record_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::OperatingSystemRecord do - let(:instance) { BillingApi::OperatingSystemRecord.new } + #let(:instance) { BillingApi::OperatingSystemRecord.new } describe 'test an instance of OperatingSystemRecord' do it 'should create an instance of OperatingSystemRecord' do @@ -135,6 +135,12 @@ end end + describe 'test attribute "reservation_details"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + describe 'test attribute "discount_details"' do it 'should work' do # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ diff --git a/BillingApi/spec/models/package_details_spec.rb b/BillingApi/spec/models/package_details_spec.rb new file mode 100644 index 00000000..5dec59fc --- /dev/null +++ b/BillingApi/spec/models/package_details_spec.rb @@ -0,0 +1,42 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for BillingApi::PackageDetails +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe BillingApi::PackageDetails do + #let(:instance) { BillingApi::PackageDetails.new } + + describe 'test an instance of PackageDetails' do + it 'should create an instance of PackageDetails' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(BillingApi::PackageDetails) + end + end + + describe 'test attribute "package_quantity"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "package_unit"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/BillingApi/spec/models/package_quantity_spec.rb b/BillingApi/spec/models/package_quantity_spec.rb new file mode 100644 index 00000000..9124ffdb --- /dev/null +++ b/BillingApi/spec/models/package_quantity_spec.rb @@ -0,0 +1,42 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for BillingApi::PackageQuantity +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe BillingApi::PackageQuantity do + #let(:instance) { BillingApi::PackageQuantity.new } + + describe 'test an instance of PackageQuantity' do + it 'should create an instance of PackageQuantity' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(BillingApi::PackageQuantity) + end + end + + describe 'test attribute "min"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "max"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/BillingApi/spec/models/package_unit_enum_spec.rb b/BillingApi/spec/models/package_unit_enum_spec.rb index 9d15e6a9..0811c1e2 100644 --- a/BillingApi/spec/models/package_unit_enum_spec.rb +++ b/BillingApi/spec/models/package_unit_enum_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::PackageUnitEnum do - let(:instance) { BillingApi::PackageUnitEnum.new } + #let(:instance) { BillingApi::PackageUnitEnum.new } describe 'test an instance of PackageUnitEnum' do it 'should create an instance of PackageUnitEnum' do diff --git a/BillingApi/spec/models/price_unit_enum_spec.rb b/BillingApi/spec/models/price_unit_enum_spec.rb index 14a633c0..0052deaa 100644 --- a/BillingApi/spec/models/price_unit_enum_spec.rb +++ b/BillingApi/spec/models/price_unit_enum_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::PriceUnitEnum do - let(:instance) { BillingApi::PriceUnitEnum.new } + #let(:instance) { BillingApi::PriceUnitEnum.new } describe 'test an instance of PriceUnitEnum' do it 'should create an instance of PriceUnitEnum' do diff --git a/BillingApi/spec/models/pricing_plan_spec.rb b/BillingApi/spec/models/pricing_plan_spec.rb index 59fa05ac..f5e4737a 100644 --- a/BillingApi/spec/models/pricing_plan_spec.rb +++ b/BillingApi/spec/models/pricing_plan_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::PricingPlan do - let(:instance) { BillingApi::PricingPlan.new } + #let(:instance) { BillingApi::PricingPlan.new } describe 'test an instance of PricingPlan' do it 'should create an instance of PricingPlan' do @@ -42,7 +42,7 @@ describe 'test attribute "location"' do it 'should work' do # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ - # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["PHX", "ASH", "NLD", "SGP", "CHI", "SEA", "AUS", "GLOBAL"]) + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["PHX", "ASH", "NLD", "SGP", "CHI", "SEA", "GLOBAL"]) # validator.allowable_values.each do |value| # expect { instance.location = value }.not_to raise_error # end @@ -95,4 +95,10 @@ end end + describe 'test attribute "package_details"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + end diff --git a/BillingApi/spec/models/product_availability_spec.rb b/BillingApi/spec/models/product_availability_spec.rb index 8a6ff123..326e411d 100644 --- a/BillingApi/spec/models/product_availability_spec.rb +++ b/BillingApi/spec/models/product_availability_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::ProductAvailability do - let(:instance) { BillingApi::ProductAvailability.new } + #let(:instance) { BillingApi::ProductAvailability.new } describe 'test an instance of ProductAvailability' do it 'should create an instance of ProductAvailability' do diff --git a/BillingApi/spec/models/product_category_enum_spec.rb b/BillingApi/spec/models/product_category_enum_spec.rb index 664fec8f..e6a817c4 100644 --- a/BillingApi/spec/models/product_category_enum_spec.rb +++ b/BillingApi/spec/models/product_category_enum_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::ProductCategoryEnum do - let(:instance) { BillingApi::ProductCategoryEnum.new } + #let(:instance) { BillingApi::ProductCategoryEnum.new } describe 'test an instance of ProductCategoryEnum' do it 'should create an instance of ProductCategoryEnum' do diff --git a/BillingApi/spec/models/product_location_enum_spec.rb b/BillingApi/spec/models/product_location_enum_spec.rb new file mode 100644 index 00000000..48f2c432 --- /dev/null +++ b/BillingApi/spec/models/product_location_enum_spec.rb @@ -0,0 +1,30 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for BillingApi::ProductLocationEnum +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe BillingApi::ProductLocationEnum do + #let(:instance) { BillingApi::ProductLocationEnum.new } + + describe 'test an instance of ProductLocationEnum' do + it 'should create an instance of ProductLocationEnum' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(BillingApi::ProductLocationEnum) + end + end + +end diff --git a/BillingApi/spec/models/product_spec.rb b/BillingApi/spec/models/product_spec.rb index bdeb2e01..216fba74 100644 --- a/BillingApi/spec/models/product_spec.rb +++ b/BillingApi/spec/models/product_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::Product do - let(:instance) { BillingApi::Product.new } + #let(:instance) { BillingApi::Product.new } describe 'test an instance of Product' do it 'should create an instance of Product' do diff --git a/BillingApi/spec/models/products_get200_response_inner_spec.rb b/BillingApi/spec/models/products_get200_response_inner_spec.rb index 3f612079..43fb00b0 100644 --- a/BillingApi/spec/models/products_get200_response_inner_spec.rb +++ b/BillingApi/spec/models/products_get200_response_inner_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BillingApi/spec/models/promo_credit_details_spec.rb b/BillingApi/spec/models/promo_credit_details_spec.rb index 520db678..032518f9 100644 --- a/BillingApi/spec/models/promo_credit_details_spec.rb +++ b/BillingApi/spec/models/promo_credit_details_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::PromoCreditDetails do - let(:instance) { BillingApi::PromoCreditDetails.new } + #let(:instance) { BillingApi::PromoCreditDetails.new } describe 'test an instance of PromoCreditDetails' do it 'should create an instance of PromoCreditDetails' do diff --git a/BillingApi/spec/models/public_subnet_details_spec.rb b/BillingApi/spec/models/public_subnet_details_spec.rb index 29180f54..68ceff32 100644 --- a/BillingApi/spec/models/public_subnet_details_spec.rb +++ b/BillingApi/spec/models/public_subnet_details_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::PublicSubnetDetails do - let(:instance) { BillingApi::PublicSubnetDetails.new } + #let(:instance) { BillingApi::PublicSubnetDetails.new } describe 'test an instance of PublicSubnetDetails' do it 'should create an instance of PublicSubnetDetails' do diff --git a/BillingApi/spec/models/public_subnet_record_spec.rb b/BillingApi/spec/models/public_subnet_record_spec.rb index b2bb59b5..5f881982 100644 --- a/BillingApi/spec/models/public_subnet_record_spec.rb +++ b/BillingApi/spec/models/public_subnet_record_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::PublicSubnetRecord do - let(:instance) { BillingApi::PublicSubnetRecord.new } + #let(:instance) { BillingApi::PublicSubnetRecord.new } describe 'test an instance of PublicSubnetRecord' do it 'should create an instance of PublicSubnetRecord' do @@ -135,6 +135,12 @@ end end + describe 'test attribute "reservation_details"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + describe 'test attribute "discount_details"' do it 'should work' do # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ diff --git a/BillingApi/spec/models/quantity_spec.rb b/BillingApi/spec/models/quantity_spec.rb new file mode 100644 index 00000000..9969691a --- /dev/null +++ b/BillingApi/spec/models/quantity_spec.rb @@ -0,0 +1,42 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for BillingApi::Quantity +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe BillingApi::Quantity do + #let(:instance) { BillingApi::Quantity.new } + + describe 'test an instance of Quantity' do + it 'should create an instance of Quantity' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(BillingApi::Quantity) + end + end + + describe 'test attribute "quantity"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "unit"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/BillingApi/spec/models/quantity_unit_enum_spec.rb b/BillingApi/spec/models/quantity_unit_enum_spec.rb new file mode 100644 index 00000000..bbca3081 --- /dev/null +++ b/BillingApi/spec/models/quantity_unit_enum_spec.rb @@ -0,0 +1,30 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for BillingApi::QuantityUnitEnum +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe BillingApi::QuantityUnitEnum do + #let(:instance) { BillingApi::QuantityUnitEnum.new } + + describe 'test an instance of QuantityUnitEnum' do + it 'should create an instance of QuantityUnitEnum' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(BillingApi::QuantityUnitEnum) + end + end + +end diff --git a/BillingApi/spec/models/rated_usage_get200_response_inner_spec.rb b/BillingApi/spec/models/rated_usage_get200_response_inner_spec.rb index f898ae3d..fdc1c58c 100644 --- a/BillingApi/spec/models/rated_usage_get200_response_inner_spec.rb +++ b/BillingApi/spec/models/rated_usage_get200_response_inner_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BillingApi/spec/models/rated_usage_product_category_enum_spec.rb b/BillingApi/spec/models/rated_usage_product_category_enum_spec.rb index ab61c9a3..e2a48938 100644 --- a/BillingApi/spec/models/rated_usage_product_category_enum_spec.rb +++ b/BillingApi/spec/models/rated_usage_product_category_enum_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::RatedUsageProductCategoryEnum do - let(:instance) { BillingApi::RatedUsageProductCategoryEnum.new } + #let(:instance) { BillingApi::RatedUsageProductCategoryEnum.new } describe 'test an instance of RatedUsageProductCategoryEnum' do it 'should create an instance of RatedUsageProductCategoryEnum' do diff --git a/BillingApi/spec/models/rated_usage_record_spec.rb b/BillingApi/spec/models/rated_usage_record_spec.rb index 755008de..94ab06ce 100644 --- a/BillingApi/spec/models/rated_usage_record_spec.rb +++ b/BillingApi/spec/models/rated_usage_record_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::RatedUsageRecord do - let(:instance) { BillingApi::RatedUsageRecord.new } + #let(:instance) { BillingApi::RatedUsageRecord.new } describe 'test an instance of RatedUsageRecord' do it 'should create an instance of RatedUsageRecord' do @@ -135,6 +135,12 @@ end end + describe 'test attribute "reservation_details"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + describe 'test attribute "discount_details"' do it 'should work' do # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ diff --git a/BillingApi/spec/models/reservation_auto_renew_disable_request_spec.rb b/BillingApi/spec/models/reservation_auto_renew_disable_request_spec.rb index 9c6fb1f5..87aa811a 100644 --- a/BillingApi/spec/models/reservation_auto_renew_disable_request_spec.rb +++ b/BillingApi/spec/models/reservation_auto_renew_disable_request_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::ReservationAutoRenewDisableRequest do - let(:instance) { BillingApi::ReservationAutoRenewDisableRequest.new } + #let(:instance) { BillingApi::ReservationAutoRenewDisableRequest.new } describe 'test an instance of ReservationAutoRenewDisableRequest' do it 'should create an instance of ReservationAutoRenewDisableRequest' do diff --git a/BillingApi/spec/models/reservation_details_spec.rb b/BillingApi/spec/models/reservation_details_spec.rb new file mode 100644 index 00000000..59730948 --- /dev/null +++ b/BillingApi/spec/models/reservation_details_spec.rb @@ -0,0 +1,42 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for BillingApi::ReservationDetails +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe BillingApi::ReservationDetails do + #let(:instance) { BillingApi::ReservationDetails.new } + + describe 'test an instance of ReservationDetails' do + it 'should create an instance of ReservationDetails' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(BillingApi::ReservationDetails) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "quantity"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/BillingApi/spec/models/reservation_invoicing_model_enum_spec.rb b/BillingApi/spec/models/reservation_invoicing_model_enum_spec.rb index 40696ec2..5524747d 100644 --- a/BillingApi/spec/models/reservation_invoicing_model_enum_spec.rb +++ b/BillingApi/spec/models/reservation_invoicing_model_enum_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::ReservationInvoicingModelEnum do - let(:instance) { BillingApi::ReservationInvoicingModelEnum.new } + #let(:instance) { BillingApi::ReservationInvoicingModelEnum.new } describe 'test an instance of ReservationInvoicingModelEnum' do it 'should create an instance of ReservationInvoicingModelEnum' do diff --git a/BillingApi/spec/models/reservation_model_enum_spec.rb b/BillingApi/spec/models/reservation_model_enum_spec.rb index 04de44fc..c1240256 100644 --- a/BillingApi/spec/models/reservation_model_enum_spec.rb +++ b/BillingApi/spec/models/reservation_model_enum_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::ReservationModelEnum do - let(:instance) { BillingApi::ReservationModelEnum.new } + #let(:instance) { BillingApi::ReservationModelEnum.new } describe 'test an instance of ReservationModelEnum' do it 'should create an instance of ReservationModelEnum' do diff --git a/BillingApi/spec/models/reservation_product_category_enum_spec.rb b/BillingApi/spec/models/reservation_product_category_enum_spec.rb index c0b9fbe7..a81261ae 100644 --- a/BillingApi/spec/models/reservation_product_category_enum_spec.rb +++ b/BillingApi/spec/models/reservation_product_category_enum_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::ReservationProductCategoryEnum do - let(:instance) { BillingApi::ReservationProductCategoryEnum.new } + #let(:instance) { BillingApi::ReservationProductCategoryEnum.new } describe 'test an instance of ReservationProductCategoryEnum' do it 'should create an instance of ReservationProductCategoryEnum' do diff --git a/BillingApi/spec/models/reservation_request_spec.rb b/BillingApi/spec/models/reservation_request_spec.rb index 12716ab9..28548ab7 100644 --- a/BillingApi/spec/models/reservation_request_spec.rb +++ b/BillingApi/spec/models/reservation_request_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::ReservationRequest do - let(:instance) { BillingApi::ReservationRequest.new } + #let(:instance) { BillingApi::ReservationRequest.new } describe 'test an instance of ReservationRequest' do it 'should create an instance of ReservationRequest' do @@ -33,4 +33,10 @@ end end + describe 'test attribute "quantity"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + end diff --git a/BillingApi/spec/models/reservation_spec.rb b/BillingApi/spec/models/reservation_spec.rb index 36366417..0eeaf2b9 100644 --- a/BillingApi/spec/models/reservation_spec.rb +++ b/BillingApi/spec/models/reservation_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::Reservation do - let(:instance) { BillingApi::Reservation.new } + #let(:instance) { BillingApi::Reservation.new } describe 'test an instance of Reservation' do it 'should create an instance of Reservation' do @@ -57,12 +57,30 @@ end end + describe 'test attribute "term"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "reservation_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + describe 'test attribute "initial_invoice_model"' do it 'should work' do # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ end end + describe 'test attribute "quantity"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + describe 'test attribute "start_date_time"' do it 'should work' do # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ @@ -123,4 +141,10 @@ end end + describe 'test attribute "utilization"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + end diff --git a/BillingApi/spec/models/reservation_state_enum_spec.rb b/BillingApi/spec/models/reservation_state_enum_spec.rb new file mode 100644 index 00000000..04dc0a22 --- /dev/null +++ b/BillingApi/spec/models/reservation_state_enum_spec.rb @@ -0,0 +1,30 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for BillingApi::ReservationStateEnum +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe BillingApi::ReservationStateEnum do + #let(:instance) { BillingApi::ReservationStateEnum.new } + + describe 'test an instance of ReservationStateEnum' do + it 'should create an instance of ReservationStateEnum' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(BillingApi::ReservationStateEnum) + end + end + +end diff --git a/BillingApi/spec/models/reservation_term_spec.rb b/BillingApi/spec/models/reservation_term_spec.rb new file mode 100644 index 00000000..8573a659 --- /dev/null +++ b/BillingApi/spec/models/reservation_term_spec.rb @@ -0,0 +1,42 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for BillingApi::ReservationTerm +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe BillingApi::ReservationTerm do + #let(:instance) { BillingApi::ReservationTerm.new } + + describe 'test an instance of ReservationTerm' do + it 'should create an instance of ReservationTerm' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(BillingApi::ReservationTerm) + end + end + + describe 'test attribute "length_in_months"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "reservation_model"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/BillingApi/spec/models/server_details_spec.rb b/BillingApi/spec/models/server_details_spec.rb index d642cc2d..9652d016 100644 --- a/BillingApi/spec/models/server_details_spec.rb +++ b/BillingApi/spec/models/server_details_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::ServerDetails do - let(:instance) { BillingApi::ServerDetails.new } + #let(:instance) { BillingApi::ServerDetails.new } describe 'test an instance of ServerDetails' do it 'should create an instance of ServerDetails' do diff --git a/BillingApi/spec/models/server_product_metadata_spec.rb b/BillingApi/spec/models/server_product_metadata_spec.rb index fe2cea67..b2f82833 100644 --- a/BillingApi/spec/models/server_product_metadata_spec.rb +++ b/BillingApi/spec/models/server_product_metadata_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::ServerProductMetadata do - let(:instance) { BillingApi::ServerProductMetadata.new } + #let(:instance) { BillingApi::ServerProductMetadata.new } describe 'test an instance of ServerProductMetadata' do it 'should create an instance of ServerProductMetadata' do diff --git a/BillingApi/spec/models/server_product_spec.rb b/BillingApi/spec/models/server_product_spec.rb index 97523cb0..c3f6b0cb 100644 --- a/BillingApi/spec/models/server_product_spec.rb +++ b/BillingApi/spec/models/server_product_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::ServerProduct do - let(:instance) { BillingApi::ServerProduct.new } + #let(:instance) { BillingApi::ServerProduct.new } describe 'test an instance of ServerProduct' do it 'should create an instance of ServerProduct' do diff --git a/BillingApi/spec/models/server_record_spec.rb b/BillingApi/spec/models/server_record_spec.rb index 17257029..5a878923 100644 --- a/BillingApi/spec/models/server_record_spec.rb +++ b/BillingApi/spec/models/server_record_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::ServerRecord do - let(:instance) { BillingApi::ServerRecord.new } + #let(:instance) { BillingApi::ServerRecord.new } describe 'test an instance of ServerRecord' do it 'should create an instance of ServerRecord' do @@ -135,6 +135,12 @@ end end + describe 'test attribute "reservation_details"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + describe 'test attribute "discount_details"' do it 'should work' do # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ diff --git a/BillingApi/spec/models/storage_details_spec.rb b/BillingApi/spec/models/storage_details_spec.rb index 82e2e3c1..6f62be4b 100644 --- a/BillingApi/spec/models/storage_details_spec.rb +++ b/BillingApi/spec/models/storage_details_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::StorageDetails do - let(:instance) { BillingApi::StorageDetails.new } + #let(:instance) { BillingApi::StorageDetails.new } describe 'test an instance of StorageDetails' do it 'should create an instance of StorageDetails' do diff --git a/BillingApi/spec/models/storage_record_spec.rb b/BillingApi/spec/models/storage_record_spec.rb index 5a368c4f..c3665b05 100644 --- a/BillingApi/spec/models/storage_record_spec.rb +++ b/BillingApi/spec/models/storage_record_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::StorageRecord do - let(:instance) { BillingApi::StorageRecord.new } + #let(:instance) { BillingApi::StorageRecord.new } describe 'test an instance of StorageRecord' do it 'should create an instance of StorageRecord' do @@ -135,6 +135,12 @@ end end + describe 'test attribute "reservation_details"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + describe 'test attribute "discount_details"' do it 'should work' do # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ diff --git a/BillingApi/spec/models/system_credit_cause_enum_spec.rb b/BillingApi/spec/models/system_credit_cause_enum_spec.rb index eb31765f..50cc8440 100644 --- a/BillingApi/spec/models/system_credit_cause_enum_spec.rb +++ b/BillingApi/spec/models/system_credit_cause_enum_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::SystemCreditCauseEnum do - let(:instance) { BillingApi::SystemCreditCauseEnum.new } + #let(:instance) { BillingApi::SystemCreditCauseEnum.new } describe 'test an instance of SystemCreditCauseEnum' do it 'should create an instance of SystemCreditCauseEnum' do diff --git a/BillingApi/spec/models/system_credit_details_spec.rb b/BillingApi/spec/models/system_credit_details_spec.rb index db8b5a8a..9070e4b3 100644 --- a/BillingApi/spec/models/system_credit_details_spec.rb +++ b/BillingApi/spec/models/system_credit_details_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::SystemCreditDetails do - let(:instance) { BillingApi::SystemCreditDetails.new } + #let(:instance) { BillingApi::SystemCreditDetails.new } describe 'test an instance of SystemCreditDetails' do it 'should create an instance of SystemCreditDetails' do diff --git a/BillingApi/spec/models/threshold_configuration_details_spec.rb b/BillingApi/spec/models/threshold_configuration_details_spec.rb index 1f99489b..01f0cd3c 100644 --- a/BillingApi/spec/models/threshold_configuration_details_spec.rb +++ b/BillingApi/spec/models/threshold_configuration_details_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BillingApi::ThresholdConfigurationDetails do - let(:instance) { BillingApi::ThresholdConfigurationDetails.new } + #let(:instance) { BillingApi::ThresholdConfigurationDetails.new } describe 'test an instance of ThresholdConfigurationDetails' do it 'should create an instance of ThresholdConfigurationDetails' do diff --git a/BillingApi/spec/models/utilization_spec.rb b/BillingApi/spec/models/utilization_spec.rb new file mode 100644 index 00000000..cba11e6e --- /dev/null +++ b/BillingApi/spec/models/utilization_spec.rb @@ -0,0 +1,42 @@ +=begin +#Billing API + +#Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for BillingApi::Utilization +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe BillingApi::Utilization do + #let(:instance) { BillingApi::Utilization.new } + + describe 'test an instance of Utilization' do + it 'should create an instance of Utilization' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(BillingApi::Utilization) + end + end + + describe 'test attribute "quantity"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "percentage"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/BillingApi/spec/spec_helper.rb b/BillingApi/spec/spec_helper.rb index ddb6c36b..cea26e75 100644 --- a/BillingApi/spec/spec_helper.rb +++ b/BillingApi/spec/spec_helper.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BmcApi/README.md b/BmcApi/README.md index ac2885af..02620a90 100644 --- a/BmcApi/README.md +++ b/BmcApi/README.md @@ -141,6 +141,7 @@ Class | Method | HTTP request | Description *BmcApi::ServersApi* | [**servers_server_id_actions_reserve_post**](docs/ServersApi.md#servers_server_id_actions_reserve_post) | **POST** /servers/{serverId}/actions/reserve | Reserve server. *BmcApi::ServersApi* | [**servers_server_id_actions_reset_post**](docs/ServersApi.md#servers_server_id_actions_reset_post) | **POST** /servers/{serverId}/actions/reset | Reset server. *BmcApi::ServersApi* | [**servers_server_id_actions_shutdown_post**](docs/ServersApi.md#servers_server_id_actions_shutdown_post) | **POST** /servers/{serverId}/actions/shutdown | Shutdown server. +*BmcApi::ServersApi* | [**servers_server_id_actions_transfer_reservation**](docs/ServersApi.md#servers_server_id_actions_transfer_reservation) | **POST** /servers/{serverId}/actions/transfer-reservation | Transfer server reservation. *BmcApi::ServersApi* | [**servers_server_id_delete**](docs/ServersApi.md#servers_server_id_delete) | **DELETE** /servers/{serverId} | Delete server. *BmcApi::ServersApi* | [**servers_server_id_get**](docs/ServersApi.md#servers_server_id_get) | **GET** /servers/{serverId} | Get server. *BmcApi::ServersApi* | [**servers_server_id_ip_blocks_ip_block_id_delete**](docs/ServersApi.md#servers_server_id_ip_blocks_ip_block_id_delete) | **DELETE** /servers/{serverId}/network-configuration/ip-block-configurations/ip-blocks/{ipBlockId} | Unassign IP Block from Server. @@ -179,6 +180,7 @@ Class | Method | HTTP request | Description - [BmcApi::QuotaEditLimitRequest](docs/QuotaEditLimitRequest.md) - [BmcApi::QuotaEditLimitRequestDetails](docs/QuotaEditLimitRequestDetails.md) - [BmcApi::RelinquishIpBlock](docs/RelinquishIpBlock.md) + - [BmcApi::ReservationTransferDetails](docs/ReservationTransferDetails.md) - [BmcApi::ResetResult](docs/ResetResult.md) - [BmcApi::Server](docs/Server.md) - [BmcApi::ServerCreate](docs/ServerCreate.md) diff --git a/BmcApi/VERSION b/BmcApi/VERSION index 7e541aec..276cbf9e 100644 --- a/BmcApi/VERSION +++ b/BmcApi/VERSION @@ -1 +1 @@ -2.2.2 \ No newline at end of file +2.3.0 diff --git a/BmcApi/docs/IpBlocksConfiguration.md b/BmcApi/docs/IpBlocksConfiguration.md index be724d4a..e8e18a37 100644 --- a/BmcApi/docs/IpBlocksConfiguration.md +++ b/BmcApi/docs/IpBlocksConfiguration.md @@ -5,7 +5,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **configuration_type** | **String** | (Write-only) Determines the approach for configuring IP blocks for the server being provisioned. If PURCHASE_NEW is selected, the smallest supported range, depending on the operating system, is allocated to the server. | [optional][default to 'PURCHASE_NEW'] | -| **ip_blocks** | [**Array<ServerIpBlock>**](ServerIpBlock.md) | Used to specify the previously purchased IP blocks to assign to this server upon provisioning. Used alongside the USER_DEFINED configurationType. | [optional] | +| **ip_blocks** | [**Array<ServerIpBlock>**](ServerIpBlock.md) | Used for specifying the previously purchased IPv4 blocks to assign to this server upon provisioning. Used alongside the USER_DEFINED configurationType. | [optional] | ## Example diff --git a/BmcApi/docs/OsConfigurationCloudInit.md b/BmcApi/docs/OsConfigurationCloudInit.md index 5d438904..b873794f 100644 --- a/BmcApi/docs/OsConfigurationCloudInit.md +++ b/BmcApi/docs/OsConfigurationCloudInit.md @@ -12,7 +12,7 @@ require 'pnap_bmc_api' instance = BmcApi::OsConfigurationCloudInit.new( - user_data: [B@5ae15 + user_data: [B@7243145f ) ``` diff --git a/BmcApi/docs/OsConfigurationWindows.md b/BmcApi/docs/OsConfigurationWindows.md index 7e8963dc..d67d00ba 100644 --- a/BmcApi/docs/OsConfigurationWindows.md +++ b/BmcApi/docs/OsConfigurationWindows.md @@ -5,6 +5,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **rdp_allowed_ips** | **Array<String>** | List of IPs allowed for RDP access to Windows OS. Supported in single IP, CIDR and range format. When undefined, RDP is disabled. To allow RDP access from any IP use 0.0.0.0/0. This will only be returned in response to provisioning a server. | [optional] | +| **bring_your_own_license** | **Boolean** | Use a Bring Your Own (BYO) Windows license. If true, the server is provisioned in trial mode, and you must activate your own license. If false (default), the server includes a managed Windows license billed by the platform. | [optional][default to false] | ## Example @@ -12,7 +13,8 @@ require 'pnap_bmc_api' instance = BmcApi::OsConfigurationWindows.new( - rdp_allowed_ips: ["172.217.22.14","10.111.14.40/29","10.111.14.66 - 10.111.14.71"] + rdp_allowed_ips: ["172.217.22.14","10.111.14.40/29","10.111.14.66 - 10.111.14.71"], + bring_your_own_license: false ) ``` diff --git a/BmcApi/docs/PrivateNetworkConfiguration.md b/BmcApi/docs/PrivateNetworkConfiguration.md index ba799d00..064bcb93 100644 --- a/BmcApi/docs/PrivateNetworkConfiguration.md +++ b/BmcApi/docs/PrivateNetworkConfiguration.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **gateway_address** | **String** | Deprecated in favour of a common gateway address across all networks available under NetworkConfiguration.<br> The address of the gateway assigned / to assign to the server.<br> When used as part of request body, IP address has to be part of private network assigned to this server.<br> Gateway address also has to be assigned on an already deployed resource unless the `force` query parameter is true. | [optional] | | **configuration_type** | **String** | (Write-only) Determines the approach for configuring private network(s) for the server being provisioned. Currently this field should be set to `USE_OR_CREATE_DEFAULT`, `USER_DEFINED` or `NONE`. | [optional][default to 'USE_OR_CREATE_DEFAULT'] | -| **private_networks** | [**Array<ServerPrivateNetwork>**](ServerPrivateNetwork.md) | The list of private networks this server is member of. When this field is part of request body, it'll be used to specify the private networks to assign to this server upon provisioning. Used alongside the `USER_DEFINED` configurationType. | [optional] | +| **private_networks** | [**Array<ServerPrivateNetwork>**](ServerPrivateNetwork.md) | The list of private networks this server belongs to. If this field is part of a request body, it will be used for specifying the private networks to assign to this server upon provisioning. Used alongside the USER_DEFINED configurationType. | [optional] | ## Example diff --git a/BmcApi/docs/PublicNetworkConfiguration.md b/BmcApi/docs/PublicNetworkConfiguration.md index f0a5a518..a277f3bc 100644 --- a/BmcApi/docs/PublicNetworkConfiguration.md +++ b/BmcApi/docs/PublicNetworkConfiguration.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **public_networks** | [**Array<ServerPublicNetwork>**](ServerPublicNetwork.md) | The list of public networks this server is member of. When this field is part of request body, it'll be used to specify the public networks to assign to this server upon provisioning. | [optional] | +| **public_networks** | [**Array<ServerPublicNetwork>**](ServerPublicNetwork.md) | The list of public networks this server belongs to. If this field is part of a request body, it will be used for specifying the public networks to assign to this server on provision. Only IPv4 addresses can be specified. | [optional] | ## Example diff --git a/BmcApi/docs/ReservationTransferDetails.md b/BmcApi/docs/ReservationTransferDetails.md new file mode 100644 index 00000000..d9129094 --- /dev/null +++ b/BmcApi/docs/ReservationTransferDetails.md @@ -0,0 +1,18 @@ +# BmcApi::ReservationTransferDetails + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **target_server_id** | **String** | ID of target server to transfer reservation to. | | + +## Example + +```ruby +require 'pnap_bmc_api' + +instance = BmcApi::ReservationTransferDetails.new( + target_server_id: 54a21648dasda4s9843a17 +) +``` + diff --git a/BmcApi/docs/Server.md b/BmcApi/docs/Server.md index 1c8fa6ba..4c1347cc 100644 --- a/BmcApi/docs/Server.md +++ b/BmcApi/docs/Server.md @@ -8,9 +8,9 @@ | **status** | **String** | The status of the server. Can have one of the following values: `creating` , `powered-on` , `powered-off` , `rebooting` , `resetting` , `deleting` , `reserved` , `error` or `reinstating`. | | | **hostname** | **String** | Hostname of server. | | | **description** | **String** | Description of server. | [optional] | -| **os** | **String** | The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `rockylinux/rockylinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `proxmox/bullseye`, `proxmox/proxmox8`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`. | [optional] | -| **type** | **String** | Server type ID. Cannot be changed once a server is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c1.small`, `d1.c2.small`, `d1.c3.small`, `d1.c4.small`, `d1.c1.medium`, `d1.c2.medium`, `d1.c3.medium`, `d1.c4.medium`, `d1.c1.large`, `d1.c2.large`, `d1.c3.large`, `d1.c4.large`, `d1.m1.medium`, `d1.m2.medium`, `d1.m3.medium`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `a1.c5.xlarge`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge`, `d3.g2.c3.xlarge`, s4.x6.c6.large or s4.x6.m6.xlarge. | | -| **location** | **String** | Server location ID. Cannot be changed once a server is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. | | +| **os** | **String** | The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `rockylinux/rockylinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `debian/trixie`, `proxmox/bullseye`, `proxmox/proxmox8`, `proxmox/proxmox9`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`. | [optional] | +| **type** | **String** | Server type ID. Cannot be changed once a server is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c4.small`, `d1.c4.medium`, `d1.c4.large`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `a1.c5.xlarge`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge`, `d3.g2.c3.xlarge`, `d3.g3.c2.medium`, `s4.x6.c6.large`, `s4.x6.m6.xlarge`, `s5.x6.c3.medium`, `s5.x6.c3.large`, `s5.x6.c8.medium`, `s5.x6.c9.medium`, `s5.x6.c8.large`, `s5.x6.c9.large`, `s5.x6.m8.xlarge`, `s5.x6.m9.xlarge`, `s4.c3.medium`, `s4.c6.medium`, `s4.c6.large`, `s4.c6.xlarge`, `s4.s2.large`, `a2.c9.large` or `a2.c9.xlarge`. | | +| **location** | **String** | Server location ID. Cannot be changed once a server is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. | | | **cpu** | **String** | A description of the machine CPU. | | | **cpu_count** | **Integer** | The number of CPUs available in the system. | | | **cores_per_cpu** | **Integer** | The number of physical cores present on each CPU. | | diff --git a/BmcApi/docs/ServerCreate.md b/BmcApi/docs/ServerCreate.md index 8581cb27..9d168cb0 100644 --- a/BmcApi/docs/ServerCreate.md +++ b/BmcApi/docs/ServerCreate.md @@ -6,9 +6,9 @@ | ---- | ---- | ----------- | ----- | | **hostname** | **String** | Hostname of server. | | | **description** | **String** | Description of server. | [optional] | -| **os** | **String** | The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `rockylinux/rockylinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `proxmox/bullseye`, `proxmox/proxmox8`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`. | | -| **type** | **String** | Server type ID. Cannot be changed once a server is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c1.small`, `d1.c2.small`, `d1.c3.small`, `d1.c4.small`, `d1.c1.medium`, `d1.c2.medium`, `d1.c3.medium`, `d1.c4.medium`, `d1.c1.large`, `d1.c2.large`, `d1.c3.large`, `d1.c4.large`, `d1.m1.medium`, `d1.m2.medium`, `d1.m3.medium`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `a1.c5.xlarge`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge`, `d3.g2.c3.xlarge`, s4.x6.c6.large or s4.x6.m6.xlarge. | | -| **location** | **String** | Server location ID. Cannot be changed once a server is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. | | +| **os** | **String** | The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `rockylinux/rockylinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `debian/trixie`, `proxmox/bullseye`, `proxmox/proxmox8`, `proxmox/proxmox9`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`. | | +| **type** | **String** | Server type ID. Cannot be changed once a server is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c4.small`, `d1.c4.medium`, `d1.c4.large`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `a1.c5.xlarge`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge`, `d3.g2.c3.xlarge`,`d3.g3.c2.medium`, `s4.x6.c6.large`, `s4.x6.m6.xlarge`, `s5.x6.c3.medium`, `s5.x6.c3.large`, `s5.x6.c8.medium`, `s5.x6.c9.medium`, `s5.x6.c8.large`, `s5.x6.c9.large`, `s5.x6.m8.xlarge`, `s5.x6.m9.xlarge`, `s4.c3.medium`, `s4.c6.medium`, `s4.c6.large`, `s4.c6.xlarge`, `s4.s2.large`, `a2.c9.large` or `a2.c9.xlarge`. | | +| **location** | **String** | Server location ID. Cannot be changed once a server is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. | | | **install_default_ssh_keys** | **Boolean** | Whether or not to install SSH keys marked as default in addition to any SSH keys specified in this request. | [optional][default to true] | | **ssh_keys** | **Array<String>** | A list of SSH keys that will be installed on the server. | [optional] | | **ssh_key_ids** | **Array<String>** | A list of SSH key IDs that will be installed on the server in addition to any SSH keys specified in this request. | [optional] | diff --git a/BmcApi/docs/ServerNetworkUpdate.md b/BmcApi/docs/ServerNetworkUpdate.md index 71d54c3e..4b322da3 100644 --- a/BmcApi/docs/ServerNetworkUpdate.md +++ b/BmcApi/docs/ServerNetworkUpdate.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **ips** | **Array<String>** | List of IPs to be associated to the server.<br> Valid IP formats include single IP addresses or IP ranges (IPv4 or IPv6). IPs must be within the network's range.<br> Setting the `force` query parameter to `true` allows you to:<ul> <li> Assign no specific IP addresses by designating an empty array of IPs. <li> Assign one or more IP addresses which are already configured on other resource(s) in network. <li> Assign IP addresses which are considered as reserved in network.</ul> | [optional] | +| **ips** | **Array<String>** | List of IPs to be associated to the server.<br> Valid IP formats include single IP addresses or IP ranges (IPv4 or IPv6). All IPs must be within the network's range.<br> Setting the `force` query parameter to `true` allows you to:<ul> <li> Assign no specific IP addresses by designating an empty array of IPs. <li> Assign one or more IP addresses which are already configured on other resource(s) in network. <li> Assign IP addresses which are considered as reserved in network.</ul> | [optional] | ## Example diff --git a/BmcApi/docs/ServerPrivateNetwork.md b/BmcApi/docs/ServerPrivateNetwork.md index c11a2b34..80ddce5a 100644 --- a/BmcApi/docs/ServerPrivateNetwork.md +++ b/BmcApi/docs/ServerPrivateNetwork.md @@ -8,6 +8,7 @@ | **ips** | **Array<String>** | IPs to configure/configured on the server.<br> Valid IP formats are single IPv4 addresses or IPv4 ranges. IPs must be within the network's range. Should be null or empty list if DHCP is true. <br> If field is undefined and DHCP is false, next available IP in network will be automatically allocated.<br> If the network contains a membership of type 'storage', the first twelve IPs are already reserved by BMC and not usable.<br> Setting the `force` query parameter to `true` allows you to:<ul> <li> Assign no specific IP addresses by designating an empty array of IPs. Note that at least one IP is required for the gateway address to be selected from this network. <li> Assign one or more IP addresses which are already configured on other resource(s) in network. <li> Assign IP addresses which are considered as reserved in network.</ul> | [optional] | | **dhcp** | **Boolean** | Determines whether DHCP is enabled for this server.<br> The following restrictions apply when enabling DHCP:<ul> <li> DHCP support is limited to servers configured exclusively with private networks (PRIVATE_ONLY). <li> DHCP value needs to be consistent across all server-configured private networks. <li> The server does not support manual gateway address configuration. <li> Private IP addresses for network cannot be specified.</ul> Note: Not supported on Proxmox OS. | [optional][default to false] | | **status_description** | **String** | (Read-only) The status of the network. | [optional][readonly] | +| **vlan_id** | **Integer** | (Read-only) The VLAN on which this network has been configured within the network switch. | [optional][readonly] | ## Example @@ -18,7 +19,8 @@ instance = BmcApi::ServerPrivateNetwork.new( id: 603f3b2cfcaf050643b89a4b, ips: ["10.1.1.1","10.1.1.20 - 10.1.1.25"], dhcp: false, - status_description: assigned + status_description: assigned, + vlan_id: 10 ) ``` diff --git a/BmcApi/docs/ServerProvision.md b/BmcApi/docs/ServerProvision.md index 8942e805..f7970efb 100644 --- a/BmcApi/docs/ServerProvision.md +++ b/BmcApi/docs/ServerProvision.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **hostname** | **String** | Hostname of server. | | | **description** | **String** | Description of server. | [optional] | -| **os** | **String** | The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux8`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `proxmox/bullseye`, `proxmox/proxmox8`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`. | | +| **os** | **String** | The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux8`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `debian/trixie`, `proxmox/bullseye`, `proxmox/proxmox8`, `proxmox/proxmox9`,`netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`. | | | **install_default_ssh_keys** | **Boolean** | Whether or not to install SSH keys marked as default in addition to any SSH keys specified in this request. | [optional][default to true] | | **ssh_keys** | **Array<String>** | A list of SSH keys that will be installed on the server. | [optional] | | **ssh_key_ids** | **Array<String>** | A list of SSH key IDs that will be installed on the server in addition to any SSH keys specified in this request. | [optional] | diff --git a/BmcApi/docs/ServerPublicNetwork.md b/BmcApi/docs/ServerPublicNetwork.md index fc9ad93a..89a40399 100644 --- a/BmcApi/docs/ServerPublicNetwork.md +++ b/BmcApi/docs/ServerPublicNetwork.md @@ -5,9 +5,10 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | The network identifier. | | -| **ips** | **Array<String>** | Configurable/configured IPs on the server.<br> At least 1 IP address is required. Valid IP format is single IP addresses. All IPs must be within the network's range.<br> Setting the `computeSlaacIp` field to `true` allows you to provide an empty array of IPs.<br> Additionally, setting the `force` query parameter to `true` allows you to:<ul> <li> Assign no specific IP addresses by designating an empty array of IPs. Note that at least one IP is required for the gateway address to be selected from this network. <li> Assign one or more IP addresses which are already configured on other resource(s) in network.</ul> | [optional] | +| **ips** | **Array<String>** | Configurable/configured IPs on the server.<br> At least 1 IP address is required. Valid IP formats include single IP addresses or IP ranges (IPv4 or IPv6). All IPs must be within the network's range.<br> Setting the `computeSlaacIp` field to `true` allows you to provide an empty array of IPs.<br> Additionally, setting the `force` query parameter to `true` allows you to:<ul> <li> Assign no specific IP addresses by designating an empty array of IPs. Note that at least one IP is required for the gateway address to be selected from this network. <li> Assign one or more IP addresses which are already configured on other resource(s) in network.</ul> | [optional] | | **status_description** | **String** | (Read-only) The status of the assignment to the network. | [optional][readonly] | | **compute_slaac_ip** | **Boolean** | (Write-only) Requests Stateless Address Autoconfiguration (SLAAC). Applicable for Network which contains IPv6 block(s). | [optional] | +| **vlan_id** | **Integer** | (Read-only) The VLAN on which this network has been configured within the network switch. | [optional][readonly] | ## Example @@ -16,9 +17,10 @@ require 'pnap_bmc_api' instance = BmcApi::ServerPublicNetwork.new( id: 60473c2509268bc77fd06d29, - ips: ["182.16.0.146","2001:db8::b"], + ips: ["182.16.0.146","10.1.1.20 - 10.1.1.25","2001:db8::f","2001:db8::b - 2001:db8::d"], status_description: assigned, - compute_slaac_ip: true + compute_slaac_ip: true, + vlan_id: 10 ) ``` diff --git a/BmcApi/docs/ServersApi.md b/BmcApi/docs/ServersApi.md index 11673080..ad55a923 100644 --- a/BmcApi/docs/ServersApi.md +++ b/BmcApi/docs/ServersApi.md @@ -15,6 +15,7 @@ All URIs are relative to *https://api.phoenixnap.com/bmc/v1* | [**servers_server_id_actions_reserve_post**](ServersApi.md#servers_server_id_actions_reserve_post) | **POST** /servers/{serverId}/actions/reserve | Reserve server. | | [**servers_server_id_actions_reset_post**](ServersApi.md#servers_server_id_actions_reset_post) | **POST** /servers/{serverId}/actions/reset | Reset server. | | [**servers_server_id_actions_shutdown_post**](ServersApi.md#servers_server_id_actions_shutdown_post) | **POST** /servers/{serverId}/actions/shutdown | Shutdown server. | +| [**servers_server_id_actions_transfer_reservation**](ServersApi.md#servers_server_id_actions_transfer_reservation) | **POST** /servers/{serverId}/actions/transfer-reservation | Transfer server reservation. | | [**servers_server_id_delete**](ServersApi.md#servers_server_id_delete) | **DELETE** /servers/{serverId} | Delete server. | | [**servers_server_id_get**](ServersApi.md#servers_server_id_get) | **GET** /servers/{serverId} | Get server. | | [**servers_server_id_ip_blocks_ip_block_id_delete**](ServersApi.md#servers_server_id_ip_blocks_ip_block_id_delete) | **DELETE** /servers/{serverId}/network-configuration/ip-block-configurations/ip-blocks/{ipBlockId} | Unassign IP Block from Server. | @@ -807,6 +808,77 @@ end - **Accept**: application/json +## servers_server_id_actions_transfer_reservation + +> servers_server_id_actions_transfer_reservation(server_id, reservation_transfer_details) + +Transfer server reservation. + +Transfer server reservation. An active (READY) reservation can be transferred from a server in ERROR or RESERVED status to another HOURLY provisioned server of the same location and type. + +### Examples + +```ruby +require 'time' +require 'pnap_bmc_api' +# setup authorization +BmcApi.configure do |config| + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' +end + +api_instance = BmcApi::ServersApi.new +server_id = '60473a6115e34466c9f8f083' # String | The server's ID. +reservation_transfer_details = BmcApi::ReservationTransferDetails.new({target_server_id: '54a21648dasda4s9843a17'}) # ReservationTransferDetails | + +begin + # Transfer server reservation. + result = api_instance.servers_server_id_actions_transfer_reservation(server_id, reservation_transfer_details) + p result +rescue BmcApi::ApiError => e + puts "Error when calling ServersApi->servers_server_id_actions_transfer_reservation: #{e}" +end +``` + +#### Using the servers_server_id_actions_transfer_reservation_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> servers_server_id_actions_transfer_reservation_with_http_info(server_id, reservation_transfer_details) + +```ruby +begin + # Transfer server reservation. + data, status_code, headers = api_instance.servers_server_id_actions_transfer_reservation_with_http_info(server_id, reservation_transfer_details) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue BmcApi::ApiError => e + puts "Error when calling ServersApi->servers_server_id_actions_transfer_reservation_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **server_id** | **String** | The server's ID. | | +| **reservation_transfer_details** | [**ReservationTransferDetails**](ReservationTransferDetails.md) | | | + +### Return type + +[**Server**](Server.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + ## servers_server_id_delete > servers_server_id_delete(server_id) diff --git a/BmcApi/lib/pnap_bmc_api.rb b/BmcApi/lib/pnap_bmc_api.rb index 7826f1a4..c6a2be47 100644 --- a/BmcApi/lib/pnap_bmc_api.rb +++ b/BmcApi/lib/pnap_bmc_api.rb @@ -6,13 +6,14 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end # Common files require 'pnap_bmc_api/api_client' require 'pnap_bmc_api/api_error' +require 'pnap_bmc_api/api_model_base' require 'pnap_bmc_api/version' require 'pnap_bmc_api/configuration' @@ -40,6 +41,7 @@ require 'pnap_bmc_api/models/quota_edit_limit_request' require 'pnap_bmc_api/models/quota_edit_limit_request_details' require 'pnap_bmc_api/models/relinquish_ip_block' +require 'pnap_bmc_api/models/reservation_transfer_details' require 'pnap_bmc_api/models/reset_result' require 'pnap_bmc_api/models/server' require 'pnap_bmc_api/models/server_create' diff --git a/BmcApi/lib/pnap_bmc_api/api/quotas_api.rb b/BmcApi/lib/pnap_bmc_api/api/quotas_api.rb index da26d677..048fb7ff 100644 --- a/BmcApi/lib/pnap_bmc_api/api/quotas_api.rb +++ b/BmcApi/lib/pnap_bmc_api/api/quotas_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -45,7 +45,7 @@ def quotas_get_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -114,7 +114,7 @@ def quotas_quota_id_actions_request_edit_post_with_http_info(quota_id, quota_edi # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -182,7 +182,7 @@ def quotas_quota_id_get_with_http_info(quota_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} diff --git a/BmcApi/lib/pnap_bmc_api/api/servers_api.rb b/BmcApi/lib/pnap_bmc_api/api/servers_api.rb index 7c81b669..82bfe5f1 100644 --- a/BmcApi/lib/pnap_bmc_api/api/servers_api.rb +++ b/BmcApi/lib/pnap_bmc_api/api/servers_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -57,7 +57,7 @@ def delete_private_network_with_http_info(server_id, private_network_id, opts = # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -117,7 +117,7 @@ def servers_get_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -183,7 +183,7 @@ def servers_post_with_http_info(server_create, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -257,7 +257,7 @@ def servers_server_id_actions_deprovision_post_with_http_info(server_id, relinqu # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -325,7 +325,7 @@ def servers_server_id_actions_power_off_post_with_http_info(server_id, opts = {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -388,7 +388,7 @@ def servers_server_id_actions_power_on_post_with_http_info(server_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -460,7 +460,7 @@ def servers_server_id_actions_provision_post_with_http_info(server_id, server_pr # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -528,7 +528,7 @@ def servers_server_id_actions_reboot_post_with_http_info(server_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -597,7 +597,7 @@ def servers_server_id_actions_reserve_post_with_http_info(server_id, server_rese # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -671,7 +671,7 @@ def servers_server_id_actions_reset_post_with_http_info(server_id, server_reset, # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -739,7 +739,7 @@ def servers_server_id_actions_shutdown_post_with_http_info(server_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -770,6 +770,80 @@ def servers_server_id_actions_shutdown_post_with_http_info(server_id, opts = {}) return data, status_code, headers end + # Transfer server reservation. + # Transfer server reservation. An active (READY) reservation can be transferred from a server in ERROR or RESERVED status to another HOURLY provisioned server of the same location and type. + # @param server_id [String] The server's ID. + # @param reservation_transfer_details [ReservationTransferDetails] + # @param [Hash] opts the optional parameters + # @return [Server] + def servers_server_id_actions_transfer_reservation(server_id, reservation_transfer_details, opts = {}) + data, _status_code, _headers = servers_server_id_actions_transfer_reservation_with_http_info(server_id, reservation_transfer_details, opts) + data + end + + # Transfer server reservation. + # Transfer server reservation. An active (READY) reservation can be transferred from a server in ERROR or RESERVED status to another HOURLY provisioned server of the same location and type. + # @param server_id [String] The server's ID. + # @param reservation_transfer_details [ReservationTransferDetails] + # @param [Hash] opts the optional parameters + # @return [Array<(Server, Integer, Hash)>] Server data, response status code and response headers + def servers_server_id_actions_transfer_reservation_with_http_info(server_id, reservation_transfer_details, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ServersApi.servers_server_id_actions_transfer_reservation ...' + end + # verify the required parameter 'server_id' is set + if @api_client.config.client_side_validation && server_id.nil? + fail ArgumentError, "Missing the required parameter 'server_id' when calling ServersApi.servers_server_id_actions_transfer_reservation" + end + # verify the required parameter 'reservation_transfer_details' is set + if @api_client.config.client_side_validation && reservation_transfer_details.nil? + fail ArgumentError, "Missing the required parameter 'reservation_transfer_details' when calling ServersApi.servers_server_id_actions_transfer_reservation" + end + # resource path + local_var_path = '/servers/{serverId}/actions/transfer-reservation'.sub('{' + 'serverId' + '}', CGI.escape(server_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']) unless header_params['Accept'] + # 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(reservation_transfer_details) + + # return_type + return_type = opts[:debug_return_type] || 'Server' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"ServersApi.servers_server_id_actions_transfer_reservation", + :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: ServersApi#servers_server_id_actions_transfer_reservation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete server. # Deprovision specific server. Any IP blocks assigned to this server will also be relinquished and deleted. Deprecated: see /servers/{serverId}/actions/deprovision # @param server_id [String] The server's ID. @@ -802,7 +876,7 @@ def servers_server_id_delete_with_http_info(server_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -865,7 +939,7 @@ def servers_server_id_get_with_http_info(server_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -940,7 +1014,7 @@ def servers_server_id_ip_blocks_ip_block_id_delete_with_http_info(server_id, ip_ # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -1014,7 +1088,7 @@ def servers_server_id_ip_blocks_post_with_http_info(server_id, server_ip_block, # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -1088,7 +1162,7 @@ def servers_server_id_patch_with_http_info(server_id, server_patch, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -1171,7 +1245,7 @@ def servers_server_id_private_networks_patch_with_http_info(server_id, private_n # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -1248,7 +1322,7 @@ def servers_server_id_private_networks_post_with_http_info(server_id, server_pri # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -1322,7 +1396,7 @@ def servers_server_id_public_networks_delete_with_http_info(server_id, public_ne # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -1400,7 +1474,7 @@ def servers_server_id_public_networks_patch_with_http_info(server_id, public_net # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -1477,7 +1551,7 @@ def servers_server_id_public_networks_post_with_http_info(server_id, server_publ # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -1551,7 +1625,7 @@ def servers_server_id_tags_put_with_http_info(server_id, tag_assignment_request, # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? diff --git a/BmcApi/lib/pnap_bmc_api/api/ssh_keys_api.rb b/BmcApi/lib/pnap_bmc_api/api/ssh_keys_api.rb index 6644cff4..633e2ee5 100644 --- a/BmcApi/lib/pnap_bmc_api/api/ssh_keys_api.rb +++ b/BmcApi/lib/pnap_bmc_api/api/ssh_keys_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -45,7 +45,7 @@ def ssh_keys_get_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -108,7 +108,7 @@ def ssh_keys_post_with_http_info(ssh_key_create, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -176,7 +176,7 @@ def ssh_keys_ssh_key_id_delete_with_http_info(ssh_key_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -239,7 +239,7 @@ def ssh_keys_ssh_key_id_get_with_http_info(ssh_key_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -308,7 +308,7 @@ def ssh_keys_ssh_key_id_put_with_http_info(ssh_key_id, ssh_key_update, opts = {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? diff --git a/BmcApi/lib/pnap_bmc_api/api_client.rb b/BmcApi/lib/pnap_bmc_api/api_client.rb index 29e89728..e9fd15d6 100644 --- a/BmcApi/lib/pnap_bmc_api/api_client.rb +++ b/BmcApi/lib/pnap_bmc_api/api_client.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -52,7 +52,8 @@ def self.default # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers. def call_api(http_method, path, opts = {}) request = build_request(http_method, path, opts) - tempfile = download_file(request) if opts[:return_type] == 'File' + tempfile = nil + (download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File' response = request.run if @config.debugging @@ -191,19 +192,17 @@ def download_file(request) chunk.force_encoding(encoding) tempfile.write(chunk) end - # run the request to ensure the tempfile is created successfully before returning it - request.run - if tempfile + request.on_complete do + if !tempfile + fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + end tempfile.close @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ "will be deleted automatically with GC. It's also recommended to delete the temp file "\ "explicitly with `tempfile.delete`" - else - fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + yield tempfile if block_given? end - - tempfile end # Check if the given MIME is a JSON MIME. @@ -215,7 +214,7 @@ def download_file(request) # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type. @@ -282,9 +281,13 @@ def convert_to_type(data, return_type) data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else - # models (e.g. Pet) or oneOf + # models (e.g. Pet) or oneOf/anyOf klass = BmcApi.const_get(return_type) - klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of) + klass.build(data) + else + klass.build_from_hash(data) + end end end @@ -294,7 +297,7 @@ def convert_to_type(data, return_type) # @param [String] filename the filename to be sanitized # @return [String] the sanitized filename def sanitize_filename(filename) - filename.gsub(/.*[\/\\]/, '') + filename.split(/[\/\\]/).last end def build_request_url(path, opts = {}) @@ -394,4 +397,4 @@ def build_collection_param(param, collection_format) end end end -end +end \ No newline at end of file diff --git a/BmcApi/lib/pnap_bmc_api/api_error.rb b/BmcApi/lib/pnap_bmc_api/api_error.rb index 36acddd3..38d62649 100644 --- a/BmcApi/lib/pnap_bmc_api/api_error.rb +++ b/BmcApi/lib/pnap_bmc_api/api_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BmcApi/lib/pnap_bmc_api/api_model_base.rb b/BmcApi/lib/pnap_bmc_api/api_model_base.rb new file mode 100644 index 00000000..b5c818d2 --- /dev/null +++ b/BmcApi/lib/pnap_bmc_api/api_model_base.rb @@ -0,0 +1,88 @@ +=begin +#Bare Metal Cloud API + +#Create, power off, power on, reset, reboot, or shut down your server with the Bare Metal Cloud API. Deprovision servers, get or edit SSH key details, assign public IPs, assign servers to networks and a lot more. Manage your infrastructure more efficiently using just a few simple API calls.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/bmc/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +module BmcApi + class ApiModelBase + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._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 = BmcApi.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 + + # 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/BmcApi/lib/pnap_bmc_api/configuration.rb b/BmcApi/lib/pnap_bmc_api/configuration.rb index 51003ac2..88ead4b0 100644 --- a/BmcApi/lib/pnap_bmc_api/configuration.rb +++ b/BmcApi/lib/pnap_bmc_api/configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -79,6 +79,14 @@ class Configuration # @return [true, false] attr_accessor :debugging + # Set this to ignore operation servers for the API client. This is useful when you need to + # send requests to a different server than the one specified in the OpenAPI document. + # Will default to the base url defined in the spec but can be overridden by setting + # `scheme`, `host`, `base_path` directly. + # Default to false. + # @return [true, false] + attr_accessor :ignore_operation_servers + # Defines the logger used for debugging. # Default to `Rails.logger` (when in Rails) or logging to STDOUT. # @@ -166,6 +174,7 @@ def initialize @timeout = 0 @params_encoding = nil @debugging = false + @ignore_operation_servers = false @inject_format = false @force_ending_format = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) @@ -200,6 +209,7 @@ def base_path=(base_path) # Returns base URL for specified operation based on server settings def base_url(operation = nil) + return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers if operation_server_settings.key?(operation) then index = server_operation_index.fetch(operation, server_index) server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) diff --git a/BmcApi/lib/pnap_bmc_api/models/action_result.rb b/BmcApi/lib/pnap_bmc_api/models/action_result.rb index fa198b73..7866b139 100644 --- a/BmcApi/lib/pnap_bmc_api/models/action_result.rb +++ b/BmcApi/lib/pnap_bmc_api/models/action_result.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Result of a successful action. - class ActionResult + class ActionResult < ApiModelBase # Message describing the action's result. attr_accessor :result @@ -26,9 +26,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::ActionResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::ActionResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -86,6 +92,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] result Value to be assigned + def result=(result) + if result.nil? + fail ArgumentError, 'result cannot be nil' + end + + @result = result + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -129,61 +145,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -200,24 +161,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/delete_result.rb b/BmcApi/lib/pnap_bmc_api/models/delete_result.rb index 16de1f38..69a7335c 100644 --- a/BmcApi/lib/pnap_bmc_api/models/delete_result.rb +++ b/BmcApi/lib/pnap_bmc_api/models/delete_result.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Result of a successful delete action. - class DeleteResult + class DeleteResult < ApiModelBase # Server has been deleted. attr_accessor :result @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::DeleteResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::DeleteResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -102,6 +108,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] result Value to be assigned + def result=(result) + if result.nil? + fail ArgumentError, 'result cannot be nil' + end + + @result = result + end + + # Custom attribute writer method with validation + # @param [Object] server_id Value to be assigned + def server_id=(server_id) + if server_id.nil? + fail ArgumentError, 'server_id cannot be nil' + end + + @server_id = server_id + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -146,61 +172,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -217,24 +188,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/delete_ssh_key_result.rb b/BmcApi/lib/pnap_bmc_api/models/delete_ssh_key_result.rb index dfc369d6..9acf11af 100644 --- a/BmcApi/lib/pnap_bmc_api/models/delete_ssh_key_result.rb +++ b/BmcApi/lib/pnap_bmc_api/models/delete_ssh_key_result.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Result of a successful delete action on a SSH key. - class DeleteSshKeyResult + class DeleteSshKeyResult < ApiModelBase # Resource has been deleted. attr_accessor :result @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::DeleteSshKeyResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::DeleteSshKeyResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -102,6 +108,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] result Value to be assigned + def result=(result) + if result.nil? + fail ArgumentError, 'result cannot be nil' + end + + @result = result + end + + # Custom attribute writer method with validation + # @param [Object] ssh_key_id Value to be assigned + def ssh_key_id=(ssh_key_id) + if ssh_key_id.nil? + fail ArgumentError, 'ssh_key_id cannot be nil' + end + + @ssh_key_id = ssh_key_id + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -146,61 +172,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -217,24 +188,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/error.rb b/BmcApi/lib/pnap_bmc_api/models/error.rb index edb7e68d..f2166fd4 100644 --- a/BmcApi/lib/pnap_bmc_api/models/error.rb +++ b/BmcApi/lib/pnap_bmc_api/models/error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module BmcApi - class Error + class Error < ApiModelBase # The description detailing the cause of the error code. attr_accessor :message @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::Error`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -96,6 +102,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] message Value to be assigned + def message=(message) + if message.nil? + fail ArgumentError, 'message cannot be nil' + end + + @message = message + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -140,61 +156,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -211,24 +172,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/esxi_datastore_configuration.rb b/BmcApi/lib/pnap_bmc_api/models/esxi_datastore_configuration.rb index e232d33d..270af0b8 100644 --- a/BmcApi/lib/pnap_bmc_api/models/esxi_datastore_configuration.rb +++ b/BmcApi/lib/pnap_bmc_api/models/esxi_datastore_configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Esxi data storage configuration. - class EsxiDatastoreConfiguration + class EsxiDatastoreConfiguration < ApiModelBase # Datastore name attr_accessor :datastore_name @@ -26,9 +26,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::EsxiDatastoreConfiguration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::EsxiDatastoreConfiguration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -80,7 +86,7 @@ def list_invalid_properties end if @datastore_name.to_s.length < 1 - invalid_properties.push('invalid value for "datastore_name", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "datastore_name", the character length must be greater than or equal to 1.') end pattern = Regexp.new(/^[a-zA-Z0-9]+$/) @@ -114,7 +120,7 @@ def datastore_name=(datastore_name) end if datastore_name.to_s.length < 1 - fail ArgumentError, 'invalid value for "datastore_name", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "datastore_name", the character length must be greater than or equal to 1.' end pattern = Regexp.new(/^[a-zA-Z0-9]+$/) @@ -168,61 +174,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -239,24 +190,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/esxi_os_configuration.rb b/BmcApi/lib/pnap_bmc_api/models/esxi_os_configuration.rb index 909485be..b97bddb7 100644 --- a/BmcApi/lib/pnap_bmc_api/models/esxi_os_configuration.rb +++ b/BmcApi/lib/pnap_bmc_api/models/esxi_os_configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Esxi OS configuration. - class EsxiOsConfiguration + class EsxiOsConfiguration < ApiModelBase attr_accessor :datastore_configuration # Attribute mapping from ruby-style variable name to JSON key. @@ -25,9 +25,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::EsxiOsConfiguration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::EsxiOsConfiguration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -121,61 +127,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -192,24 +143,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/gpu_configuration.rb b/BmcApi/lib/pnap_bmc_api/models/gpu_configuration.rb index c5a5d12b..37c2fb6d 100644 --- a/BmcApi/lib/pnap_bmc_api/models/gpu_configuration.rb +++ b/BmcApi/lib/pnap_bmc_api/models/gpu_configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # The GPU configuration. - class GpuConfiguration + class GpuConfiguration < ApiModelBase # The long name of the GPU. attr_accessor :long_name @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::GpuConfiguration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::GpuConfiguration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -132,61 +138,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -203,24 +154,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/ip_blocks_configuration.rb b/BmcApi/lib/pnap_bmc_api/models/ip_blocks_configuration.rb index 4ff85bf0..a98d5429 100644 --- a/BmcApi/lib/pnap_bmc_api/models/ip_blocks_configuration.rb +++ b/BmcApi/lib/pnap_bmc_api/models/ip_blocks_configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,11 +15,11 @@ module BmcApi # The IP blocks to assign to this server. This is an exclusive allocation, i.e. the IP blocks cannot be shared with other servers. If IpBlocksConfiguration is not defined, the purchase of a new IP block is determined by the networkType field. - class IpBlocksConfiguration + class IpBlocksConfiguration < ApiModelBase # (Write-only) Determines the approach for configuring IP blocks for the server being provisioned. If PURCHASE_NEW is selected, the smallest supported range, depending on the operating system, is allocated to the server. attr_accessor :configuration_type - # Used to specify the previously purchased IP blocks to assign to this server upon provisioning. Used alongside the USER_DEFINED configurationType. + # Used for specifying the previously purchased IPv4 blocks to assign to this server upon provisioning. Used alongside the USER_DEFINED configurationType. attr_accessor :ip_blocks class EnumAttributeValidator @@ -52,9 +52,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -79,9 +84,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::IpBlocksConfiguration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::IpBlocksConfiguration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -189,61 +195,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -260,24 +211,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/network_configuration.rb b/BmcApi/lib/pnap_bmc_api/models/network_configuration.rb index 8bce783b..b8049d3f 100644 --- a/BmcApi/lib/pnap_bmc_api/models/network_configuration.rb +++ b/BmcApi/lib/pnap_bmc_api/models/network_configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Entire network details of bare metal server. - class NetworkConfiguration + class NetworkConfiguration < ApiModelBase # The address of the gateway assigned / to assign to the server.
When used as part of request body, IP address has to be part of a private/public network or an IP block assigned to this server.
Gateway address also has to be assigned on an already deployed resource unless the address matches the BMC gateway address in a public network/IP block or the `force` query parameter is true. attr_accessor :gateway_address @@ -35,9 +35,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -64,9 +69,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::NetworkConfiguration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::NetworkConfiguration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -149,61 +155,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -220,24 +171,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/os_configuration.rb b/BmcApi/lib/pnap_bmc_api/models/os_configuration.rb index c3365a51..ac60032a 100644 --- a/BmcApi/lib/pnap_bmc_api/models/os_configuration.rb +++ b/BmcApi/lib/pnap_bmc_api/models/os_configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # OS specific configuration properties. - class OsConfiguration + class OsConfiguration < ApiModelBase attr_accessor :netris_controller attr_accessor :netris_softgate @@ -53,9 +53,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -87,9 +92,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::OsConfiguration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::OsConfiguration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -220,61 +226,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -291,24 +242,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/os_configuration_cloud_init.rb b/BmcApi/lib/pnap_bmc_api/models/os_configuration_cloud_init.rb index 3c25a246..d6ebcdc0 100644 --- a/BmcApi/lib/pnap_bmc_api/models/os_configuration_cloud_init.rb +++ b/BmcApi/lib/pnap_bmc_api/models/os_configuration_cloud_init.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Cloud-init configuration details. - class OsConfigurationCloudInit + class OsConfigurationCloudInit < ApiModelBase # (Write-only) User data for the cloud-init configuration in base64 encoding. NoCloud format is supported. Follow the instructions on how to provision a server using cloud-init. Only ubuntu/bionic, ubuntu/focal, ubuntu/jammy, debian/bullseye, debian/bookworm, centos/centos7, centos/centos8, almalinux/almalinux8, almalinux/almalinux9, rockylinux/rockylinux8, rockylinux/rockylinux9 and virtuozzo/virtuozzo7 are supported. User data will not be stored and cannot be retrieved once you deploy the server. Copy and save it for future reference. attr_accessor :user_data @@ -26,9 +26,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::OsConfigurationCloudInit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::OsConfigurationCloudInit`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -122,61 +128,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -193,24 +144,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/os_configuration_map.rb b/BmcApi/lib/pnap_bmc_api/models/os_configuration_map.rb index f96e16c0..9994eb86 100644 --- a/BmcApi/lib/pnap_bmc_api/models/os_configuration_map.rb +++ b/BmcApi/lib/pnap_bmc_api/models/os_configuration_map.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # OS specific configuration properties. - class OsConfigurationMap + class OsConfigurationMap < ApiModelBase attr_accessor :windows attr_accessor :esxi @@ -31,9 +31,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -59,9 +64,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::OsConfigurationMap`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::OsConfigurationMap`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -139,61 +145,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -210,24 +161,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/os_configuration_map_esxi.rb b/BmcApi/lib/pnap_bmc_api/models/os_configuration_map_esxi.rb index 50418195..48630c4b 100644 --- a/BmcApi/lib/pnap_bmc_api/models/os_configuration_map_esxi.rb +++ b/BmcApi/lib/pnap_bmc_api/models/os_configuration_map_esxi.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # VMWare ESXi configuration properties. - class OsConfigurationMapEsxi + class OsConfigurationMapEsxi < ApiModelBase # (Read-only) Password set for user root on an ESXi server which will only be returned in response to provisioning a server. attr_accessor :root_password @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::OsConfigurationMapEsxi`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::OsConfigurationMapEsxi`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -163,61 +169,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -234,24 +185,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/os_configuration_map_proxmox.rb b/BmcApi/lib/pnap_bmc_api/models/os_configuration_map_proxmox.rb index b96f837f..1598cf2f 100644 --- a/BmcApi/lib/pnap_bmc_api/models/os_configuration_map_proxmox.rb +++ b/BmcApi/lib/pnap_bmc_api/models/os_configuration_map_proxmox.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Proxmox VE configuration properties. - class OsConfigurationMapProxmox + class OsConfigurationMapProxmox < ApiModelBase # (Read-only) Password set for user root on a Proxmox server which will only be returned in response to provisioning a server. attr_accessor :root_password @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::OsConfigurationMapProxmox`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::OsConfigurationMapProxmox`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -163,61 +169,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -234,24 +185,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/os_configuration_netris_controller.rb b/BmcApi/lib/pnap_bmc_api/models/os_configuration_netris_controller.rb index 0fc93ecf..650c4f0b 100644 --- a/BmcApi/lib/pnap_bmc_api/models/os_configuration_netris_controller.rb +++ b/BmcApi/lib/pnap_bmc_api/models/os_configuration_netris_controller.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Netris Controller configuration properties. Knowledge base article to help you can be found here. - class OsConfigurationNetrisController + class OsConfigurationNetrisController < ApiModelBase # (Read-only) Host OS on which the Netris Controller is installed. attr_accessor :host_os @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::OsConfigurationNetrisController`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::OsConfigurationNetrisController`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -142,61 +148,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -213,24 +164,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/os_configuration_netris_softgate.rb b/BmcApi/lib/pnap_bmc_api/models/os_configuration_netris_softgate.rb index 9e53f7ae..67760ae1 100644 --- a/BmcApi/lib/pnap_bmc_api/models/os_configuration_netris_softgate.rb +++ b/BmcApi/lib/pnap_bmc_api/models/os_configuration_netris_softgate.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Netris Softgate configuration properties. Follow instructions for retrieving the required details. - class OsConfigurationNetrisSoftgate + class OsConfigurationNetrisSoftgate < ApiModelBase # (Read-only) Host OS on which the Netris Softgate is installed. attr_accessor :host_os @@ -38,9 +38,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -67,9 +72,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::OsConfigurationNetrisSoftgate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::OsConfigurationNetrisSoftgate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -203,61 +209,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -274,24 +225,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/os_configuration_windows.rb b/BmcApi/lib/pnap_bmc_api/models/os_configuration_windows.rb index b7b1a0c0..4fd58a4d 100644 --- a/BmcApi/lib/pnap_bmc_api/models/os_configuration_windows.rb +++ b/BmcApi/lib/pnap_bmc_api/models/os_configuration_windows.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,26 +15,36 @@ module BmcApi # Windows OS configuration properties. - class OsConfigurationWindows + class OsConfigurationWindows < ApiModelBase # List of IPs allowed for RDP access to Windows OS. Supported in single IP, CIDR and range format. When undefined, RDP is disabled. To allow RDP access from any IP use 0.0.0.0/0. This will only be returned in response to provisioning a server. attr_accessor :rdp_allowed_ips + # Use a Bring Your Own (BYO) Windows license. If true, the server is provisioned in trial mode, and you must activate your own license. If false (default), the server includes a managed Windows license billed by the platform. + attr_accessor :bring_your_own_license + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'rdp_allowed_ips' => :'rdpAllowedIps' + :'rdp_allowed_ips' => :'rdpAllowedIps', + :'bring_your_own_license' => :'bringYourOwnLicense' } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. def self.openapi_types { - :'rdp_allowed_ips' => :'Array' + :'rdp_allowed_ips' => :'Array', + :'bring_your_own_license' => :'Boolean' } end @@ -52,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::OsConfigurationWindows`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::OsConfigurationWindows`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -64,6 +75,12 @@ def initialize(attributes = {}) self.rdp_allowed_ips = value end end + + if attributes.key?(:'bring_your_own_license') + self.bring_your_own_license = attributes[:'bring_your_own_license'] + else + self.bring_your_own_license = false + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -105,7 +122,8 @@ def rdp_allowed_ips=(rdp_allowed_ips) def ==(o) return true if self.equal?(o) self.class == o.class && - rdp_allowed_ips == o.rdp_allowed_ips + rdp_allowed_ips == o.rdp_allowed_ips && + bring_your_own_license == o.bring_your_own_license end # @see the `==` method @@ -117,7 +135,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [rdp_allowed_ips].hash + [rdp_allowed_ips, bring_your_own_license].hash end # Builds the object from hash @@ -143,61 +161,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -214,24 +177,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/private_network_configuration.rb b/BmcApi/lib/pnap_bmc_api/models/private_network_configuration.rb index 6323329f..1c56452b 100644 --- a/BmcApi/lib/pnap_bmc_api/models/private_network_configuration.rb +++ b/BmcApi/lib/pnap_bmc_api/models/private_network_configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,14 +15,14 @@ module BmcApi # Private network details of bare metal server. - class PrivateNetworkConfiguration + class PrivateNetworkConfiguration < ApiModelBase # Deprecated in favour of a common gateway address across all networks available under NetworkConfiguration.
The address of the gateway assigned / to assign to the server.
When used as part of request body, IP address has to be part of private network assigned to this server.
Gateway address also has to be assigned on an already deployed resource unless the `force` query parameter is true. attr_accessor :gateway_address # (Write-only) Determines the approach for configuring private network(s) for the server being provisioned. Currently this field should be set to `USE_OR_CREATE_DEFAULT`, `USER_DEFINED` or `NONE`. attr_accessor :configuration_type - # The list of private networks this server is member of. When this field is part of request body, it'll be used to specify the private networks to assign to this server upon provisioning. Used alongside the `USER_DEFINED` configurationType. + # The list of private networks this server belongs to. If this field is part of a request body, it will be used for specifying the private networks to assign to this server upon provisioning. Used alongside the USER_DEFINED configurationType. attr_accessor :private_networks # Attribute mapping from ruby-style variable name to JSON key. @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::PrivateNetworkConfiguration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::PrivateNetworkConfiguration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -146,61 +152,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -217,24 +168,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/public_network_configuration.rb b/BmcApi/lib/pnap_bmc_api/models/public_network_configuration.rb index 97512508..6918659e 100644 --- a/BmcApi/lib/pnap_bmc_api/models/public_network_configuration.rb +++ b/BmcApi/lib/pnap_bmc_api/models/public_network_configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,8 +15,8 @@ module BmcApi # Public network details of bare metal server. - class PublicNetworkConfiguration - # The list of public networks this server is member of. When this field is part of request body, it'll be used to specify the public networks to assign to this server upon provisioning. + class PublicNetworkConfiguration < ApiModelBase + # The list of public networks this server belongs to. If this field is part of a request body, it will be used for specifying the public networks to assign to this server on provision. Only IPv4 addresses can be specified. attr_accessor :public_networks # Attribute mapping from ruby-style variable name to JSON key. @@ -26,9 +26,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::PublicNetworkConfiguration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::PublicNetworkConfiguration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -124,61 +130,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -195,24 +146,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/quota.rb b/BmcApi/lib/pnap_bmc_api/models/quota.rb index 1190ad62..041dc183 100644 --- a/BmcApi/lib/pnap_bmc_api/models/quota.rb +++ b/BmcApi/lib/pnap_bmc_api/models/quota.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Quota. - class Quota + class Quota < ApiModelBase # The ID of the Quota. attr_accessor :id @@ -75,9 +75,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -108,9 +113,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::Quota`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::Quota`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -233,6 +239,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + + # Custom attribute writer method with validation + # @param [Object] description Value to be assigned + def description=(description) + if description.nil? + fail ArgumentError, 'description cannot be nil' + end + + @description = description + end + # Custom attribute writer method checking allowed values (enum). # @param [Object] status Object to be assigned def status=(status) @@ -257,6 +293,16 @@ def limit=(limit) @limit = limit end + # Custom attribute writer method with validation + # @param [Object] unit Value to be assigned + def unit=(unit) + if unit.nil? + fail ArgumentError, 'unit cannot be nil' + end + + @unit = unit + end + # Custom attribute writer method with validation # @param [Object] used Value to be assigned def used=(used) @@ -271,6 +317,16 @@ def used=(used) @used = used end + # Custom attribute writer method with validation + # @param [Object] quota_edit_limit_request_details Value to be assigned + def quota_edit_limit_request_details=(quota_edit_limit_request_details) + if quota_edit_limit_request_details.nil? + fail ArgumentError, 'quota_edit_limit_request_details cannot be nil' + end + + @quota_edit_limit_request_details = quota_edit_limit_request_details + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -321,61 +377,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -392,24 +393,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/quota_edit_limit_request.rb b/BmcApi/lib/pnap_bmc_api/models/quota_edit_limit_request.rb index a8ca690f..70778888 100644 --- a/BmcApi/lib/pnap_bmc_api/models/quota_edit_limit_request.rb +++ b/BmcApi/lib/pnap_bmc_api/models/quota_edit_limit_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # A request to change the limit on a quota. - class QuotaEditLimitRequest + class QuotaEditLimitRequest < ApiModelBase # The new limit that is requested. Minimum allowed limit values: - 0 (Server, IPs) - 1000 (Network Storage) attr_accessor :limit @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::QuotaEditLimitRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::QuotaEditLimitRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -186,61 +192,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -257,24 +208,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/quota_edit_limit_request_details.rb b/BmcApi/lib/pnap_bmc_api/models/quota_edit_limit_request_details.rb index 1e6f471c..be42a2ad 100644 --- a/BmcApi/lib/pnap_bmc_api/models/quota_edit_limit_request_details.rb +++ b/BmcApi/lib/pnap_bmc_api/models/quota_edit_limit_request_details.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module BmcApi - class QuotaEditLimitRequestDetails + class QuotaEditLimitRequestDetails < ApiModelBase # The new limit that is requested. Minimum allowed limit values: - 0 (Server, IPs) - 1000 (Network Storage) attr_accessor :limit @@ -33,9 +33,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -68,9 +73,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::QuotaEditLimitRequestDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::QuotaEditLimitRequestDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -168,6 +174,16 @@ def reason=(reason) @reason = reason end + # Custom attribute writer method with validation + # @param [Object] requested_on Value to be assigned + def requested_on=(requested_on) + if requested_on.nil? + fail ArgumentError, 'requested_on cannot be nil' + end + + @requested_on = requested_on + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -213,61 +229,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -284,24 +245,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/relinquish_ip_block.rb b/BmcApi/lib/pnap_bmc_api/models/relinquish_ip_block.rb index 3a8b40b9..0873bf08 100644 --- a/BmcApi/lib/pnap_bmc_api/models/relinquish_ip_block.rb +++ b/BmcApi/lib/pnap_bmc_api/models/relinquish_ip_block.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Object used to determine whether to relinquish ownership of the IP blocks upon unassignment from server or server deletion. - class RelinquishIpBlock + class RelinquishIpBlock < ApiModelBase # Determines whether the IPv4 and IPv6 blocks assigned to the server should be deleted or not. attr_accessor :delete_ip_blocks @@ -26,9 +26,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::RelinquishIpBlock`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::RelinquishIpBlock`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -124,61 +130,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -195,24 +146,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/reservation_transfer_details.rb b/BmcApi/lib/pnap_bmc_api/models/reservation_transfer_details.rb new file mode 100644 index 00000000..8e36b839 --- /dev/null +++ b/BmcApi/lib/pnap_bmc_api/models/reservation_transfer_details.rb @@ -0,0 +1,166 @@ +=begin +#Bare Metal Cloud API + +#Create, power off, power on, reset, reboot, or shut down your server with the Bare Metal Cloud API. Deprovision servers, get or edit SSH key details, assign public IPs, assign servers to networks and a lot more. Manage your infrastructure more efficiently using just a few simple API calls.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/bmc/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'date' +require 'time' + +module BmcApi + # Reservation transfer details. + class ReservationTransferDetails < ApiModelBase + # ID of target server to transfer reservation to. + attr_accessor :target_server_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'target_server_id' => :'targetServerId' + } + end + + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + acceptable_attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'target_server_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_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 `BmcApi::ReservationTransferDetails` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::ReservationTransferDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'target_server_id') + self.target_server_id = attributes[:'target_server_id'] + else + self.target_server_id = nil + 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 + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @target_server_id.nil? + invalid_properties.push('invalid value for "target_server_id", target_server_id 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? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @target_server_id.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] target_server_id Value to be assigned + def target_server_id=(target_server_id) + if target_server_id.nil? + fail ArgumentError, 'target_server_id cannot be nil' + end + + @target_server_id = target_server_id + 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 && + target_server_id == o.target_server_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 + [target_server_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) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{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[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_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.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + end + +end diff --git a/BmcApi/lib/pnap_bmc_api/models/reset_result.rb b/BmcApi/lib/pnap_bmc_api/models/reset_result.rb index 6c7f2f49..fc00adbc 100644 --- a/BmcApi/lib/pnap_bmc_api/models/reset_result.rb +++ b/BmcApi/lib/pnap_bmc_api/models/reset_result.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Result of a successful reset action. - class ResetResult + class ResetResult < ApiModelBase # Message describing the reset result. attr_accessor :result @@ -33,9 +33,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -61,9 +66,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::ResetResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::ResetResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -103,6 +109,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] result Value to be assigned + def result=(result) + if result.nil? + fail ArgumentError, 'result cannot be nil' + end + + @result = result + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -148,61 +164,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -219,24 +180,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/server.rb b/BmcApi/lib/pnap_bmc_api/models/server.rb index aeca6d06..237743e5 100644 --- a/BmcApi/lib/pnap_bmc_api/models/server.rb +++ b/BmcApi/lib/pnap_bmc_api/models/server.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Bare metal server. - class Server + class Server < ApiModelBase # The unique identifier of the server. attr_accessor :id @@ -28,13 +28,13 @@ class Server # Description of server. attr_accessor :description - # The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `rockylinux/rockylinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `proxmox/bullseye`, `proxmox/proxmox8`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`. + # The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `rockylinux/rockylinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `debian/trixie`, `proxmox/bullseye`, `proxmox/proxmox8`, `proxmox/proxmox9`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`. attr_accessor :os - # Server type ID. Cannot be changed once a server is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c1.small`, `d1.c2.small`, `d1.c3.small`, `d1.c4.small`, `d1.c1.medium`, `d1.c2.medium`, `d1.c3.medium`, `d1.c4.medium`, `d1.c1.large`, `d1.c2.large`, `d1.c3.large`, `d1.c4.large`, `d1.m1.medium`, `d1.m2.medium`, `d1.m3.medium`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `a1.c5.xlarge`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge`, `d3.g2.c3.xlarge`, s4.x6.c6.large or s4.x6.m6.xlarge. + # Server type ID. Cannot be changed once a server is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c4.small`, `d1.c4.medium`, `d1.c4.large`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `a1.c5.xlarge`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge`, `d3.g2.c3.xlarge`, `d3.g3.c2.medium`, `s4.x6.c6.large`, `s4.x6.m6.xlarge`, `s5.x6.c3.medium`, `s5.x6.c3.large`, `s5.x6.c8.medium`, `s5.x6.c9.medium`, `s5.x6.c8.large`, `s5.x6.c9.large`, `s5.x6.m8.xlarge`, `s5.x6.m9.xlarge`, `s4.c3.medium`, `s4.c6.medium`, `s4.c6.large`, `s4.c6.xlarge`, `s4.s2.large`, `a2.c9.large` or `a2.c9.xlarge`. attr_accessor :type - # Server location ID. Cannot be changed once a server is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. + # Server location ID. Cannot be changed once a server is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. attr_accessor :location # A description of the machine CPU. @@ -130,9 +130,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -183,9 +188,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::Server`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::Server`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -363,7 +369,7 @@ def list_invalid_properties end if @hostname.to_s.length < 1 - invalid_properties.push('invalid value for "hostname", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "hostname", the character length must be greater than or equal to 1.') end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/) @@ -477,6 +483,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] status Value to be assigned + def status=(status) + if status.nil? + fail ArgumentError, 'status cannot be nil' + end + + @status = status + end + # Custom attribute writer method with validation # @param [Object] hostname Value to be assigned def hostname=(hostname) @@ -489,7 +515,7 @@ def hostname=(hostname) end if hostname.to_s.length < 1 - fail ArgumentError, 'invalid value for "hostname", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "hostname", the character length must be greater than or equal to 1.' end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/) @@ -514,6 +540,36 @@ def description=(description) @description = description end + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + @type = type + end + + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + + # Custom attribute writer method with validation + # @param [Object] cpu Value to be assigned + def cpu=(cpu) + if cpu.nil? + fail ArgumentError, 'cpu cannot be nil' + end + + @cpu = cpu + end + # Custom attribute writer method with validation # @param [Object] cpu_count Value to be assigned def cpu_count=(cpu_count) @@ -556,6 +612,26 @@ def cpu_frequency=(cpu_frequency) @cpu_frequency = cpu_frequency end + # Custom attribute writer method with validation + # @param [Object] ram Value to be assigned + def ram=(ram) + if ram.nil? + fail ArgumentError, 'ram cannot be nil' + end + + @ram = ram + end + + # Custom attribute writer method with validation + # @param [Object] storage Value to be assigned + def storage=(storage) + if storage.nil? + fail ArgumentError, 'storage cannot be nil' + end + + @storage = storage + end + # Custom attribute writer method with validation # @param [Object] private_ip_addresses Value to be assigned def private_ip_addresses=(private_ip_addresses) @@ -584,6 +660,36 @@ def public_ip_addresses=(public_ip_addresses) @public_ip_addresses = public_ip_addresses end + # Custom attribute writer method with validation + # @param [Object] pricing_model Value to be assigned + def pricing_model=(pricing_model) + if pricing_model.nil? + fail ArgumentError, 'pricing_model cannot be nil' + end + + @pricing_model = pricing_model + end + + # Custom attribute writer method with validation + # @param [Object] network_configuration Value to be assigned + def network_configuration=(network_configuration) + if network_configuration.nil? + fail ArgumentError, 'network_configuration cannot be nil' + end + + @network_configuration = network_configuration + end + + # Custom attribute writer method with validation + # @param [Object] storage_configuration Value to be assigned + def storage_configuration=(storage_configuration) + if storage_configuration.nil? + fail ArgumentError, 'storage_configuration cannot be nil' + end + + @storage_configuration = storage_configuration + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -654,61 +760,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -725,24 +776,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/server_create.rb b/BmcApi/lib/pnap_bmc_api/models/server_create.rb index 45911dba..7183040a 100644 --- a/BmcApi/lib/pnap_bmc_api/models/server_create.rb +++ b/BmcApi/lib/pnap_bmc_api/models/server_create.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,20 +15,20 @@ module BmcApi # Provision bare metal server. - class ServerCreate + class ServerCreate < ApiModelBase # Hostname of server. attr_accessor :hostname # Description of server. attr_accessor :description - # The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `rockylinux/rockylinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `proxmox/bullseye`, `proxmox/proxmox8`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`. + # The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `rockylinux/rockylinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `debian/trixie`, `proxmox/bullseye`, `proxmox/proxmox8`, `proxmox/proxmox9`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`. attr_accessor :os - # Server type ID. Cannot be changed once a server is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c1.small`, `d1.c2.small`, `d1.c3.small`, `d1.c4.small`, `d1.c1.medium`, `d1.c2.medium`, `d1.c3.medium`, `d1.c4.medium`, `d1.c1.large`, `d1.c2.large`, `d1.c3.large`, `d1.c4.large`, `d1.m1.medium`, `d1.m2.medium`, `d1.m3.medium`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `a1.c5.xlarge`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge`, `d3.g2.c3.xlarge`, s4.x6.c6.large or s4.x6.m6.xlarge. + # Server type ID. Cannot be changed once a server is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c4.small`, `d1.c4.medium`, `d1.c4.large`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `a1.c5.xlarge`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge`, `d3.g2.c3.xlarge`,`d3.g3.c2.medium`, `s4.x6.c6.large`, `s4.x6.m6.xlarge`, `s5.x6.c3.medium`, `s5.x6.c3.large`, `s5.x6.c8.medium`, `s5.x6.c9.medium`, `s5.x6.c8.large`, `s5.x6.c9.large`, `s5.x6.m8.xlarge`, `s5.x6.m9.xlarge`, `s4.c3.medium`, `s4.c6.medium`, `s4.c6.large`, `s4.c6.xlarge`, `s4.s2.large`, `a2.c9.large` or `a2.c9.xlarge`. attr_accessor :type - # Server location ID. Cannot be changed once a server is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. + # Server location ID. Cannot be changed once a server is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. attr_accessor :location # Whether or not to install SSH keys marked as default in addition to any SSH keys specified in this request. @@ -79,9 +79,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -119,9 +124,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::ServerCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::ServerCreate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -221,7 +227,7 @@ def list_invalid_properties end if @hostname.to_s.length < 1 - invalid_properties.push('invalid value for "hostname", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "hostname", the character length must be greater than or equal to 1.') end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/) @@ -275,7 +281,7 @@ def hostname=(hostname) end if hostname.to_s.length < 1 - fail ArgumentError, 'invalid value for "hostname", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "hostname", the character length must be greater than or equal to 1.' end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/) @@ -300,6 +306,36 @@ def description=(description) @description = description end + # Custom attribute writer method with validation + # @param [Object] os Value to be assigned + def os=(os) + if os.nil? + fail ArgumentError, 'os cannot be nil' + end + + @os = os + end + + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + @type = type + end + + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -357,61 +393,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -428,24 +409,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/server_ip_block.rb b/BmcApi/lib/pnap_bmc_api/models/server_ip_block.rb index 548ae672..750f6031 100644 --- a/BmcApi/lib/pnap_bmc_api/models/server_ip_block.rb +++ b/BmcApi/lib/pnap_bmc_api/models/server_ip_block.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # IP block assigned to server - class ServerIpBlock + class ServerIpBlock < ApiModelBase # The IP block's ID. attr_accessor :id @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::ServerIpBlock`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::ServerIpBlock`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -95,6 +101,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -139,61 +155,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -210,24 +171,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/server_network_update.rb b/BmcApi/lib/pnap_bmc_api/models/server_network_update.rb index 47448d59..761602a4 100644 --- a/BmcApi/lib/pnap_bmc_api/models/server_network_update.rb +++ b/BmcApi/lib/pnap_bmc_api/models/server_network_update.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,8 +15,8 @@ module BmcApi # Update network details of bare metal server. - class ServerNetworkUpdate - # List of IPs to be associated to the server.
Valid IP formats include single IP addresses or IP ranges (IPv4 or IPv6). IPs must be within the network's range.
Setting the `force` query parameter to `true` allows you to:
  • Assign no specific IP addresses by designating an empty array of IPs.
  • Assign one or more IP addresses which are already configured on other resource(s) in network.
  • Assign IP addresses which are considered as reserved in network.
+ class ServerNetworkUpdate < ApiModelBase + # List of IPs to be associated to the server.
Valid IP formats include single IP addresses or IP ranges (IPv4 or IPv6). All IPs must be within the network's range.
Setting the `force` query parameter to `true` allows you to:
  • Assign no specific IP addresses by designating an empty array of IPs.
  • Assign one or more IP addresses which are already configured on other resource(s) in network.
  • Assign IP addresses which are considered as reserved in network.
attr_accessor :ips # Attribute mapping from ruby-style variable name to JSON key. @@ -26,9 +26,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::ServerNetworkUpdate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::ServerNetworkUpdate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -124,61 +130,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -195,24 +146,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/server_patch.rb b/BmcApi/lib/pnap_bmc_api/models/server_patch.rb index 5b11db68..76bb8388 100644 --- a/BmcApi/lib/pnap_bmc_api/models/server_patch.rb +++ b/BmcApi/lib/pnap_bmc_api/models/server_patch.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Patch bare metal server. - class ServerPatch + class ServerPatch < ApiModelBase # Description of server. attr_accessor :description @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::ServerPatch`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::ServerPatch`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -87,7 +93,7 @@ def list_invalid_properties end if !@hostname.nil? && @hostname.to_s.length < 1 - invalid_properties.push('invalid value for "hostname", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "hostname", the character length must be greater than or equal to 1.') end pattern = Regexp.new(/[a-zA-Z0-9().-]+/) @@ -135,7 +141,7 @@ def hostname=(hostname) end if hostname.to_s.length < 1 - fail ArgumentError, 'invalid value for "hostname", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "hostname", the character length must be greater than or equal to 1.' end pattern = Regexp.new(/[a-zA-Z0-9().-]+/) @@ -190,61 +196,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -261,24 +212,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/server_private_network.rb b/BmcApi/lib/pnap_bmc_api/models/server_private_network.rb index 245e1a62..0c9af142 100644 --- a/BmcApi/lib/pnap_bmc_api/models/server_private_network.rb +++ b/BmcApi/lib/pnap_bmc_api/models/server_private_network.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Private network details of bare metal server. - class ServerPrivateNetwork + class ServerPrivateNetwork < ApiModelBase # The network identifier. attr_accessor :id @@ -28,19 +28,28 @@ class ServerPrivateNetwork # (Read-only) The status of the network. attr_accessor :status_description + # (Read-only) The VLAN on which this network has been configured within the network switch. + attr_accessor :vlan_id + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'id' => :'id', :'ips' => :'ips', :'dhcp' => :'dhcp', - :'status_description' => :'statusDescription' + :'status_description' => :'statusDescription', + :'vlan_id' => :'vlanId' } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -49,7 +58,8 @@ def self.openapi_types :'id' => :'String', :'ips' => :'Array', :'dhcp' => :'Boolean', - :'status_description' => :'String' + :'status_description' => :'String', + :'vlan_id' => :'Integer' } end @@ -67,9 +77,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::ServerPrivateNetwork`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::ServerPrivateNetwork`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -95,6 +106,10 @@ def initialize(attributes = {}) if attributes.key?(:'status_description') self.status_description = attributes[:'status_description'] end + + if attributes.key?(:'vlan_id') + self.vlan_id = attributes[:'vlan_id'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -122,6 +137,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + # Custom attribute writer method with validation # @param [Object] ips Value to be assigned def ips=(ips) @@ -144,7 +169,8 @@ def ==(o) id == o.id && ips == o.ips && dhcp == o.dhcp && - status_description == o.status_description + status_description == o.status_description && + vlan_id == o.vlan_id end # @see the `==` method @@ -156,7 +182,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, ips, dhcp, status_description].hash + [id, ips, dhcp, status_description, vlan_id].hash end # Builds the object from hash @@ -182,61 +208,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -253,24 +224,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/server_provision.rb b/BmcApi/lib/pnap_bmc_api/models/server_provision.rb index d4a2703e..9024b008 100644 --- a/BmcApi/lib/pnap_bmc_api/models/server_provision.rb +++ b/BmcApi/lib/pnap_bmc_api/models/server_provision.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,14 +15,14 @@ module BmcApi # Provision bare metal server. - class ServerProvision + class ServerProvision < ApiModelBase # Hostname of server. attr_accessor :hostname # Description of server. attr_accessor :description - # The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux8`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `proxmox/bullseye`, `proxmox/proxmox8`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`. + # The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux8`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `debian/trixie`, `proxmox/bullseye`, `proxmox/proxmox8`, `proxmox/proxmox9`,`netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`. attr_accessor :os # Whether or not to install SSH keys marked as default in addition to any SSH keys specified in this request. @@ -63,9 +63,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -99,9 +104,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::ServerProvision`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::ServerProvision`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -179,7 +185,7 @@ def list_invalid_properties end if @hostname.to_s.length < 1 - invalid_properties.push('invalid value for "hostname", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "hostname", the character length must be greater than or equal to 1.') end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/) @@ -223,7 +229,7 @@ def hostname=(hostname) end if hostname.to_s.length < 1 - fail ArgumentError, 'invalid value for "hostname", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "hostname", the character length must be greater than or equal to 1.' end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/) @@ -248,6 +254,16 @@ def description=(description) @description = description end + # Custom attribute writer method with validation + # @param [Object] os Value to be assigned + def os=(os) + if os.nil? + fail ArgumentError, 'os cannot be nil' + end + + @os = os + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -301,61 +317,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -372,24 +333,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/server_public_network.rb b/BmcApi/lib/pnap_bmc_api/models/server_public_network.rb index 76ab15c9..635a6fdb 100644 --- a/BmcApi/lib/pnap_bmc_api/models/server_public_network.rb +++ b/BmcApi/lib/pnap_bmc_api/models/server_public_network.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,11 +15,11 @@ module BmcApi # Public network details of bare metal server. - class ServerPublicNetwork + class ServerPublicNetwork < ApiModelBase # The network identifier. attr_accessor :id - # Configurable/configured IPs on the server.
At least 1 IP address is required. Valid IP format is single IP addresses. All IPs must be within the network's range.
Setting the `computeSlaacIp` field to `true` allows you to provide an empty array of IPs.
Additionally, setting the `force` query parameter to `true` allows you to:
  • Assign no specific IP addresses by designating an empty array of IPs. Note that at least one IP is required for the gateway address to be selected from this network.
  • Assign one or more IP addresses which are already configured on other resource(s) in network.
+ # Configurable/configured IPs on the server.
At least 1 IP address is required. Valid IP formats include single IP addresses or IP ranges (IPv4 or IPv6). All IPs must be within the network's range.
Setting the `computeSlaacIp` field to `true` allows you to provide an empty array of IPs.
Additionally, setting the `force` query parameter to `true` allows you to:
  • Assign no specific IP addresses by designating an empty array of IPs. Note that at least one IP is required for the gateway address to be selected from this network.
  • Assign one or more IP addresses which are already configured on other resource(s) in network.
attr_accessor :ips # (Read-only) The status of the assignment to the network. @@ -28,19 +28,28 @@ class ServerPublicNetwork # (Write-only) Requests Stateless Address Autoconfiguration (SLAAC). Applicable for Network which contains IPv6 block(s). attr_accessor :compute_slaac_ip + # (Read-only) The VLAN on which this network has been configured within the network switch. + attr_accessor :vlan_id + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'id' => :'id', :'ips' => :'ips', :'status_description' => :'statusDescription', - :'compute_slaac_ip' => :'computeSlaacIp' + :'compute_slaac_ip' => :'computeSlaacIp', + :'vlan_id' => :'vlanId' } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -49,7 +58,8 @@ def self.openapi_types :'id' => :'String', :'ips' => :'Array', :'status_description' => :'String', - :'compute_slaac_ip' => :'Boolean' + :'compute_slaac_ip' => :'Boolean', + :'vlan_id' => :'Integer' } end @@ -67,9 +77,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::ServerPublicNetwork`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::ServerPublicNetwork`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -93,6 +104,10 @@ def initialize(attributes = {}) if attributes.key?(:'compute_slaac_ip') self.compute_slaac_ip = attributes[:'compute_slaac_ip'] end + + if attributes.key?(:'vlan_id') + self.vlan_id = attributes[:'vlan_id'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -115,6 +130,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -123,7 +148,8 @@ def ==(o) id == o.id && ips == o.ips && status_description == o.status_description && - compute_slaac_ip == o.compute_slaac_ip + compute_slaac_ip == o.compute_slaac_ip && + vlan_id == o.vlan_id end # @see the `==` method @@ -135,7 +161,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, ips, status_description, compute_slaac_ip].hash + [id, ips, status_description, compute_slaac_ip, vlan_id].hash end # Builds the object from hash @@ -161,61 +187,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -232,24 +203,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/server_reserve.rb b/BmcApi/lib/pnap_bmc_api/models/server_reserve.rb index 7e389058..39f159a9 100644 --- a/BmcApi/lib/pnap_bmc_api/models/server_reserve.rb +++ b/BmcApi/lib/pnap_bmc_api/models/server_reserve.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Bare metal server reservation. - class ServerReserve + class ServerReserve < ApiModelBase # Server pricing model. Currently this field should be set to `ONE_MONTH_RESERVATION`, `TWELVE_MONTHS_RESERVATION`, `TWENTY_FOUR_MONTHS_RESERVATION` or `THIRTY_SIX_MONTHS_RESERVATION`. attr_accessor :pricing_model @@ -26,9 +26,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::ServerReserve`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::ServerReserve`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -86,6 +92,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] pricing_model Value to be assigned + def pricing_model=(pricing_model) + if pricing_model.nil? + fail ArgumentError, 'pricing_model cannot be nil' + end + + @pricing_model = pricing_model + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -129,61 +145,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -200,24 +161,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/server_reset.rb b/BmcApi/lib/pnap_bmc_api/models/server_reset.rb index 91c55fb6..3de7430c 100644 --- a/BmcApi/lib/pnap_bmc_api/models/server_reset.rb +++ b/BmcApi/lib/pnap_bmc_api/models/server_reset.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Reset bare metal server. - class ServerReset + class ServerReset < ApiModelBase # Whether or not to install SSH keys marked as default in addition to any SSH keys specified in this request. attr_accessor :install_default_ssh_keys @@ -37,9 +37,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -66,9 +71,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::ServerReset`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::ServerReset`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -157,61 +163,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -228,24 +179,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/ssh_key.rb b/BmcApi/lib/pnap_bmc_api/models/ssh_key.rb index a98a40e5..7a553c7a 100644 --- a/BmcApi/lib/pnap_bmc_api/models/ssh_key.rb +++ b/BmcApi/lib/pnap_bmc_api/models/ssh_key.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # SSH Key. - class SshKey + class SshKey < ApiModelBase # The unique identifier of the SSH Key. attr_accessor :id @@ -50,9 +50,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -82,9 +87,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::SshKey`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::SshKey`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -182,6 +188,76 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] default Value to be assigned + def default=(default) + if default.nil? + fail ArgumentError, 'default cannot be nil' + end + + @default = default + end + + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + + # Custom attribute writer method with validation + # @param [Object] key Value to be assigned + def key=(key) + if key.nil? + fail ArgumentError, 'key cannot be nil' + end + + @key = key + end + + # Custom attribute writer method with validation + # @param [Object] fingerprint Value to be assigned + def fingerprint=(fingerprint) + if fingerprint.nil? + fail ArgumentError, 'fingerprint cannot be nil' + end + + @fingerprint = fingerprint + end + + # Custom attribute writer method with validation + # @param [Object] created_on Value to be assigned + def created_on=(created_on) + if created_on.nil? + fail ArgumentError, 'created_on cannot be nil' + end + + @created_on = created_on + end + + # Custom attribute writer method with validation + # @param [Object] last_updated_on Value to be assigned + def last_updated_on=(last_updated_on) + if last_updated_on.nil? + fail ArgumentError, 'last_updated_on cannot be nil' + end + + @last_updated_on = last_updated_on + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -231,61 +307,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -302,24 +323,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/ssh_key_create.rb b/BmcApi/lib/pnap_bmc_api/models/ssh_key_create.rb index b002594a..f28e0030 100644 --- a/BmcApi/lib/pnap_bmc_api/models/ssh_key_create.rb +++ b/BmcApi/lib/pnap_bmc_api/models/ssh_key_create.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # SSH key creation model. - class SshKeyCreate + class SshKeyCreate < ApiModelBase # Keys marked as default are always included on server creation and reset unless toggled off in creation/reset request. attr_accessor :default @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::SshKeyCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::SshKeyCreate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -106,7 +112,7 @@ def list_invalid_properties end if @name.to_s.length < 1 - invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end pattern = Regexp.new(/^(?!\s*$).+/) @@ -140,6 +146,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] default Value to be assigned + def default=(default) + if default.nil? + fail ArgumentError, 'default cannot be nil' + end + + @default = default + end + # Custom attribute writer method with validation # @param [Object] name Value to be assigned def name=(name) @@ -152,7 +168,7 @@ def name=(name) end if name.to_s.length < 1 - fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.' end pattern = Regexp.new(/^(?!\s*$).+/) @@ -223,61 +239,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -294,24 +255,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/ssh_key_update.rb b/BmcApi/lib/pnap_bmc_api/models/ssh_key_update.rb index 95e68873..03dd8bd4 100644 --- a/BmcApi/lib/pnap_bmc_api/models/ssh_key_update.rb +++ b/BmcApi/lib/pnap_bmc_api/models/ssh_key_update.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # SSH key modification model. - class SshKeyUpdate + class SshKeyUpdate < ApiModelBase # Keys marked as default are always included on server creation and reset unless toggled off in creation/reset request. attr_accessor :default @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::SshKeyUpdate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::SshKeyUpdate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -95,7 +101,7 @@ def list_invalid_properties end if @name.to_s.length < 1 - invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end pattern = Regexp.new(/^(?!\s*$).+/) @@ -118,6 +124,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] default Value to be assigned + def default=(default) + if default.nil? + fail ArgumentError, 'default cannot be nil' + end + + @default = default + end + # Custom attribute writer method with validation # @param [Object] name Value to be assigned def name=(name) @@ -130,7 +146,7 @@ def name=(name) end if name.to_s.length < 1 - fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.' end pattern = Regexp.new(/^(?!\s*$).+/) @@ -185,61 +201,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -256,24 +217,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/storage_configuration.rb b/BmcApi/lib/pnap_bmc_api/models/storage_configuration.rb index bf74f2db..9d653c35 100644 --- a/BmcApi/lib/pnap_bmc_api/models/storage_configuration.rb +++ b/BmcApi/lib/pnap_bmc_api/models/storage_configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Storage configuration. - class StorageConfiguration + class StorageConfiguration < ApiModelBase attr_accessor :root_partition # Attribute mapping from ruby-style variable name to JSON key. @@ -25,9 +25,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::StorageConfiguration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::StorageConfiguration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -121,61 +127,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -192,24 +143,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/storage_configuration_root_partition.rb b/BmcApi/lib/pnap_bmc_api/models/storage_configuration_root_partition.rb index cc7a5272..bf3fe7c0 100644 --- a/BmcApi/lib/pnap_bmc_api/models/storage_configuration_root_partition.rb +++ b/BmcApi/lib/pnap_bmc_api/models/storage_configuration_root_partition.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Root partition configuration. - class StorageConfigurationRootPartition + class StorageConfigurationRootPartition < ApiModelBase # Software RAID configuration. The following RAID options are available: NO_RAID, RAID_0, RAID_1. attr_accessor :raid @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::StorageConfigurationRootPartition`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::StorageConfigurationRootPartition`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -136,61 +142,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -207,24 +158,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/tag_assignment.rb b/BmcApi/lib/pnap_bmc_api/models/tag_assignment.rb index 65974a8c..19c23855 100644 --- a/BmcApi/lib/pnap_bmc_api/models/tag_assignment.rb +++ b/BmcApi/lib/pnap_bmc_api/models/tag_assignment.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Tag assigned to resource. - class TagAssignment + class TagAssignment < ApiModelBase # The unique id of the tag. attr_accessor :id @@ -64,9 +64,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -94,9 +99,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::TagAssignment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::TagAssignment`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -160,6 +166,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + + # Custom attribute writer method with validation + # @param [Object] is_billing_tag Value to be assigned + def is_billing_tag=(is_billing_tag) + if is_billing_tag.nil? + fail ArgumentError, 'is_billing_tag cannot be nil' + end + + @is_billing_tag = is_billing_tag + end + # Custom attribute writer method checking allowed values (enum). # @param [Object] created_by Object to be assigned def created_by=(created_by) @@ -217,61 +253,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -288,24 +269,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/models/tag_assignment_request.rb b/BmcApi/lib/pnap_bmc_api/models/tag_assignment_request.rb index 50c161ec..f22a9e93 100644 --- a/BmcApi/lib/pnap_bmc_api/models/tag_assignment_request.rb +++ b/BmcApi/lib/pnap_bmc_api/models/tag_assignment_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module BmcApi # Tag request to assign to resource. - class TagAssignmentRequest + class TagAssignmentRequest < ApiModelBase # The name of the tag. Tag names are case-sensitive, and should be composed of a maximum of 100 characters including UTF-8 Unicode letters, numbers, and the following symbols: '-', '_'. Regex: [A-zÀ-ú0-9_-]{1,100}. attr_accessor :name @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `BmcApi::TagAssignmentRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `BmcApi::TagAssignmentRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -95,6 +101,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -139,61 +155,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = BmcApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -210,24 +171,6 @@ def to_hash 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/BmcApi/lib/pnap_bmc_api/version.rb b/BmcApi/lib/pnap_bmc_api/version.rb index 773c7387..b0ce4bc7 100644 --- a/BmcApi/lib/pnap_bmc_api/version.rb +++ b/BmcApi/lib/pnap_bmc_api/version.rb @@ -6,8 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 - +Generator version: 7.20.0 =end def get_version() diff --git a/BmcApi/pnap_bmc_api.gemspec b/BmcApi/pnap_bmc_api.gemspec index e5490346..b14c61af 100644 --- a/BmcApi/pnap_bmc_api.gemspec +++ b/BmcApi/pnap_bmc_api.gemspec @@ -8,7 +8,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -19,14 +19,14 @@ Gem::Specification.new do |s| s.name = "pnap_bmc_api" s.version = BmcApi::VERSION s.platform = Gem::Platform::RUBY - s.authors = ["PhoenixNAP"] + s.authors = ["OpenAPI-Generator"] s.email = ["support@phoenixnap.com"] - s.homepage = "https://phoenixnap.com/bare-metal-cloud" + s.homepage = "https://openapi-generator.tech" s.summary = "Bare Metal Cloud API Ruby Gem" - s.description = "Bare Metal Cloud API Ruby Gem" + s.description = "Create, power off, power on, reset, reboot, or shut down your server with the Bare Metal Cloud API. Deprovision servers, get or edit SSH key details, assign public IPs, assign servers to networks and a lot more. Manage your infrastructure more efficiently using just a few simple API calls.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/bmc/v1/) " s.license = "MPL-2.0" s.required_ruby_version = ">= 2.7" - s.metadata = { "source_code_uri" => "https://github.com/phoenixnap/ruby-sdk-bmc" } + s.metadata = {} s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' @@ -36,4 +36,4 @@ Gem::Specification.new do |s| s.test_files = `find spec/*`.split("\n") s.executables = [] s.require_paths = ["lib"] -end +end \ No newline at end of file diff --git a/BmcApi/spec/api/quotas_api_spec.rb b/BmcApi/spec/api/quotas_api_spec.rb index 1407738c..73199bd1 100644 --- a/BmcApi/spec/api/quotas_api_spec.rb +++ b/BmcApi/spec/api/quotas_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BmcApi/spec/api/servers_api_spec.rb b/BmcApi/spec/api/servers_api_spec.rb index 64bc23c0..f33a1d42 100644 --- a/BmcApi/spec/api/servers_api_spec.rb +++ b/BmcApi/spec/api/servers_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -171,6 +171,19 @@ end end + # unit tests for servers_server_id_actions_transfer_reservation + # Transfer server reservation. + # Transfer server reservation. An active (READY) reservation can be transferred from a server in ERROR or RESERVED status to another HOURLY provisioned server of the same location and type. + # @param server_id The server's ID. + # @param reservation_transfer_details + # @param [Hash] opts the optional parameters + # @return [Server] + describe 'servers_server_id_actions_transfer_reservation test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + # unit tests for servers_server_id_delete # Delete server. # Deprovision specific server. Any IP blocks assigned to this server will also be relinquished and deleted. Deprecated: see /servers/{serverId}/actions/deprovision diff --git a/BmcApi/spec/api/ssh_keys_api_spec.rb b/BmcApi/spec/api/ssh_keys_api_spec.rb index 4ef24f34..a8b4a24f 100644 --- a/BmcApi/spec/api/ssh_keys_api_spec.rb +++ b/BmcApi/spec/api/ssh_keys_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/BmcApi/spec/models/action_result_spec.rb b/BmcApi/spec/models/action_result_spec.rb index c85adefa..7e8f4874 100644 --- a/BmcApi/spec/models/action_result_spec.rb +++ b/BmcApi/spec/models/action_result_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::ActionResult do - let(:instance) { BmcApi::ActionResult.new } + #let(:instance) { BmcApi::ActionResult.new } describe 'test an instance of ActionResult' do it 'should create an instance of ActionResult' do diff --git a/BmcApi/spec/models/delete_result_spec.rb b/BmcApi/spec/models/delete_result_spec.rb index 1b230e9f..7abdcffe 100644 --- a/BmcApi/spec/models/delete_result_spec.rb +++ b/BmcApi/spec/models/delete_result_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::DeleteResult do - let(:instance) { BmcApi::DeleteResult.new } + #let(:instance) { BmcApi::DeleteResult.new } describe 'test an instance of DeleteResult' do it 'should create an instance of DeleteResult' do diff --git a/BmcApi/spec/models/delete_ssh_key_result_spec.rb b/BmcApi/spec/models/delete_ssh_key_result_spec.rb index 7ce153ae..1c30f94a 100644 --- a/BmcApi/spec/models/delete_ssh_key_result_spec.rb +++ b/BmcApi/spec/models/delete_ssh_key_result_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::DeleteSshKeyResult do - let(:instance) { BmcApi::DeleteSshKeyResult.new } + #let(:instance) { BmcApi::DeleteSshKeyResult.new } describe 'test an instance of DeleteSshKeyResult' do it 'should create an instance of DeleteSshKeyResult' do diff --git a/BmcApi/spec/models/error_spec.rb b/BmcApi/spec/models/error_spec.rb index fa25b8e3..e78450c9 100644 --- a/BmcApi/spec/models/error_spec.rb +++ b/BmcApi/spec/models/error_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::Error do - let(:instance) { BmcApi::Error.new } + #let(:instance) { BmcApi::Error.new } describe 'test an instance of Error' do it 'should create an instance of Error' do diff --git a/BmcApi/spec/models/esxi_datastore_configuration_spec.rb b/BmcApi/spec/models/esxi_datastore_configuration_spec.rb index 6ed52c0d..2c0a6225 100644 --- a/BmcApi/spec/models/esxi_datastore_configuration_spec.rb +++ b/BmcApi/spec/models/esxi_datastore_configuration_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::EsxiDatastoreConfiguration do - let(:instance) { BmcApi::EsxiDatastoreConfiguration.new } + #let(:instance) { BmcApi::EsxiDatastoreConfiguration.new } describe 'test an instance of EsxiDatastoreConfiguration' do it 'should create an instance of EsxiDatastoreConfiguration' do diff --git a/BmcApi/spec/models/esxi_os_configuration_spec.rb b/BmcApi/spec/models/esxi_os_configuration_spec.rb index 6b326add..94ae5c36 100644 --- a/BmcApi/spec/models/esxi_os_configuration_spec.rb +++ b/BmcApi/spec/models/esxi_os_configuration_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::EsxiOsConfiguration do - let(:instance) { BmcApi::EsxiOsConfiguration.new } + #let(:instance) { BmcApi::EsxiOsConfiguration.new } describe 'test an instance of EsxiOsConfiguration' do it 'should create an instance of EsxiOsConfiguration' do diff --git a/BmcApi/spec/models/gpu_configuration_spec.rb b/BmcApi/spec/models/gpu_configuration_spec.rb index 1354e553..7ccf5777 100644 --- a/BmcApi/spec/models/gpu_configuration_spec.rb +++ b/BmcApi/spec/models/gpu_configuration_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::GpuConfiguration do - let(:instance) { BmcApi::GpuConfiguration.new } + #let(:instance) { BmcApi::GpuConfiguration.new } describe 'test an instance of GpuConfiguration' do it 'should create an instance of GpuConfiguration' do diff --git a/BmcApi/spec/models/ip_blocks_configuration_spec.rb b/BmcApi/spec/models/ip_blocks_configuration_spec.rb index 0763929a..ca9fa668 100644 --- a/BmcApi/spec/models/ip_blocks_configuration_spec.rb +++ b/BmcApi/spec/models/ip_blocks_configuration_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::IpBlocksConfiguration do - let(:instance) { BmcApi::IpBlocksConfiguration.new } + #let(:instance) { BmcApi::IpBlocksConfiguration.new } describe 'test an instance of IpBlocksConfiguration' do it 'should create an instance of IpBlocksConfiguration' do diff --git a/BmcApi/spec/models/network_configuration_spec.rb b/BmcApi/spec/models/network_configuration_spec.rb index 8da39842..d74b6d05 100644 --- a/BmcApi/spec/models/network_configuration_spec.rb +++ b/BmcApi/spec/models/network_configuration_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::NetworkConfiguration do - let(:instance) { BmcApi::NetworkConfiguration.new } + #let(:instance) { BmcApi::NetworkConfiguration.new } describe 'test an instance of NetworkConfiguration' do it 'should create an instance of NetworkConfiguration' do diff --git a/BmcApi/spec/models/os_configuration_cloud_init_spec.rb b/BmcApi/spec/models/os_configuration_cloud_init_spec.rb index 94777153..3884e851 100644 --- a/BmcApi/spec/models/os_configuration_cloud_init_spec.rb +++ b/BmcApi/spec/models/os_configuration_cloud_init_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::OsConfigurationCloudInit do - let(:instance) { BmcApi::OsConfigurationCloudInit.new } + #let(:instance) { BmcApi::OsConfigurationCloudInit.new } describe 'test an instance of OsConfigurationCloudInit' do it 'should create an instance of OsConfigurationCloudInit' do diff --git a/BmcApi/spec/models/os_configuration_map_esxi_spec.rb b/BmcApi/spec/models/os_configuration_map_esxi_spec.rb index 477d0241..b56b9dce 100644 --- a/BmcApi/spec/models/os_configuration_map_esxi_spec.rb +++ b/BmcApi/spec/models/os_configuration_map_esxi_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::OsConfigurationMapEsxi do - let(:instance) { BmcApi::OsConfigurationMapEsxi.new } + #let(:instance) { BmcApi::OsConfigurationMapEsxi.new } describe 'test an instance of OsConfigurationMapEsxi' do it 'should create an instance of OsConfigurationMapEsxi' do diff --git a/BmcApi/spec/models/os_configuration_map_proxmox_spec.rb b/BmcApi/spec/models/os_configuration_map_proxmox_spec.rb index 6aba7e55..cbc68eb0 100644 --- a/BmcApi/spec/models/os_configuration_map_proxmox_spec.rb +++ b/BmcApi/spec/models/os_configuration_map_proxmox_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::OsConfigurationMapProxmox do - let(:instance) { BmcApi::OsConfigurationMapProxmox.new } + #let(:instance) { BmcApi::OsConfigurationMapProxmox.new } describe 'test an instance of OsConfigurationMapProxmox' do it 'should create an instance of OsConfigurationMapProxmox' do diff --git a/BmcApi/spec/models/os_configuration_map_spec.rb b/BmcApi/spec/models/os_configuration_map_spec.rb index f9d075c0..cc422011 100644 --- a/BmcApi/spec/models/os_configuration_map_spec.rb +++ b/BmcApi/spec/models/os_configuration_map_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::OsConfigurationMap do - let(:instance) { BmcApi::OsConfigurationMap.new } + #let(:instance) { BmcApi::OsConfigurationMap.new } describe 'test an instance of OsConfigurationMap' do it 'should create an instance of OsConfigurationMap' do diff --git a/BmcApi/spec/models/os_configuration_netris_controller_spec.rb b/BmcApi/spec/models/os_configuration_netris_controller_spec.rb index 2c1a53b6..a325cdbb 100644 --- a/BmcApi/spec/models/os_configuration_netris_controller_spec.rb +++ b/BmcApi/spec/models/os_configuration_netris_controller_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::OsConfigurationNetrisController do - let(:instance) { BmcApi::OsConfigurationNetrisController.new } + #let(:instance) { BmcApi::OsConfigurationNetrisController.new } describe 'test an instance of OsConfigurationNetrisController' do it 'should create an instance of OsConfigurationNetrisController' do diff --git a/BmcApi/spec/models/os_configuration_netris_softgate_spec.rb b/BmcApi/spec/models/os_configuration_netris_softgate_spec.rb index cbaa0f4d..f5dfb84a 100644 --- a/BmcApi/spec/models/os_configuration_netris_softgate_spec.rb +++ b/BmcApi/spec/models/os_configuration_netris_softgate_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::OsConfigurationNetrisSoftgate do - let(:instance) { BmcApi::OsConfigurationNetrisSoftgate.new } + #let(:instance) { BmcApi::OsConfigurationNetrisSoftgate.new } describe 'test an instance of OsConfigurationNetrisSoftgate' do it 'should create an instance of OsConfigurationNetrisSoftgate' do diff --git a/BmcApi/spec/models/os_configuration_spec.rb b/BmcApi/spec/models/os_configuration_spec.rb index 7de68da3..3da17d8b 100644 --- a/BmcApi/spec/models/os_configuration_spec.rb +++ b/BmcApi/spec/models/os_configuration_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::OsConfiguration do - let(:instance) { BmcApi::OsConfiguration.new } + #let(:instance) { BmcApi::OsConfiguration.new } describe 'test an instance of OsConfiguration' do it 'should create an instance of OsConfiguration' do diff --git a/BmcApi/spec/models/os_configuration_windows_spec.rb b/BmcApi/spec/models/os_configuration_windows_spec.rb index 9fd70ffd..b6a50332 100644 --- a/BmcApi/spec/models/os_configuration_windows_spec.rb +++ b/BmcApi/spec/models/os_configuration_windows_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::OsConfigurationWindows do - let(:instance) { BmcApi::OsConfigurationWindows.new } + #let(:instance) { BmcApi::OsConfigurationWindows.new } describe 'test an instance of OsConfigurationWindows' do it 'should create an instance of OsConfigurationWindows' do @@ -33,4 +33,10 @@ end end + describe 'test attribute "bring_your_own_license"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + end diff --git a/BmcApi/spec/models/private_network_configuration_spec.rb b/BmcApi/spec/models/private_network_configuration_spec.rb index d4e4510f..2128c0a7 100644 --- a/BmcApi/spec/models/private_network_configuration_spec.rb +++ b/BmcApi/spec/models/private_network_configuration_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::PrivateNetworkConfiguration do - let(:instance) { BmcApi::PrivateNetworkConfiguration.new } + #let(:instance) { BmcApi::PrivateNetworkConfiguration.new } describe 'test an instance of PrivateNetworkConfiguration' do it 'should create an instance of PrivateNetworkConfiguration' do diff --git a/BmcApi/spec/models/public_network_configuration_spec.rb b/BmcApi/spec/models/public_network_configuration_spec.rb index 925694c9..bb2dcaa2 100644 --- a/BmcApi/spec/models/public_network_configuration_spec.rb +++ b/BmcApi/spec/models/public_network_configuration_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::PublicNetworkConfiguration do - let(:instance) { BmcApi::PublicNetworkConfiguration.new } + #let(:instance) { BmcApi::PublicNetworkConfiguration.new } describe 'test an instance of PublicNetworkConfiguration' do it 'should create an instance of PublicNetworkConfiguration' do diff --git a/BmcApi/spec/models/quota_edit_limit_request_details_spec.rb b/BmcApi/spec/models/quota_edit_limit_request_details_spec.rb index 954ea3d0..e131678a 100644 --- a/BmcApi/spec/models/quota_edit_limit_request_details_spec.rb +++ b/BmcApi/spec/models/quota_edit_limit_request_details_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::QuotaEditLimitRequestDetails do - let(:instance) { BmcApi::QuotaEditLimitRequestDetails.new } + #let(:instance) { BmcApi::QuotaEditLimitRequestDetails.new } describe 'test an instance of QuotaEditLimitRequestDetails' do it 'should create an instance of QuotaEditLimitRequestDetails' do diff --git a/BmcApi/spec/models/quota_edit_limit_request_spec.rb b/BmcApi/spec/models/quota_edit_limit_request_spec.rb index 38a2a910..c70bdc31 100644 --- a/BmcApi/spec/models/quota_edit_limit_request_spec.rb +++ b/BmcApi/spec/models/quota_edit_limit_request_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::QuotaEditLimitRequest do - let(:instance) { BmcApi::QuotaEditLimitRequest.new } + #let(:instance) { BmcApi::QuotaEditLimitRequest.new } describe 'test an instance of QuotaEditLimitRequest' do it 'should create an instance of QuotaEditLimitRequest' do diff --git a/BmcApi/spec/models/quota_spec.rb b/BmcApi/spec/models/quota_spec.rb index 7312f420..b878865e 100644 --- a/BmcApi/spec/models/quota_spec.rb +++ b/BmcApi/spec/models/quota_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::Quota do - let(:instance) { BmcApi::Quota.new } + #let(:instance) { BmcApi::Quota.new } describe 'test an instance of Quota' do it 'should create an instance of Quota' do diff --git a/BmcApi/spec/models/relinquish_ip_block_spec.rb b/BmcApi/spec/models/relinquish_ip_block_spec.rb index 236e91c8..c4e5eee2 100644 --- a/BmcApi/spec/models/relinquish_ip_block_spec.rb +++ b/BmcApi/spec/models/relinquish_ip_block_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::RelinquishIpBlock do - let(:instance) { BmcApi::RelinquishIpBlock.new } + #let(:instance) { BmcApi::RelinquishIpBlock.new } describe 'test an instance of RelinquishIpBlock' do it 'should create an instance of RelinquishIpBlock' do diff --git a/BmcApi/spec/models/reservation_transfer_details_spec.rb b/BmcApi/spec/models/reservation_transfer_details_spec.rb new file mode 100644 index 00000000..156ea199 --- /dev/null +++ b/BmcApi/spec/models/reservation_transfer_details_spec.rb @@ -0,0 +1,36 @@ +=begin +#Bare Metal Cloud API + +#Create, power off, power on, reset, reboot, or shut down your server with the Bare Metal Cloud API. Deprovision servers, get or edit SSH key details, assign public IPs, assign servers to networks and a lot more. Manage your infrastructure more efficiently using just a few simple API calls.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/bmc/v1/) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for BmcApi::ReservationTransferDetails +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe BmcApi::ReservationTransferDetails do + #let(:instance) { BmcApi::ReservationTransferDetails.new } + + describe 'test an instance of ReservationTransferDetails' do + it 'should create an instance of ReservationTransferDetails' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(BmcApi::ReservationTransferDetails) + end + end + + describe 'test attribute "target_server_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/BmcApi/spec/models/reset_result_spec.rb b/BmcApi/spec/models/reset_result_spec.rb index 4becacf0..368e4aea 100644 --- a/BmcApi/spec/models/reset_result_spec.rb +++ b/BmcApi/spec/models/reset_result_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::ResetResult do - let(:instance) { BmcApi::ResetResult.new } + #let(:instance) { BmcApi::ResetResult.new } describe 'test an instance of ResetResult' do it 'should create an instance of ResetResult' do diff --git a/BmcApi/spec/models/server_create_spec.rb b/BmcApi/spec/models/server_create_spec.rb index a5aa86ed..b616fe3e 100644 --- a/BmcApi/spec/models/server_create_spec.rb +++ b/BmcApi/spec/models/server_create_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::ServerCreate do - let(:instance) { BmcApi::ServerCreate.new } + #let(:instance) { BmcApi::ServerCreate.new } describe 'test an instance of ServerCreate' do it 'should create an instance of ServerCreate' do diff --git a/BmcApi/spec/models/server_ip_block_spec.rb b/BmcApi/spec/models/server_ip_block_spec.rb index 719cc580..0424fbe7 100644 --- a/BmcApi/spec/models/server_ip_block_spec.rb +++ b/BmcApi/spec/models/server_ip_block_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::ServerIpBlock do - let(:instance) { BmcApi::ServerIpBlock.new } + #let(:instance) { BmcApi::ServerIpBlock.new } describe 'test an instance of ServerIpBlock' do it 'should create an instance of ServerIpBlock' do diff --git a/BmcApi/spec/models/server_network_update_spec.rb b/BmcApi/spec/models/server_network_update_spec.rb index c3a88960..39b38aed 100644 --- a/BmcApi/spec/models/server_network_update_spec.rb +++ b/BmcApi/spec/models/server_network_update_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::ServerNetworkUpdate do - let(:instance) { BmcApi::ServerNetworkUpdate.new } + #let(:instance) { BmcApi::ServerNetworkUpdate.new } describe 'test an instance of ServerNetworkUpdate' do it 'should create an instance of ServerNetworkUpdate' do diff --git a/BmcApi/spec/models/server_patch_spec.rb b/BmcApi/spec/models/server_patch_spec.rb index 4e79dd8b..cb08d0c9 100644 --- a/BmcApi/spec/models/server_patch_spec.rb +++ b/BmcApi/spec/models/server_patch_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::ServerPatch do - let(:instance) { BmcApi::ServerPatch.new } + #let(:instance) { BmcApi::ServerPatch.new } describe 'test an instance of ServerPatch' do it 'should create an instance of ServerPatch' do diff --git a/BmcApi/spec/models/server_private_network_spec.rb b/BmcApi/spec/models/server_private_network_spec.rb index 47ab8ba2..9a87cd6c 100644 --- a/BmcApi/spec/models/server_private_network_spec.rb +++ b/BmcApi/spec/models/server_private_network_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::ServerPrivateNetwork do - let(:instance) { BmcApi::ServerPrivateNetwork.new } + #let(:instance) { BmcApi::ServerPrivateNetwork.new } describe 'test an instance of ServerPrivateNetwork' do it 'should create an instance of ServerPrivateNetwork' do @@ -51,4 +51,10 @@ end end + describe 'test attribute "vlan_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + end diff --git a/BmcApi/spec/models/server_provision_spec.rb b/BmcApi/spec/models/server_provision_spec.rb index 4ee62871..f3fadf70 100644 --- a/BmcApi/spec/models/server_provision_spec.rb +++ b/BmcApi/spec/models/server_provision_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::ServerProvision do - let(:instance) { BmcApi::ServerProvision.new } + #let(:instance) { BmcApi::ServerProvision.new } describe 'test an instance of ServerProvision' do it 'should create an instance of ServerProvision' do diff --git a/BmcApi/spec/models/server_public_network_spec.rb b/BmcApi/spec/models/server_public_network_spec.rb index c4b4fe51..5f548be0 100644 --- a/BmcApi/spec/models/server_public_network_spec.rb +++ b/BmcApi/spec/models/server_public_network_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::ServerPublicNetwork do - let(:instance) { BmcApi::ServerPublicNetwork.new } + #let(:instance) { BmcApi::ServerPublicNetwork.new } describe 'test an instance of ServerPublicNetwork' do it 'should create an instance of ServerPublicNetwork' do @@ -51,4 +51,10 @@ end end + describe 'test attribute "vlan_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + end diff --git a/BmcApi/spec/models/server_reserve_spec.rb b/BmcApi/spec/models/server_reserve_spec.rb index 93c670cf..8093da42 100644 --- a/BmcApi/spec/models/server_reserve_spec.rb +++ b/BmcApi/spec/models/server_reserve_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::ServerReserve do - let(:instance) { BmcApi::ServerReserve.new } + #let(:instance) { BmcApi::ServerReserve.new } describe 'test an instance of ServerReserve' do it 'should create an instance of ServerReserve' do diff --git a/BmcApi/spec/models/server_reset_spec.rb b/BmcApi/spec/models/server_reset_spec.rb index 5cc8d097..675d9cce 100644 --- a/BmcApi/spec/models/server_reset_spec.rb +++ b/BmcApi/spec/models/server_reset_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::ServerReset do - let(:instance) { BmcApi::ServerReset.new } + #let(:instance) { BmcApi::ServerReset.new } describe 'test an instance of ServerReset' do it 'should create an instance of ServerReset' do diff --git a/BmcApi/spec/models/server_spec.rb b/BmcApi/spec/models/server_spec.rb index b9f70c36..8696926e 100644 --- a/BmcApi/spec/models/server_spec.rb +++ b/BmcApi/spec/models/server_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::Server do - let(:instance) { BmcApi::Server.new } + #let(:instance) { BmcApi::Server.new } describe 'test an instance of Server' do it 'should create an instance of Server' do diff --git a/BmcApi/spec/models/ssh_key_create_spec.rb b/BmcApi/spec/models/ssh_key_create_spec.rb index e70f2880..2bfa8a40 100644 --- a/BmcApi/spec/models/ssh_key_create_spec.rb +++ b/BmcApi/spec/models/ssh_key_create_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::SshKeyCreate do - let(:instance) { BmcApi::SshKeyCreate.new } + #let(:instance) { BmcApi::SshKeyCreate.new } describe 'test an instance of SshKeyCreate' do it 'should create an instance of SshKeyCreate' do diff --git a/BmcApi/spec/models/ssh_key_spec.rb b/BmcApi/spec/models/ssh_key_spec.rb index 476a29ba..6b0cb03b 100644 --- a/BmcApi/spec/models/ssh_key_spec.rb +++ b/BmcApi/spec/models/ssh_key_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::SshKey do - let(:instance) { BmcApi::SshKey.new } + #let(:instance) { BmcApi::SshKey.new } describe 'test an instance of SshKey' do it 'should create an instance of SshKey' do diff --git a/BmcApi/spec/models/ssh_key_update_spec.rb b/BmcApi/spec/models/ssh_key_update_spec.rb index 7a1ca59c..9af877e3 100644 --- a/BmcApi/spec/models/ssh_key_update_spec.rb +++ b/BmcApi/spec/models/ssh_key_update_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::SshKeyUpdate do - let(:instance) { BmcApi::SshKeyUpdate.new } + #let(:instance) { BmcApi::SshKeyUpdate.new } describe 'test an instance of SshKeyUpdate' do it 'should create an instance of SshKeyUpdate' do diff --git a/BmcApi/spec/models/storage_configuration_root_partition_spec.rb b/BmcApi/spec/models/storage_configuration_root_partition_spec.rb index b233fa01..8046546e 100644 --- a/BmcApi/spec/models/storage_configuration_root_partition_spec.rb +++ b/BmcApi/spec/models/storage_configuration_root_partition_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::StorageConfigurationRootPartition do - let(:instance) { BmcApi::StorageConfigurationRootPartition.new } + #let(:instance) { BmcApi::StorageConfigurationRootPartition.new } describe 'test an instance of StorageConfigurationRootPartition' do it 'should create an instance of StorageConfigurationRootPartition' do diff --git a/BmcApi/spec/models/storage_configuration_spec.rb b/BmcApi/spec/models/storage_configuration_spec.rb index db11ead6..4f578ab2 100644 --- a/BmcApi/spec/models/storage_configuration_spec.rb +++ b/BmcApi/spec/models/storage_configuration_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::StorageConfiguration do - let(:instance) { BmcApi::StorageConfiguration.new } + #let(:instance) { BmcApi::StorageConfiguration.new } describe 'test an instance of StorageConfiguration' do it 'should create an instance of StorageConfiguration' do diff --git a/BmcApi/spec/models/tag_assignment_request_spec.rb b/BmcApi/spec/models/tag_assignment_request_spec.rb index eff35c2a..ede5c0ce 100644 --- a/BmcApi/spec/models/tag_assignment_request_spec.rb +++ b/BmcApi/spec/models/tag_assignment_request_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::TagAssignmentRequest do - let(:instance) { BmcApi::TagAssignmentRequest.new } + #let(:instance) { BmcApi::TagAssignmentRequest.new } describe 'test an instance of TagAssignmentRequest' do it 'should create an instance of TagAssignmentRequest' do diff --git a/BmcApi/spec/models/tag_assignment_spec.rb b/BmcApi/spec/models/tag_assignment_spec.rb index 499fb9d9..6586ecf0 100644 --- a/BmcApi/spec/models/tag_assignment_spec.rb +++ b/BmcApi/spec/models/tag_assignment_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe BmcApi::TagAssignment do - let(:instance) { BmcApi::TagAssignment.new } + #let(:instance) { BmcApi::TagAssignment.new } describe 'test an instance of TagAssignment' do it 'should create an instance of TagAssignment' do diff --git a/BmcApi/spec/spec_helper.rb b/BmcApi/spec/spec_helper.rb index d10fc344..888f4e32 100644 --- a/BmcApi/spec/spec_helper.rb +++ b/BmcApi/spec/spec_helper.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/InvoicingApi/VERSION b/InvoicingApi/VERSION index a6a3a43c..90a27f9c 100644 --- a/InvoicingApi/VERSION +++ b/InvoicingApi/VERSION @@ -1 +1 @@ -1.0.4 \ No newline at end of file +1.0.5 diff --git a/InvoicingApi/lib/pnap_invoicing_api.rb b/InvoicingApi/lib/pnap_invoicing_api.rb index ecc96f95..cc954f55 100644 --- a/InvoicingApi/lib/pnap_invoicing_api.rb +++ b/InvoicingApi/lib/pnap_invoicing_api.rb @@ -6,13 +6,14 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end # Common files require 'pnap_invoicing_api/api_client' require 'pnap_invoicing_api/api_error' +require 'pnap_invoicing_api/api_model_base' require 'pnap_invoicing_api/version' require 'pnap_invoicing_api/configuration' diff --git a/InvoicingApi/lib/pnap_invoicing_api/api/invoices_api.rb b/InvoicingApi/lib/pnap_invoicing_api/api/invoices_api.rb index 403dfabd..4d250861 100644 --- a/InvoicingApi/lib/pnap_invoicing_api/api/invoices_api.rb +++ b/InvoicingApi/lib/pnap_invoicing_api/api/invoices_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -93,7 +93,7 @@ def invoices_get_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -156,7 +156,7 @@ def invoices_invoice_id_generate_pdf_post_with_http_info(invoice_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/pdf', 'application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/pdf', 'application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -219,7 +219,7 @@ def invoices_invoice_id_get_with_http_info(invoice_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -284,7 +284,7 @@ def invoices_invoice_id_pay_post_with_http_info(invoice_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? diff --git a/InvoicingApi/lib/pnap_invoicing_api/api_client.rb b/InvoicingApi/lib/pnap_invoicing_api/api_client.rb index 8aea36b6..bfc07403 100644 --- a/InvoicingApi/lib/pnap_invoicing_api/api_client.rb +++ b/InvoicingApi/lib/pnap_invoicing_api/api_client.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -52,7 +52,8 @@ def self.default # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers. def call_api(http_method, path, opts = {}) request = build_request(http_method, path, opts) - tempfile = download_file(request) if opts[:return_type] == 'File' + tempfile = nil + (download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File' response = request.run if @config.debugging @@ -191,19 +192,17 @@ def download_file(request) chunk.force_encoding(encoding) tempfile.write(chunk) end - # run the request to ensure the tempfile is created successfully before returning it - request.run - if tempfile + request.on_complete do + if !tempfile + fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + end tempfile.close @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ "will be deleted automatically with GC. It's also recommended to delete the temp file "\ "explicitly with `tempfile.delete`" - else - fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + yield tempfile if block_given? end - - tempfile end # Check if the given MIME is a JSON MIME. @@ -215,7 +214,7 @@ def download_file(request) # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type. @@ -282,9 +281,13 @@ def convert_to_type(data, return_type) data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else - # models (e.g. Pet) or oneOf + # models (e.g. Pet) or oneOf/anyOf klass = InvoicingApi.const_get(return_type) - klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of) + klass.build(data) + else + klass.build_from_hash(data) + end end end @@ -294,7 +297,7 @@ def convert_to_type(data, return_type) # @param [String] filename the filename to be sanitized # @return [String] the sanitized filename def sanitize_filename(filename) - filename.gsub(/.*[\/\\]/, '') + filename.split(/[\/\\]/).last end def build_request_url(path, opts = {}) @@ -394,4 +397,4 @@ def build_collection_param(param, collection_format) end end end -end +end \ No newline at end of file diff --git a/InvoicingApi/lib/pnap_invoicing_api/api_error.rb b/InvoicingApi/lib/pnap_invoicing_api/api_error.rb index bf4928cb..2f3bee19 100644 --- a/InvoicingApi/lib/pnap_invoicing_api/api_error.rb +++ b/InvoicingApi/lib/pnap_invoicing_api/api_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/InvoicingApi/lib/pnap_invoicing_api/api_model_base.rb b/InvoicingApi/lib/pnap_invoicing_api/api_model_base.rb new file mode 100644 index 00000000..86024c9a --- /dev/null +++ b/InvoicingApi/lib/pnap_invoicing_api/api_model_base.rb @@ -0,0 +1,88 @@ +=begin +#Invoicing API + +#List, fetch and pay invoices with the Invoicing API. + +The version of the OpenAPI document: 1.0 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +module InvoicingApi + class ApiModelBase + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._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 = InvoicingApi.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 + + # 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/InvoicingApi/lib/pnap_invoicing_api/configuration.rb b/InvoicingApi/lib/pnap_invoicing_api/configuration.rb index d8b74fdb..686c99ce 100644 --- a/InvoicingApi/lib/pnap_invoicing_api/configuration.rb +++ b/InvoicingApi/lib/pnap_invoicing_api/configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -79,6 +79,14 @@ class Configuration # @return [true, false] attr_accessor :debugging + # Set this to ignore operation servers for the API client. This is useful when you need to + # send requests to a different server than the one specified in the OpenAPI document. + # Will default to the base url defined in the spec but can be overridden by setting + # `scheme`, `host`, `base_path` directly. + # Default to false. + # @return [true, false] + attr_accessor :ignore_operation_servers + # Defines the logger used for debugging. # Default to `Rails.logger` (when in Rails) or logging to STDOUT. # @@ -166,6 +174,7 @@ def initialize @timeout = 0 @params_encoding = nil @debugging = false + @ignore_operation_servers = false @inject_format = false @force_ending_format = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) @@ -200,6 +209,7 @@ def base_path=(base_path) # Returns base URL for specified operation based on server settings def base_url(operation = nil) + return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers if operation_server_settings.key?(operation) then index = server_operation_index.fetch(operation, server_index) server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) diff --git a/InvoicingApi/lib/pnap_invoicing_api/models/error.rb b/InvoicingApi/lib/pnap_invoicing_api/models/error.rb index 0c647720..2aeb2f5f 100644 --- a/InvoicingApi/lib/pnap_invoicing_api/models/error.rb +++ b/InvoicingApi/lib/pnap_invoicing_api/models/error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module InvoicingApi - class Error + class Error < ApiModelBase # The description detailing the cause of the error code. attr_accessor :message @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `InvoicingApi::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `InvoicingApi::Error`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -96,6 +102,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] message Value to be assigned + def message=(message) + if message.nil? + fail ArgumentError, 'message cannot be nil' + end + + @message = message + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -140,61 +156,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = InvoicingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -211,24 +172,6 @@ def to_hash 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/InvoicingApi/lib/pnap_invoicing_api/models/invoice.rb b/InvoicingApi/lib/pnap_invoicing_api/models/invoice.rb index df5a0914..3f5fcffb 100644 --- a/InvoicingApi/lib/pnap_invoicing_api/models/invoice.rb +++ b/InvoicingApi/lib/pnap_invoicing_api/models/invoice.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module InvoicingApi - class Invoice + class Invoice < ApiModelBase # The unique resource identifier of the Invoice. attr_accessor :id @@ -53,9 +53,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -86,9 +91,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `InvoicingApi::Invoice`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `InvoicingApi::Invoice`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -197,6 +203,86 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] number Value to be assigned + def number=(number) + if number.nil? + fail ArgumentError, 'number cannot be nil' + end + + @number = number + end + + # Custom attribute writer method with validation + # @param [Object] currency Value to be assigned + def currency=(currency) + if currency.nil? + fail ArgumentError, 'currency cannot be nil' + end + + @currency = currency + end + + # Custom attribute writer method with validation + # @param [Object] amount Value to be assigned + def amount=(amount) + if amount.nil? + fail ArgumentError, 'amount cannot be nil' + end + + @amount = amount + end + + # Custom attribute writer method with validation + # @param [Object] outstanding_amount Value to be assigned + def outstanding_amount=(outstanding_amount) + if outstanding_amount.nil? + fail ArgumentError, 'outstanding_amount cannot be nil' + end + + @outstanding_amount = outstanding_amount + end + + # Custom attribute writer method with validation + # @param [Object] status Value to be assigned + def status=(status) + if status.nil? + fail ArgumentError, 'status cannot be nil' + end + + @status = status + end + + # Custom attribute writer method with validation + # @param [Object] sent_on Value to be assigned + def sent_on=(sent_on) + if sent_on.nil? + fail ArgumentError, 'sent_on cannot be nil' + end + + @sent_on = sent_on + end + + # Custom attribute writer method with validation + # @param [Object] due_date Value to be assigned + def due_date=(due_date) + if due_date.nil? + fail ArgumentError, 'due_date cannot be nil' + end + + @due_date = due_date + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -247,61 +333,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = InvoicingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -318,24 +349,6 @@ def to_hash 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/InvoicingApi/lib/pnap_invoicing_api/models/paginated_invoices.rb b/InvoicingApi/lib/pnap_invoicing_api/models/paginated_invoices.rb index 70c9b352..33d68c16 100644 --- a/InvoicingApi/lib/pnap_invoicing_api/models/paginated_invoices.rb +++ b/InvoicingApi/lib/pnap_invoicing_api/models/paginated_invoices.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module InvoicingApi - class PaginatedInvoices + class PaginatedInvoices < ApiModelBase # Maximum number of items in the page (actual returned length can be less). attr_accessor :limit @@ -36,9 +36,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -72,9 +77,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `InvoicingApi::PaginatedInvoices`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `InvoicingApi::PaginatedInvoices`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -141,6 +147,46 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] limit Value to be assigned + def limit=(limit) + if limit.nil? + fail ArgumentError, 'limit cannot be nil' + end + + @limit = limit + end + + # Custom attribute writer method with validation + # @param [Object] offset Value to be assigned + def offset=(offset) + if offset.nil? + fail ArgumentError, 'offset cannot be nil' + end + + @offset = offset + end + + # Custom attribute writer method with validation + # @param [Object] total Value to be assigned + def total=(total) + if total.nil? + fail ArgumentError, 'total cannot be nil' + end + + @total = total + end + + # Custom attribute writer method with validation + # @param [Object] results Value to be assigned + def results=(results) + if results.nil? + fail ArgumentError, 'results cannot be nil' + end + + @results = results + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -187,61 +233,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = InvoicingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -258,24 +249,6 @@ def to_hash 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/InvoicingApi/lib/pnap_invoicing_api/models/paginated_response.rb b/InvoicingApi/lib/pnap_invoicing_api/models/paginated_response.rb index 521e382d..b4ea207a 100644 --- a/InvoicingApi/lib/pnap_invoicing_api/models/paginated_response.rb +++ b/InvoicingApi/lib/pnap_invoicing_api/models/paginated_response.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module InvoicingApi - class PaginatedResponse + class PaginatedResponse < ApiModelBase # Maximum number of items in the page (actual returned length can be less). attr_accessor :limit @@ -33,9 +33,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -61,9 +66,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `InvoicingApi::PaginatedResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `InvoicingApi::PaginatedResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -117,6 +123,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] limit Value to be assigned + def limit=(limit) + if limit.nil? + fail ArgumentError, 'limit cannot be nil' + end + + @limit = limit + end + + # Custom attribute writer method with validation + # @param [Object] offset Value to be assigned + def offset=(offset) + if offset.nil? + fail ArgumentError, 'offset cannot be nil' + end + + @offset = offset + end + + # Custom attribute writer method with validation + # @param [Object] total Value to be assigned + def total=(total) + if total.nil? + fail ArgumentError, 'total cannot be nil' + end + + @total = total + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -162,61 +198,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = InvoicingApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -233,24 +214,6 @@ def to_hash 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/InvoicingApi/lib/pnap_invoicing_api/version.rb b/InvoicingApi/lib/pnap_invoicing_api/version.rb index 5147d953..7522734f 100644 --- a/InvoicingApi/lib/pnap_invoicing_api/version.rb +++ b/InvoicingApi/lib/pnap_invoicing_api/version.rb @@ -6,8 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 - +Generator version: 7.20.0 =end def get_version() diff --git a/InvoicingApi/pnap_invoicing_api.gemspec b/InvoicingApi/pnap_invoicing_api.gemspec index 3c1a3f61..71dd3efa 100644 --- a/InvoicingApi/pnap_invoicing_api.gemspec +++ b/InvoicingApi/pnap_invoicing_api.gemspec @@ -8,7 +8,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -19,14 +19,14 @@ Gem::Specification.new do |s| s.name = "pnap_invoicing_api" s.version = InvoicingApi::VERSION s.platform = Gem::Platform::RUBY - s.authors = ["PhoenixNAP"] + s.authors = ["OpenAPI-Generator"] s.email = ["support@phoenixnap.com"] - s.homepage = "https://phoenixnap.com/bare-metal-cloud" + s.homepage = "https://openapi-generator.tech" s.summary = "Invoicing API Ruby Gem" - s.description = "Invoicing API Ruby Gem" + s.description = "List, fetch and pay invoices with the Invoicing API. " s.license = "MPL-2.0" s.required_ruby_version = ">= 2.7" - s.metadata = { "source_code_uri" => "https://github.com/phoenixnap/ruby-sdk-bmc" } + s.metadata = {} s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' @@ -36,4 +36,4 @@ Gem::Specification.new do |s| s.test_files = `find spec/*`.split("\n") s.executables = [] s.require_paths = ["lib"] -end +end \ No newline at end of file diff --git a/InvoicingApi/spec/api/invoices_api_spec.rb b/InvoicingApi/spec/api/invoices_api_spec.rb index a337fdbf..d432a97f 100644 --- a/InvoicingApi/spec/api/invoices_api_spec.rb +++ b/InvoicingApi/spec/api/invoices_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/InvoicingApi/spec/models/error_spec.rb b/InvoicingApi/spec/models/error_spec.rb index b53fb3e8..d7a40eeb 100644 --- a/InvoicingApi/spec/models/error_spec.rb +++ b/InvoicingApi/spec/models/error_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe InvoicingApi::Error do - let(:instance) { InvoicingApi::Error.new } + #let(:instance) { InvoicingApi::Error.new } describe 'test an instance of Error' do it 'should create an instance of Error' do diff --git a/InvoicingApi/spec/models/invoice_spec.rb b/InvoicingApi/spec/models/invoice_spec.rb index daa81aa0..ddf9ca99 100644 --- a/InvoicingApi/spec/models/invoice_spec.rb +++ b/InvoicingApi/spec/models/invoice_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe InvoicingApi::Invoice do - let(:instance) { InvoicingApi::Invoice.new } + #let(:instance) { InvoicingApi::Invoice.new } describe 'test an instance of Invoice' do it 'should create an instance of Invoice' do diff --git a/InvoicingApi/spec/models/paginated_invoices_spec.rb b/InvoicingApi/spec/models/paginated_invoices_spec.rb index 46617b8e..aeb077bc 100644 --- a/InvoicingApi/spec/models/paginated_invoices_spec.rb +++ b/InvoicingApi/spec/models/paginated_invoices_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe InvoicingApi::PaginatedInvoices do - let(:instance) { InvoicingApi::PaginatedInvoices.new } + #let(:instance) { InvoicingApi::PaginatedInvoices.new } describe 'test an instance of PaginatedInvoices' do it 'should create an instance of PaginatedInvoices' do diff --git a/InvoicingApi/spec/models/paginated_response_spec.rb b/InvoicingApi/spec/models/paginated_response_spec.rb index 51c348ac..e10fe41a 100644 --- a/InvoicingApi/spec/models/paginated_response_spec.rb +++ b/InvoicingApi/spec/models/paginated_response_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe InvoicingApi::PaginatedResponse do - let(:instance) { InvoicingApi::PaginatedResponse.new } + #let(:instance) { InvoicingApi::PaginatedResponse.new } describe 'test an instance of PaginatedResponse' do it 'should create an instance of PaginatedResponse' do diff --git a/InvoicingApi/spec/spec_helper.rb b/InvoicingApi/spec/spec_helper.rb index 82935494..103e03fc 100644 --- a/InvoicingApi/spec/spec_helper.rb +++ b/InvoicingApi/spec/spec_helper.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/IpApi/VERSION b/IpApi/VERSION index e3a4f193..276cbf9e 100644 --- a/IpApi/VERSION +++ b/IpApi/VERSION @@ -1 +1 @@ -2.2.0 \ No newline at end of file +2.3.0 diff --git a/IpApi/docs/IpBlock.md b/IpApi/docs/IpBlock.md index 7905f0bc..56dc36ab 100644 --- a/IpApi/docs/IpBlock.md +++ b/IpApi/docs/IpBlock.md @@ -5,7 +5,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **id** | **String** | IP Block identifier. | [optional] | -| **location** | **String** | IP Block location ID. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. | [optional] | +| **location** | **String** | IP Block location ID. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. | [optional] | | **cidr_block_size** | **String** | CIDR IP Block Size. Currently this field should be set to either `/31`, `/30`, `/29`, `/28`, `/27`, `/26`, `/25`, `/24`, `/23` or `/22`. | [optional] | | **cidr** | **String** | The IP Block in CIDR notation. | [optional] | | **ip_version** | **String** | The IP Version of the block. | [optional] | diff --git a/IpApi/docs/IpBlockCreate.md b/IpApi/docs/IpBlockCreate.md index 0cd54a54..5ec18bef 100644 --- a/IpApi/docs/IpBlockCreate.md +++ b/IpApi/docs/IpBlockCreate.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **location** | **String** | IP Block location ID. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. | | +| **location** | **String** | IP Block location ID. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. | | | **cidr_block_size** | **String** | CIDR IP Block Size. V4 supported sizes: [`/31`, `/30`, `/29` or `/28`]. V6 supported sizes: [`/64`]. For a larger Block Size contact support. | | | **ip_version** | **String** | IP Version. This field should be set to `V4` or `V6` | [optional][default to 'V4'] | | **description** | **String** | The description of the IP Block. | [optional] | diff --git a/IpApi/lib/pnap_ip_api.rb b/IpApi/lib/pnap_ip_api.rb index 951ee612..ceaf5d2a 100644 --- a/IpApi/lib/pnap_ip_api.rb +++ b/IpApi/lib/pnap_ip_api.rb @@ -6,13 +6,14 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end # Common files require 'pnap_ip_api/api_client' require 'pnap_ip_api/api_error' +require 'pnap_ip_api/api_model_base' require 'pnap_ip_api/version' require 'pnap_ip_api/configuration' diff --git a/IpApi/lib/pnap_ip_api/api/ip_blocks_api.rb b/IpApi/lib/pnap_ip_api/api/ip_blocks_api.rb index 9b4a5f0b..bfa0e4a8 100644 --- a/IpApi/lib/pnap_ip_api/api/ip_blocks_api.rb +++ b/IpApi/lib/pnap_ip_api/api/ip_blocks_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -48,7 +48,7 @@ def ip_blocks_get_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -111,7 +111,7 @@ def ip_blocks_ip_block_id_delete_with_http_info(ip_block_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -174,7 +174,7 @@ def ip_blocks_ip_block_id_get_with_http_info(ip_block_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -243,7 +243,7 @@ def ip_blocks_ip_block_id_patch_with_http_info(ip_block_id, ip_block_patch, opts # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -317,7 +317,7 @@ def ip_blocks_ip_block_id_tags_put_with_http_info(ip_block_id, tag_assignment_re # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -385,7 +385,7 @@ def ip_blocks_post_with_http_info(ip_block_create, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? diff --git a/IpApi/lib/pnap_ip_api/api_client.rb b/IpApi/lib/pnap_ip_api/api_client.rb index 0f268e76..457c5a22 100644 --- a/IpApi/lib/pnap_ip_api/api_client.rb +++ b/IpApi/lib/pnap_ip_api/api_client.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -52,7 +52,8 @@ def self.default # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers. def call_api(http_method, path, opts = {}) request = build_request(http_method, path, opts) - tempfile = download_file(request) if opts[:return_type] == 'File' + tempfile = nil + (download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File' response = request.run if @config.debugging @@ -191,19 +192,17 @@ def download_file(request) chunk.force_encoding(encoding) tempfile.write(chunk) end - # run the request to ensure the tempfile is created successfully before returning it - request.run - if tempfile + request.on_complete do + if !tempfile + fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + end tempfile.close @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ "will be deleted automatically with GC. It's also recommended to delete the temp file "\ "explicitly with `tempfile.delete`" - else - fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + yield tempfile if block_given? end - - tempfile end # Check if the given MIME is a JSON MIME. @@ -215,7 +214,7 @@ def download_file(request) # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type. @@ -282,9 +281,13 @@ def convert_to_type(data, return_type) data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else - # models (e.g. Pet) or oneOf + # models (e.g. Pet) or oneOf/anyOf klass = IpApi.const_get(return_type) - klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of) + klass.build(data) + else + klass.build_from_hash(data) + end end end @@ -294,7 +297,7 @@ def convert_to_type(data, return_type) # @param [String] filename the filename to be sanitized # @return [String] the sanitized filename def sanitize_filename(filename) - filename.gsub(/.*[\/\\]/, '') + filename.split(/[\/\\]/).last end def build_request_url(path, opts = {}) @@ -394,4 +397,4 @@ def build_collection_param(param, collection_format) end end end -end +end \ No newline at end of file diff --git a/IpApi/lib/pnap_ip_api/api_error.rb b/IpApi/lib/pnap_ip_api/api_error.rb index 9dcaf127..22f95e9a 100644 --- a/IpApi/lib/pnap_ip_api/api_error.rb +++ b/IpApi/lib/pnap_ip_api/api_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/IpApi/lib/pnap_ip_api/api_model_base.rb b/IpApi/lib/pnap_ip_api/api_model_base.rb new file mode 100644 index 00000000..19b5474a --- /dev/null +++ b/IpApi/lib/pnap_ip_api/api_model_base.rb @@ -0,0 +1,88 @@ +=begin +#IP Addresses API + +#Public IP blocks are a set of contiguous IPs that allow you to access your servers or networks from the internet. Use the IP Addresses API to request and delete IP blocks.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/ips/v1/) + +The version of the OpenAPI document: 1.0 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +module IpApi + class ApiModelBase + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._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 = IpApi.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 + + # 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/IpApi/lib/pnap_ip_api/configuration.rb b/IpApi/lib/pnap_ip_api/configuration.rb index 03de0364..65a3b0f4 100644 --- a/IpApi/lib/pnap_ip_api/configuration.rb +++ b/IpApi/lib/pnap_ip_api/configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -79,6 +79,14 @@ class Configuration # @return [true, false] attr_accessor :debugging + # Set this to ignore operation servers for the API client. This is useful when you need to + # send requests to a different server than the one specified in the OpenAPI document. + # Will default to the base url defined in the spec but can be overridden by setting + # `scheme`, `host`, `base_path` directly. + # Default to false. + # @return [true, false] + attr_accessor :ignore_operation_servers + # Defines the logger used for debugging. # Default to `Rails.logger` (when in Rails) or logging to STDOUT. # @@ -166,6 +174,7 @@ def initialize @timeout = 0 @params_encoding = nil @debugging = false + @ignore_operation_servers = false @inject_format = false @force_ending_format = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) @@ -200,6 +209,7 @@ def base_path=(base_path) # Returns base URL for specified operation based on server settings def base_url(operation = nil) + return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers if operation_server_settings.key?(operation) then index = server_operation_index.fetch(operation, server_index) server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) diff --git a/IpApi/lib/pnap_ip_api/models/delete_ip_block_result.rb b/IpApi/lib/pnap_ip_api/models/delete_ip_block_result.rb index fee4a90b..e834c926 100644 --- a/IpApi/lib/pnap_ip_api/models/delete_ip_block_result.rb +++ b/IpApi/lib/pnap_ip_api/models/delete_ip_block_result.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module IpApi # Result of a successful delete action. - class DeleteIpBlockResult + class DeleteIpBlockResult < ApiModelBase # IP Block has been deleted. attr_accessor :result @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `IpApi::DeleteIpBlockResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `IpApi::DeleteIpBlockResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -132,61 +138,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = IpApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -203,24 +154,6 @@ def to_hash 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/IpApi/lib/pnap_ip_api/models/error.rb b/IpApi/lib/pnap_ip_api/models/error.rb index 049086d5..060a00fb 100644 --- a/IpApi/lib/pnap_ip_api/models/error.rb +++ b/IpApi/lib/pnap_ip_api/models/error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module IpApi - class Error + class Error < ApiModelBase # The description detailing the cause of the error code. attr_accessor :message @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `IpApi::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `IpApi::Error`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -96,6 +102,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] message Value to be assigned + def message=(message) + if message.nil? + fail ArgumentError, 'message cannot be nil' + end + + @message = message + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -140,61 +156,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = IpApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -211,24 +172,6 @@ def to_hash 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/IpApi/lib/pnap_ip_api/models/ip_block.rb b/IpApi/lib/pnap_ip_api/models/ip_block.rb index b7064014..66dfc051 100644 --- a/IpApi/lib/pnap_ip_api/models/ip_block.rb +++ b/IpApi/lib/pnap_ip_api/models/ip_block.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,11 +15,11 @@ module IpApi # IP Block Details. - class IpBlock + class IpBlock < ApiModelBase # IP Block identifier. attr_accessor :id - # IP Block location ID. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. + # IP Block location ID. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. attr_accessor :location # CIDR IP Block Size. Currently this field should be set to either `/31`, `/30`, `/29`, `/28`, `/27`, `/26`, `/25`, `/24`, `/23` or `/22`. @@ -78,9 +78,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -117,9 +122,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `IpApi::IpBlock`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `IpApi::IpBlock`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -273,61 +279,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = IpApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -344,24 +295,6 @@ def to_hash 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/IpApi/lib/pnap_ip_api/models/ip_block_create.rb b/IpApi/lib/pnap_ip_api/models/ip_block_create.rb index a294287c..a348333d 100644 --- a/IpApi/lib/pnap_ip_api/models/ip_block_create.rb +++ b/IpApi/lib/pnap_ip_api/models/ip_block_create.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,8 +15,8 @@ module IpApi # IP Block Request. - class IpBlockCreate - # IP Block location ID. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. + class IpBlockCreate < ApiModelBase + # IP Block location ID. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. attr_accessor :location # CIDR IP Block Size. V4 supported sizes: [`/31`, `/30`, `/29` or `/28`]. V6 supported sizes: [`/64`]. For a larger Block Size contact support. @@ -42,9 +42,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -72,9 +77,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `IpApi::IpBlockCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `IpApi::IpBlockCreate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -138,6 +144,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + + # Custom attribute writer method with validation + # @param [Object] cidr_block_size Value to be assigned + def cidr_block_size=(cidr_block_size) + if cidr_block_size.nil? + fail ArgumentError, 'cidr_block_size cannot be nil' + end + + @cidr_block_size = cidr_block_size + end + # Custom attribute writer method with validation # @param [Object] description Value to be assigned def description=(description) @@ -199,61 +225,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = IpApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -270,24 +241,6 @@ def to_hash 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/IpApi/lib/pnap_ip_api/models/ip_block_patch.rb b/IpApi/lib/pnap_ip_api/models/ip_block_patch.rb index 0d8767e8..830022e2 100644 --- a/IpApi/lib/pnap_ip_api/models/ip_block_patch.rb +++ b/IpApi/lib/pnap_ip_api/models/ip_block_patch.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module IpApi # IP Block patch. - class IpBlockPatch + class IpBlockPatch < ApiModelBase # The description of the Ip Block. attr_accessor :description @@ -26,9 +26,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `IpApi::IpBlockPatch`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `IpApi::IpBlockPatch`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -141,61 +147,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = IpApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -212,24 +163,6 @@ def to_hash 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/IpApi/lib/pnap_ip_api/models/tag_assignment.rb b/IpApi/lib/pnap_ip_api/models/tag_assignment.rb index 11046d76..dbfeb6e9 100644 --- a/IpApi/lib/pnap_ip_api/models/tag_assignment.rb +++ b/IpApi/lib/pnap_ip_api/models/tag_assignment.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module IpApi # Tag assigned to resource. - class TagAssignment + class TagAssignment < ApiModelBase # The unique id of the tag. attr_accessor :id @@ -64,9 +64,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -94,9 +99,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `IpApi::TagAssignment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `IpApi::TagAssignment`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -160,6 +166,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + + # Custom attribute writer method with validation + # @param [Object] is_billing_tag Value to be assigned + def is_billing_tag=(is_billing_tag) + if is_billing_tag.nil? + fail ArgumentError, 'is_billing_tag cannot be nil' + end + + @is_billing_tag = is_billing_tag + end + # Custom attribute writer method checking allowed values (enum). # @param [Object] created_by Object to be assigned def created_by=(created_by) @@ -217,61 +253,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = IpApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -288,24 +269,6 @@ def to_hash 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/IpApi/lib/pnap_ip_api/models/tag_assignment_request.rb b/IpApi/lib/pnap_ip_api/models/tag_assignment_request.rb index 83329a64..6b6991e5 100644 --- a/IpApi/lib/pnap_ip_api/models/tag_assignment_request.rb +++ b/IpApi/lib/pnap_ip_api/models/tag_assignment_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module IpApi # Tag request to assign to resource. - class TagAssignmentRequest + class TagAssignmentRequest < ApiModelBase # The name of the tag. Tag names are case-sensitive, and should be composed of a maximum of 100 characters including UTF-8 Unicode letters, numbers, and the following symbols: '-', '_'. Regex: [A-zÀ-ú0-9_-]{1,100}. attr_accessor :name @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `IpApi::TagAssignmentRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `IpApi::TagAssignmentRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -95,6 +101,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -139,61 +155,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = IpApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -210,24 +171,6 @@ def to_hash 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/IpApi/lib/pnap_ip_api/version.rb b/IpApi/lib/pnap_ip_api/version.rb index c06614bf..9c81877c 100644 --- a/IpApi/lib/pnap_ip_api/version.rb +++ b/IpApi/lib/pnap_ip_api/version.rb @@ -6,8 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 - +Generator version: 7.20.0 =end def get_version() diff --git a/IpApi/pnap_ip_api.gemspec b/IpApi/pnap_ip_api.gemspec index 4cfaaa13..db479309 100644 --- a/IpApi/pnap_ip_api.gemspec +++ b/IpApi/pnap_ip_api.gemspec @@ -8,7 +8,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -19,14 +19,14 @@ Gem::Specification.new do |s| s.name = "pnap_ip_api" s.version = IpApi::VERSION s.platform = Gem::Platform::RUBY - s.authors = ["PhoenixNAP"] + s.authors = ["OpenAPI-Generator"] s.email = ["support@phoenixnap.com"] - s.homepage = "https://phoenixnap.com/bare-metal-cloud" + s.homepage = "https://openapi-generator.tech" s.summary = "IP Addresses API Ruby Gem" - s.description = "IP Addresses API Ruby Gem" + s.description = "Public IP blocks are a set of contiguous IPs that allow you to access your servers or networks from the internet. Use the IP Addresses API to request and delete IP blocks.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/ips/v1/) " s.license = "MPL-2.0" s.required_ruby_version = ">= 2.7" - s.metadata = { "source_code_uri" => "https://github.com/phoenixnap/ruby-sdk-bmc" } + s.metadata = {} s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' @@ -36,4 +36,4 @@ Gem::Specification.new do |s| s.test_files = `find spec/*`.split("\n") s.executables = [] s.require_paths = ["lib"] -end +end \ No newline at end of file diff --git a/IpApi/spec/api/ip_blocks_api_spec.rb b/IpApi/spec/api/ip_blocks_api_spec.rb index 4ab5517f..5f56c60e 100644 --- a/IpApi/spec/api/ip_blocks_api_spec.rb +++ b/IpApi/spec/api/ip_blocks_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/IpApi/spec/models/delete_ip_block_result_spec.rb b/IpApi/spec/models/delete_ip_block_result_spec.rb index 13be5057..b627e102 100644 --- a/IpApi/spec/models/delete_ip_block_result_spec.rb +++ b/IpApi/spec/models/delete_ip_block_result_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe IpApi::DeleteIpBlockResult do - let(:instance) { IpApi::DeleteIpBlockResult.new } + #let(:instance) { IpApi::DeleteIpBlockResult.new } describe 'test an instance of DeleteIpBlockResult' do it 'should create an instance of DeleteIpBlockResult' do diff --git a/IpApi/spec/models/error_spec.rb b/IpApi/spec/models/error_spec.rb index 655bf63c..4443630f 100644 --- a/IpApi/spec/models/error_spec.rb +++ b/IpApi/spec/models/error_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe IpApi::Error do - let(:instance) { IpApi::Error.new } + #let(:instance) { IpApi::Error.new } describe 'test an instance of Error' do it 'should create an instance of Error' do diff --git a/IpApi/spec/models/ip_block_create_spec.rb b/IpApi/spec/models/ip_block_create_spec.rb index ccbf9223..19513117 100644 --- a/IpApi/spec/models/ip_block_create_spec.rb +++ b/IpApi/spec/models/ip_block_create_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe IpApi::IpBlockCreate do - let(:instance) { IpApi::IpBlockCreate.new } + #let(:instance) { IpApi::IpBlockCreate.new } describe 'test an instance of IpBlockCreate' do it 'should create an instance of IpBlockCreate' do diff --git a/IpApi/spec/models/ip_block_patch_spec.rb b/IpApi/spec/models/ip_block_patch_spec.rb index 21826c7d..7734ee70 100644 --- a/IpApi/spec/models/ip_block_patch_spec.rb +++ b/IpApi/spec/models/ip_block_patch_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe IpApi::IpBlockPatch do - let(:instance) { IpApi::IpBlockPatch.new } + #let(:instance) { IpApi::IpBlockPatch.new } describe 'test an instance of IpBlockPatch' do it 'should create an instance of IpBlockPatch' do diff --git a/IpApi/spec/models/ip_block_spec.rb b/IpApi/spec/models/ip_block_spec.rb index a54d54aa..47e2caae 100644 --- a/IpApi/spec/models/ip_block_spec.rb +++ b/IpApi/spec/models/ip_block_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe IpApi::IpBlock do - let(:instance) { IpApi::IpBlock.new } + #let(:instance) { IpApi::IpBlock.new } describe 'test an instance of IpBlock' do it 'should create an instance of IpBlock' do diff --git a/IpApi/spec/models/tag_assignment_request_spec.rb b/IpApi/spec/models/tag_assignment_request_spec.rb index 9a1dcede..3a4a263a 100644 --- a/IpApi/spec/models/tag_assignment_request_spec.rb +++ b/IpApi/spec/models/tag_assignment_request_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe IpApi::TagAssignmentRequest do - let(:instance) { IpApi::TagAssignmentRequest.new } + #let(:instance) { IpApi::TagAssignmentRequest.new } describe 'test an instance of TagAssignmentRequest' do it 'should create an instance of TagAssignmentRequest' do diff --git a/IpApi/spec/models/tag_assignment_spec.rb b/IpApi/spec/models/tag_assignment_spec.rb index 36466d26..8ce15624 100644 --- a/IpApi/spec/models/tag_assignment_spec.rb +++ b/IpApi/spec/models/tag_assignment_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe IpApi::TagAssignment do - let(:instance) { IpApi::TagAssignment.new } + #let(:instance) { IpApi::TagAssignment.new } describe 'test an instance of TagAssignment' do it 'should create an instance of TagAssignment' do diff --git a/IpApi/spec/spec_helper.rb b/IpApi/spec/spec_helper.rb index 495dfc82..a7af730f 100644 --- a/IpApi/spec/spec_helper.rb +++ b/IpApi/spec/spec_helper.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/LocationApi/README.md b/LocationApi/README.md index 511d322a..4c3a54c2 100644 --- a/LocationApi/README.md +++ b/LocationApi/README.md @@ -63,7 +63,7 @@ require 'pnap_location_api' api_instance = LocationApi::LocationsApi.new opts = { - location: LocationApi::LocationEnum::PHX, # LocationEnum | Location of interest + location: LocationApi::ProductLocationEnum::PHX, # ProductLocationEnum | Location of interest product_category: LocationApi::ProductCategoryEnum::SERVER # ProductCategoryEnum | Product category of interest } @@ -105,9 +105,9 @@ Class | Method | HTTP request | Description - [LocationApi::Error](docs/Error.md) - [LocationApi::Location](docs/Location.md) - - [LocationApi::LocationEnum](docs/LocationEnum.md) - [LocationApi::ProductCategory](docs/ProductCategory.md) - [LocationApi::ProductCategoryEnum](docs/ProductCategoryEnum.md) + - [LocationApi::ProductLocationEnum](docs/ProductLocationEnum.md) ## Documentation for Authorization diff --git a/LocationApi/VERSION b/LocationApi/VERSION index 26e33797..4a36342f 100644 --- a/LocationApi/VERSION +++ b/LocationApi/VERSION @@ -1 +1 @@ -2.0.4 \ No newline at end of file +3.0.0 diff --git a/LocationApi/docs/Location.md b/LocationApi/docs/Location.md index 48435c24..ddb55b7b 100644 --- a/LocationApi/docs/Location.md +++ b/LocationApi/docs/Location.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **location** | [**LocationEnum**](LocationEnum.md) | | | +| **location** | [**ProductLocationEnum**](ProductLocationEnum.md) | | | | **location_description** | **String** | | [optional] | | **product_categories** | [**Array<ProductCategory>**](ProductCategory.md) | | [optional] | diff --git a/LocationApi/docs/LocationsApi.md b/LocationApi/docs/LocationsApi.md index 7461cab9..ae3410a8 100644 --- a/LocationApi/docs/LocationsApi.md +++ b/LocationApi/docs/LocationsApi.md @@ -23,7 +23,7 @@ require 'pnap_location_api' api_instance = LocationApi::LocationsApi.new opts = { - location: LocationApi::LocationEnum::PHX, # LocationEnum | Location of interest + location: LocationApi::ProductLocationEnum::PHX, # ProductLocationEnum | Location of interest product_category: LocationApi::ProductCategoryEnum::SERVER # ProductCategoryEnum | Product category of interest } @@ -58,7 +58,7 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **location** | [**LocationEnum**](.md) | Location of interest | [optional] | +| **location** | [**ProductLocationEnum**](.md) | Location of interest | [optional] | | **product_category** | [**ProductCategoryEnum**](.md) | Product category of interest | [optional] | ### Return type diff --git a/LocationApi/docs/LocationEnum.md b/LocationApi/docs/ProductLocationEnum.md similarity index 63% rename from LocationApi/docs/LocationEnum.md rename to LocationApi/docs/ProductLocationEnum.md index f6c31836..f23da7ae 100644 --- a/LocationApi/docs/LocationEnum.md +++ b/LocationApi/docs/ProductLocationEnum.md @@ -1,4 +1,4 @@ -# LocationApi::LocationEnum +# LocationApi::ProductLocationEnum ## Properties @@ -10,6 +10,6 @@ ```ruby require 'pnap_location_api' -instance = LocationApi::LocationEnum.new() +instance = LocationApi::ProductLocationEnum.new() ``` diff --git a/LocationApi/lib/pnap_location_api.rb b/LocationApi/lib/pnap_location_api.rb index 047f97d4..ea374a5e 100644 --- a/LocationApi/lib/pnap_location_api.rb +++ b/LocationApi/lib/pnap_location_api.rb @@ -6,22 +6,23 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end # Common files require 'pnap_location_api/api_client' require 'pnap_location_api/api_error' +require 'pnap_location_api/api_model_base' require 'pnap_location_api/version' require 'pnap_location_api/configuration' # Models require 'pnap_location_api/models/error' require 'pnap_location_api/models/location' -require 'pnap_location_api/models/location_enum' require 'pnap_location_api/models/product_category' require 'pnap_location_api/models/product_category_enum' +require 'pnap_location_api/models/product_location_enum' # APIs require 'pnap_location_api/api/locations_api' diff --git a/LocationApi/lib/pnap_location_api/api/locations_api.rb b/LocationApi/lib/pnap_location_api/api/locations_api.rb index 93863d67..a1f89b33 100644 --- a/LocationApi/lib/pnap_location_api/api/locations_api.rb +++ b/LocationApi/lib/pnap_location_api/api/locations_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -22,7 +22,7 @@ def initialize(api_client = ApiClient.default) # Get All Locations # Retrieve the locations info. # @param [Hash] opts the optional parameters - # @option opts [LocationEnum] :location Location of interest + # @option opts [ProductLocationEnum] :location Location of interest # @option opts [ProductCategoryEnum] :product_category Product category of interest # @return [Array] def get_locations(opts = {}) @@ -33,7 +33,7 @@ def get_locations(opts = {}) # Get All Locations # Retrieve the locations info. # @param [Hash] opts the optional parameters - # @option opts [LocationEnum] :location Location of interest + # @option opts [ProductLocationEnum] :location Location of interest # @option opts [ProductCategoryEnum] :product_category Product category of interest # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers def get_locations_with_http_info(opts = {}) @@ -51,7 +51,7 @@ def get_locations_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} diff --git a/LocationApi/lib/pnap_location_api/api_client.rb b/LocationApi/lib/pnap_location_api/api_client.rb index cb35aac6..be1ec10d 100644 --- a/LocationApi/lib/pnap_location_api/api_client.rb +++ b/LocationApi/lib/pnap_location_api/api_client.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -52,7 +52,8 @@ def self.default # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers. def call_api(http_method, path, opts = {}) request = build_request(http_method, path, opts) - tempfile = download_file(request) if opts[:return_type] == 'File' + tempfile = nil + (download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File' response = request.run if @config.debugging @@ -190,19 +191,17 @@ def download_file(request) chunk.force_encoding(encoding) tempfile.write(chunk) end - # run the request to ensure the tempfile is created successfully before returning it - request.run - if tempfile + request.on_complete do + if !tempfile + fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + end tempfile.close @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ "will be deleted automatically with GC. It's also recommended to delete the temp file "\ "explicitly with `tempfile.delete`" - else - fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + yield tempfile if block_given? end - - tempfile end # Check if the given MIME is a JSON MIME. @@ -214,7 +213,7 @@ def download_file(request) # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type. @@ -281,9 +280,13 @@ def convert_to_type(data, return_type) data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else - # models (e.g. Pet) or oneOf + # models (e.g. Pet) or oneOf/anyOf klass = LocationApi.const_get(return_type) - klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of) + klass.build(data) + else + klass.build_from_hash(data) + end end end @@ -293,7 +296,7 @@ def convert_to_type(data, return_type) # @param [String] filename the filename to be sanitized # @return [String] the sanitized filename def sanitize_filename(filename) - filename.gsub(/.*[\/\\]/, '') + filename.split(/[\/\\]/).last end def build_request_url(path, opts = {}) @@ -393,4 +396,4 @@ def build_collection_param(param, collection_format) end end end -end +end \ No newline at end of file diff --git a/LocationApi/lib/pnap_location_api/api_error.rb b/LocationApi/lib/pnap_location_api/api_error.rb index 68269a29..7c8023aa 100644 --- a/LocationApi/lib/pnap_location_api/api_error.rb +++ b/LocationApi/lib/pnap_location_api/api_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/LocationApi/lib/pnap_location_api/api_model_base.rb b/LocationApi/lib/pnap_location_api/api_model_base.rb new file mode 100644 index 00000000..52efacde --- /dev/null +++ b/LocationApi/lib/pnap_location_api/api_model_base.rb @@ -0,0 +1,88 @@ +=begin +#Locations API + +#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +The version of the OpenAPI document: 1.0 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +module LocationApi + class ApiModelBase + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._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 = LocationApi.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 + + # 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/LocationApi/lib/pnap_location_api/configuration.rb b/LocationApi/lib/pnap_location_api/configuration.rb index ddb1c5d8..04d53f07 100644 --- a/LocationApi/lib/pnap_location_api/configuration.rb +++ b/LocationApi/lib/pnap_location_api/configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -79,6 +79,14 @@ class Configuration # @return [true, false] attr_accessor :debugging + # Set this to ignore operation servers for the API client. This is useful when you need to + # send requests to a different server than the one specified in the OpenAPI document. + # Will default to the base url defined in the spec but can be overridden by setting + # `scheme`, `host`, `base_path` directly. + # Default to false. + # @return [true, false] + attr_accessor :ignore_operation_servers + # Defines the logger used for debugging. # Default to `Rails.logger` (when in Rails) or logging to STDOUT. # @@ -166,6 +174,7 @@ def initialize @timeout = 0 @params_encoding = nil @debugging = false + @ignore_operation_servers = false @inject_format = false @force_ending_format = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) @@ -200,6 +209,7 @@ def base_path=(base_path) # Returns base URL for specified operation based on server settings def base_url(operation = nil) + return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers if operation_server_settings.key?(operation) then index = server_operation_index.fetch(operation, server_index) server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) diff --git a/LocationApi/lib/pnap_location_api/models/error.rb b/LocationApi/lib/pnap_location_api/models/error.rb index f3033f11..049ae0a2 100644 --- a/LocationApi/lib/pnap_location_api/models/error.rb +++ b/LocationApi/lib/pnap_location_api/models/error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module LocationApi - class Error + class Error < ApiModelBase # The description detailing the cause of the error code. attr_accessor :message @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `LocationApi::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LocationApi::Error`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -96,6 +102,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] message Value to be assigned + def message=(message) + if message.nil? + fail ArgumentError, 'message cannot be nil' + end + + @message = message + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -140,61 +156,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = LocationApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -211,24 +172,6 @@ def to_hash 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/LocationApi/lib/pnap_location_api/models/location.rb b/LocationApi/lib/pnap_location_api/models/location.rb index 29e74a14..e6031913 100644 --- a/LocationApi/lib/pnap_location_api/models/location.rb +++ b/LocationApi/lib/pnap_location_api/models/location.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module LocationApi # Location resource - class Location + class Location < ApiModelBase attr_accessor :location attr_accessor :location_description @@ -53,15 +53,20 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. def self.openapi_types { - :'location' => :'LocationEnum', + :'location' => :'ProductLocationEnum', :'location_description' => :'String', :'product_categories' => :'Array' } @@ -81,9 +86,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `LocationApi::Location`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LocationApi::Location`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -125,6 +131,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -170,61 +186,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = LocationApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -241,24 +202,6 @@ def to_hash 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/LocationApi/lib/pnap_location_api/models/product_category.rb b/LocationApi/lib/pnap_location_api/models/product_category.rb index c3fce989..0d7130bf 100644 --- a/LocationApi/lib/pnap_location_api/models/product_category.rb +++ b/LocationApi/lib/pnap_location_api/models/product_category.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module LocationApi - class ProductCategory + class ProductCategory < ApiModelBase attr_accessor :product_category attr_accessor :product_category_description @@ -49,9 +49,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -76,9 +81,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `LocationApi::ProductCategory`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LocationApi::ProductCategory`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -114,6 +120,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] product_category Value to be assigned + def product_category=(product_category) + if product_category.nil? + fail ArgumentError, 'product_category cannot be nil' + end + + @product_category = product_category + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -158,61 +174,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = LocationApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -229,24 +190,6 @@ def to_hash 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/LocationApi/lib/pnap_location_api/models/product_category_enum.rb b/LocationApi/lib/pnap_location_api/models/product_category_enum.rb index 259caa04..56ac7230 100644 --- a/LocationApi/lib/pnap_location_api/models/product_category_enum.rb +++ b/LocationApi/lib/pnap_location_api/models/product_category_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/LocationApi/lib/pnap_location_api/models/location_enum.rb b/LocationApi/lib/pnap_location_api/models/product_location_enum.rb similarity index 76% rename from LocationApi/lib/pnap_location_api/models/location_enum.rb rename to LocationApi/lib/pnap_location_api/models/product_location_enum.rb index 79f50c78..9c7b85a6 100644 --- a/LocationApi/lib/pnap_location_api/models/location_enum.rb +++ b/LocationApi/lib/pnap_location_api/models/product_location_enum.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,17 +14,16 @@ require 'time' module LocationApi - class LocationEnum + class ProductLocationEnum PHX = "PHX".freeze ASH = "ASH".freeze NLD = "NLD".freeze SGP = "SGP".freeze CHI = "CHI".freeze SEA = "SEA".freeze - AUS = "AUS".freeze def self.all_vars - @all_vars ||= [PHX, ASH, NLD, SGP, CHI, SEA, AUS].freeze + @all_vars ||= [PHX, ASH, NLD, SGP, CHI, SEA].freeze end # Builds the enum from string @@ -38,8 +37,8 @@ def self.build_from_hash(value) # @param [String] The enum value in the form of the string # @return [String] The enum value def build_from_hash(value) - return value if LocationEnum.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #LocationEnum" + return value if ProductLocationEnum.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #ProductLocationEnum" end end end diff --git a/LocationApi/lib/pnap_location_api/version.rb b/LocationApi/lib/pnap_location_api/version.rb index b9c05543..70665998 100644 --- a/LocationApi/lib/pnap_location_api/version.rb +++ b/LocationApi/lib/pnap_location_api/version.rb @@ -6,8 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 - +Generator version: 7.20.0 =end def get_version() diff --git a/LocationApi/pnap_location_api.gemspec b/LocationApi/pnap_location_api.gemspec index dddcd617..cd5d9875 100644 --- a/LocationApi/pnap_location_api.gemspec +++ b/LocationApi/pnap_location_api.gemspec @@ -8,7 +8,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -19,14 +19,14 @@ Gem::Specification.new do |s| s.name = "pnap_location_api" s.version = LocationApi::VERSION s.platform = Gem::Platform::RUBY - s.authors = ["PhoenixNAP"] + s.authors = ["OpenAPI-Generator"] s.email = ["support@phoenixnap.com"] - s.homepage = "https://phoenixnap.com/bare-metal-cloud" + s.homepage = "https://openapi-generator.tech" s.summary = "Locations API Ruby Gem" - s.description = "Locations API Ruby Gem" + s.description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)" s.license = "MPL-2.0" s.required_ruby_version = ">= 2.7" - s.metadata = { "source_code_uri" => "https://github.com/phoenixnap/ruby-sdk-bmc" } + s.metadata = {} s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' @@ -36,4 +36,4 @@ Gem::Specification.new do |s| s.test_files = `find spec/*`.split("\n") s.executables = [] s.require_paths = ["lib"] -end +end \ No newline at end of file diff --git a/LocationApi/spec/api/locations_api_spec.rb b/LocationApi/spec/api/locations_api_spec.rb index c6072b44..a9916bc8 100644 --- a/LocationApi/spec/api/locations_api_spec.rb +++ b/LocationApi/spec/api/locations_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -36,7 +36,7 @@ # Get All Locations # Retrieve the locations info. # @param [Hash] opts the optional parameters - # @option opts [LocationEnum] :location Location of interest + # @option opts [ProductLocationEnum] :location Location of interest # @option opts [ProductCategoryEnum] :product_category Product category of interest # @return [Array] describe 'get_locations test' do diff --git a/LocationApi/spec/models/error_spec.rb b/LocationApi/spec/models/error_spec.rb index bb3d9986..4209dae0 100644 --- a/LocationApi/spec/models/error_spec.rb +++ b/LocationApi/spec/models/error_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe LocationApi::Error do - let(:instance) { LocationApi::Error.new } + #let(:instance) { LocationApi::Error.new } describe 'test an instance of Error' do it 'should create an instance of Error' do diff --git a/LocationApi/spec/models/location_spec.rb b/LocationApi/spec/models/location_spec.rb index 327496b3..0eb62d6a 100644 --- a/LocationApi/spec/models/location_spec.rb +++ b/LocationApi/spec/models/location_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe LocationApi::Location do - let(:instance) { LocationApi::Location.new } + #let(:instance) { LocationApi::Location.new } describe 'test an instance of Location' do it 'should create an instance of Location' do diff --git a/LocationApi/spec/models/product_category_enum_spec.rb b/LocationApi/spec/models/product_category_enum_spec.rb index 48fe992f..bf8be956 100644 --- a/LocationApi/spec/models/product_category_enum_spec.rb +++ b/LocationApi/spec/models/product_category_enum_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe LocationApi::ProductCategoryEnum do - let(:instance) { LocationApi::ProductCategoryEnum.new } + #let(:instance) { LocationApi::ProductCategoryEnum.new } describe 'test an instance of ProductCategoryEnum' do it 'should create an instance of ProductCategoryEnum' do diff --git a/LocationApi/spec/models/product_category_spec.rb b/LocationApi/spec/models/product_category_spec.rb index af094013..022a007a 100644 --- a/LocationApi/spec/models/product_category_spec.rb +++ b/LocationApi/spec/models/product_category_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe LocationApi::ProductCategory do - let(:instance) { LocationApi::ProductCategory.new } + #let(:instance) { LocationApi::ProductCategory.new } describe 'test an instance of ProductCategory' do it 'should create an instance of ProductCategory' do diff --git a/LocationApi/spec/models/location_enum_spec.rb b/LocationApi/spec/models/product_location_enum_spec.rb similarity index 57% rename from LocationApi/spec/models/location_enum_spec.rb rename to LocationApi/spec/models/product_location_enum_spec.rb index 88092dc7..cc5806cf 100644 --- a/LocationApi/spec/models/location_enum_spec.rb +++ b/LocationApi/spec/models/product_location_enum_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,16 +14,16 @@ require 'json' require 'date' -# Unit tests for LocationApi::LocationEnum +# Unit tests for LocationApi::ProductLocationEnum # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate -describe LocationApi::LocationEnum do - let(:instance) { LocationApi::LocationEnum.new } +describe LocationApi::ProductLocationEnum do + #let(:instance) { LocationApi::ProductLocationEnum.new } - describe 'test an instance of LocationEnum' do - it 'should create an instance of LocationEnum' do + describe 'test an instance of ProductLocationEnum' do + it 'should create an instance of ProductLocationEnum' do # uncomment below to test the instance creation - #expect(instance).to be_instance_of(LocationApi::LocationEnum) + #expect(instance).to be_instance_of(LocationApi::ProductLocationEnum) end end diff --git a/LocationApi/spec/spec_helper.rb b/LocationApi/spec/spec_helper.rb index 5e940ddb..e280aa3c 100644 --- a/LocationApi/spec/spec_helper.rb +++ b/LocationApi/spec/spec_helper.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/NetworkApi/README.md b/NetworkApi/README.md index d77b2a5a..049804b0 100644 --- a/NetworkApi/README.md +++ b/NetworkApi/README.md @@ -150,6 +150,7 @@ Class | Method | HTTP request | Description - [NetworkApi::AsnDetails](docs/AsnDetails.md) - [NetworkApi::BgpIPv4Prefix](docs/BgpIPv4Prefix.md) + - [NetworkApi::BgpIpPrefix](docs/BgpIpPrefix.md) - [NetworkApi::BgpPeerGroup](docs/BgpPeerGroup.md) - [NetworkApi::BgpPeerGroupCreate](docs/BgpPeerGroupCreate.md) - [NetworkApi::BgpPeerGroupPatch](docs/BgpPeerGroupPatch.md) diff --git a/NetworkApi/VERSION b/NetworkApi/VERSION index 8f9174b4..ccbccc3d 100644 --- a/NetworkApi/VERSION +++ b/NetworkApi/VERSION @@ -1 +1 @@ -2.1.2 \ No newline at end of file +2.2.0 diff --git a/NetworkApi/docs/BgpIpPrefix.md b/NetworkApi/docs/BgpIpPrefix.md new file mode 100644 index 00000000..b0e0ee8f --- /dev/null +++ b/NetworkApi/docs/BgpIpPrefix.md @@ -0,0 +1,24 @@ +# NetworkApi::BgpIpPrefix + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **ip_allocation_id** | **String** | IP allocation ID. | | +| **cidr** | **String** | The IP block in CIDR format, dependent on IP version. | | +| **ip_version** | **String** | The IP block version. | | +| **status** | **String** | The BGP IP Prefix status. Can have one of the following values: `PENDING`, `BUSY`, `READY`, `ERROR` and `DELETING`. | | + +## Example + +```ruby +require 'pnap_network_api' + +instance = NetworkApi::BgpIpPrefix.new( + ip_allocation_id: 6047127fed34ecc3ba8402d2, + cidr: 10.111.14.40/29, + ip_version: V4, + status: READY +) +``` + diff --git a/NetworkApi/docs/BgpPeerGroup.md b/NetworkApi/docs/BgpPeerGroup.md index 30ce7e8a..9774d322 100644 --- a/NetworkApi/docs/BgpPeerGroup.md +++ b/NetworkApi/docs/BgpPeerGroup.md @@ -6,8 +6,9 @@ | ---- | ---- | ----------- | ----- | | **id** | **String** | The unique identifier of the BGP Peer Group. | | | **status** | **String** | The BGP Peer Group status. Can have one of the following values: `PENDING`, `ON_HOLD`, `BUSY`, `READY`, `ERROR`, `PENDING_DELETION` and `DELETING`. | | -| **location** | **String** | The BGP Peer Group location. Can have one of the following values: `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`. | | -| **ipv4_prefixes** | [**Array<BgpIPv4Prefix>**](BgpIPv4Prefix.md) | The List of the BGP Peer Group IPv4 prefixes. | | +| **location** | **String** | The BGP Peer Group location. Can have one of the following values: `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`. | | +| **ipv4_prefixes** | [**Array<BgpIPv4Prefix>**](BgpIPv4Prefix.md) | The List of the BGP Peer Group IPv4 prefixes. Deprecated in favour of generic ipPrefixes. | | +| **ip_prefixes** | [**Array<BgpIpPrefix>**](BgpIpPrefix.md) | The List of the BGP Peer Group IP prefixes. | | | **target_asn_details** | [**AsnDetails**](AsnDetails.md) | | | | **active_asn_details** | [**AsnDetails**](AsnDetails.md) | | [optional] | | **password** | **String** | The BGP Peer Group password. | | @@ -15,6 +16,7 @@ | **rpki_roa_origin_asn** | **Integer** | The RPKI ROA Origin ASN of the BGP Peer Group based on location. | | | **e_bgp_multi_hop** | **Integer** | The eBGP Multi-hop of the BGP Peer Group. | | | **peering_loopbacks_v4** | **Array<String>** | The IPv4 Peering Loopback addresses of the BGP Peer Group. Valid IP formats are IPv4 addresses. | | +| **peering_loopbacks_v6** | **Array<String>** | The IPv6 Peering Loopback addresses of the BGP Peer Group. Valid IP formats are IPv6 addresses. | | | **keep_alive_timer_seconds** | **Integer** | The Keep Alive Timer in seconds of the BGP Peer Group. | | | **hold_timer_seconds** | **Integer** | The Hold Timer in seconds of the BGP Peer Group. | | | **created_on** | **String** | Date and time of creation. | [optional] | @@ -30,6 +32,7 @@ instance = NetworkApi::BgpPeerGroup.new( status: READY, location: ASH, ipv4_prefixes: null, + ip_prefixes: null, target_asn_details: null, active_asn_details: null, password: E!73423ghhjfge45, @@ -37,6 +40,7 @@ instance = NetworkApi::BgpPeerGroup.new( rpki_roa_origin_asn: 20454, e_bgp_multi_hop: 7, peering_loopbacks_v4: ["169.254.247.0","169.254.247.1"], + peering_loopbacks_v6: ["fd00:0:0:1005::1","fd00:0:0:1005::2"], keep_alive_timer_seconds: 10, hold_timer_seconds: 30, created_on: 2024-03-01T10:30:00Z, diff --git a/NetworkApi/docs/BgpPeerGroupCreate.md b/NetworkApi/docs/BgpPeerGroupCreate.md index ecefd882..1e5bd788 100644 --- a/NetworkApi/docs/BgpPeerGroupCreate.md +++ b/NetworkApi/docs/BgpPeerGroupCreate.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **location** | **String** | The BGP Peer Group location. Can have one of the following values: `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`. | | +| **location** | **String** | The BGP Peer Group location. Can have one of the following values: `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`. | | | **asn** | **Integer** | The BGP Peer Group ASN. | [default to 65401] | | **password** | **String** | The BGP Peer Group password. | [optional] | | **advertised_routes** | **String** | The Advertised routes for the BGP Peer Group. Can have one of the following values: `DEFAULT` and `NONE`. | [default to 'NONE'] | diff --git a/NetworkApi/docs/PrivateNetworkCreate.md b/NetworkApi/docs/PrivateNetworkCreate.md index e3bdb34e..6609c0f0 100644 --- a/NetworkApi/docs/PrivateNetworkCreate.md +++ b/NetworkApi/docs/PrivateNetworkCreate.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **name** | **String** | The friendly name of this private network. This name should be unique. | | | **description** | **String** | The description of this private network. | [optional] | -| **location** | **String** | The location of this private network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`. | | +| **location** | **String** | The location of this private network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`. | | | **location_default** | **Boolean** | Identifies network as the default private network for the specified location. | [optional][default to false] | | **vlan_id** | **Integer** | The VLAN that will be assigned to this network. | [optional] | | **cidr** | **String** | IP range associated with this private network in CIDR notation.<br> Setting the `force` query parameter to `true` allows you to skip assigning a specific IP range to network. | [optional] | diff --git a/NetworkApi/docs/PublicNetwork.md b/NetworkApi/docs/PublicNetwork.md index a9f05e86..f9258715 100644 --- a/NetworkApi/docs/PublicNetwork.md +++ b/NetworkApi/docs/PublicNetwork.md @@ -8,7 +8,7 @@ | **vlan_id** | **Integer** | The VLAN of this public network. | | | **memberships** | [**Array<NetworkMembership>**](NetworkMembership.md) | A list of resources that are members of this public network. | | | **name** | **String** | The friendly name of this public network. | | -| **location** | **String** | The location of this public network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`. | | +| **location** | **String** | The location of this public network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`. | | | **description** | **String** | The description of this public network. | [optional] | | **status** | **String** | The status of the public network. Can have one of the following values: `BUSY`, `READY`, `DELETING` or `ERROR`. | | | **created_on** | **Time** | Date and time when this public network was created. | | diff --git a/NetworkApi/docs/PublicNetworkCreate.md b/NetworkApi/docs/PublicNetworkCreate.md index 84fa2a3f..89496701 100644 --- a/NetworkApi/docs/PublicNetworkCreate.md +++ b/NetworkApi/docs/PublicNetworkCreate.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **name** | **String** | The friendly name of this public network. This name should be unique. | | | **description** | **String** | The description of this public network. | [optional] | -| **location** | **String** | The location of this public network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`. | | +| **location** | **String** | The location of this public network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`. | | | **vlan_id** | **Integer** | The VLAN that will be assigned to this network. | [optional] | | **ip_blocks** | [**Array<PublicNetworkIpBlockCreate>**](PublicNetworkIpBlockCreate.md) | A list of IP Blocks that will be associated with this public network. Supported maximum of 10 IPv4 Blocks and 1 IPv6 Block. | [optional] | | **ra_enabled** | **Boolean** | Boolean indicating whether Router Advertisement is enabled. Only applicable for Network with IPv6 Blocks. | [optional] | diff --git a/NetworkApi/lib/pnap_network_api.rb b/NetworkApi/lib/pnap_network_api.rb index 3dc2d19a..e1ed674c 100644 --- a/NetworkApi/lib/pnap_network_api.rb +++ b/NetworkApi/lib/pnap_network_api.rb @@ -6,19 +6,21 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end # Common files require 'pnap_network_api/api_client' require 'pnap_network_api/api_error' +require 'pnap_network_api/api_model_base' require 'pnap_network_api/version' require 'pnap_network_api/configuration' # Models require 'pnap_network_api/models/asn_details' require 'pnap_network_api/models/bgp_ipv4_prefix' +require 'pnap_network_api/models/bgp_ip_prefix' require 'pnap_network_api/models/bgp_peer_group' require 'pnap_network_api/models/bgp_peer_group_create' require 'pnap_network_api/models/bgp_peer_group_patch' diff --git a/NetworkApi/lib/pnap_network_api/api/bgp_peer_groups_api.rb b/NetworkApi/lib/pnap_network_api/api/bgp_peer_groups_api.rb index b638ca6e..630e0d3b 100644 --- a/NetworkApi/lib/pnap_network_api/api/bgp_peer_groups_api.rb +++ b/NetworkApi/lib/pnap_network_api/api/bgp_peer_groups_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -48,7 +48,7 @@ def bgp_peer_groups_get_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -111,7 +111,7 @@ def bgp_peer_groups_peer_group_id_delete_with_http_info(bgp_peer_group_id, opts # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -174,7 +174,7 @@ def bgp_peer_groups_peer_group_id_get_with_http_info(bgp_peer_group_id, opts = { # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -243,7 +243,7 @@ def bgp_peer_groups_peer_group_id_patch_with_http_info(bgp_peer_group_id, bgp_pe # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -311,7 +311,7 @@ def bgp_peer_groups_post_with_http_info(bgp_peer_group_create, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? diff --git a/NetworkApi/lib/pnap_network_api/api/private_networks_api.rb b/NetworkApi/lib/pnap_network_api/api/private_networks_api.rb index 72cd50ce..6518543e 100644 --- a/NetworkApi/lib/pnap_network_api/api/private_networks_api.rb +++ b/NetworkApi/lib/pnap_network_api/api/private_networks_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -48,7 +48,7 @@ def private_networks_get_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -111,7 +111,7 @@ def private_networks_network_id_delete_with_http_info(private_network_id, opts = # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -174,7 +174,7 @@ def private_networks_network_id_get_with_http_info(private_network_id, opts = {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -243,7 +243,7 @@ def private_networks_network_id_put_with_http_info(private_network_id, private_n # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -314,7 +314,7 @@ def private_networks_post_with_http_info(private_network_create, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? diff --git a/NetworkApi/lib/pnap_network_api/api/public_networks_api.rb b/NetworkApi/lib/pnap_network_api/api/public_networks_api.rb index 1e71cb79..25f2d5d2 100644 --- a/NetworkApi/lib/pnap_network_api/api/public_networks_api.rb +++ b/NetworkApi/lib/pnap_network_api/api/public_networks_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -48,7 +48,7 @@ def public_networks_get_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -111,7 +111,7 @@ def public_networks_network_id_delete_with_http_info(public_network_id, opts = { # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -174,7 +174,7 @@ def public_networks_network_id_get_with_http_info(public_network_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -246,7 +246,7 @@ def public_networks_network_id_ip_blocks_ip_block_id_delete_with_http_info(publi # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -315,7 +315,7 @@ def public_networks_network_id_ip_blocks_post_with_http_info(public_network_id, # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -389,7 +389,7 @@ def public_networks_network_id_patch_with_http_info(public_network_id, public_ne # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -457,7 +457,7 @@ def public_networks_post_with_http_info(public_network_create, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? diff --git a/NetworkApi/lib/pnap_network_api/api_client.rb b/NetworkApi/lib/pnap_network_api/api_client.rb index dbe50ef1..ee9cd818 100644 --- a/NetworkApi/lib/pnap_network_api/api_client.rb +++ b/NetworkApi/lib/pnap_network_api/api_client.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -52,7 +52,8 @@ def self.default # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers. def call_api(http_method, path, opts = {}) request = build_request(http_method, path, opts) - tempfile = download_file(request) if opts[:return_type] == 'File' + tempfile = nil + (download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File' response = request.run if @config.debugging @@ -191,19 +192,17 @@ def download_file(request) chunk.force_encoding(encoding) tempfile.write(chunk) end - # run the request to ensure the tempfile is created successfully before returning it - request.run - if tempfile + request.on_complete do + if !tempfile + fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + end tempfile.close @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ "will be deleted automatically with GC. It's also recommended to delete the temp file "\ "explicitly with `tempfile.delete`" - else - fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + yield tempfile if block_given? end - - tempfile end # Check if the given MIME is a JSON MIME. @@ -215,7 +214,7 @@ def download_file(request) # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type. @@ -282,9 +281,13 @@ def convert_to_type(data, return_type) data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else - # models (e.g. Pet) or oneOf + # models (e.g. Pet) or oneOf/anyOf klass = NetworkApi.const_get(return_type) - klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of) + klass.build(data) + else + klass.build_from_hash(data) + end end end @@ -294,7 +297,7 @@ def convert_to_type(data, return_type) # @param [String] filename the filename to be sanitized # @return [String] the sanitized filename def sanitize_filename(filename) - filename.gsub(/.*[\/\\]/, '') + filename.split(/[\/\\]/).last end def build_request_url(path, opts = {}) @@ -394,4 +397,4 @@ def build_collection_param(param, collection_format) end end end -end +end \ No newline at end of file diff --git a/NetworkApi/lib/pnap_network_api/api_error.rb b/NetworkApi/lib/pnap_network_api/api_error.rb index d25f5c56..27aae97a 100644 --- a/NetworkApi/lib/pnap_network_api/api_error.rb +++ b/NetworkApi/lib/pnap_network_api/api_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/NetworkApi/lib/pnap_network_api/api_model_base.rb b/NetworkApi/lib/pnap_network_api/api_model_base.rb new file mode 100644 index 00000000..267ba048 --- /dev/null +++ b/NetworkApi/lib/pnap_network_api/api_model_base.rb @@ -0,0 +1,88 @@ +=begin +#Networks API + +#Create, list, edit and delete public/private networks with the Network API. Use public networks to place multiple servers on the same network or VLAN. Assign new servers with IP addresses from the same CIDR range. Use private networks to avoid unnecessary egress data charges. Model your networks according to your business needs.

Helpful knowledge base articles are available for multi-private backend networks, public networks and border gateway protocol peer groups.

All URLs are relative to (https://api.phoenixnap.com/networks/v1/) + +The version of the OpenAPI document: 1.0 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +module NetworkApi + class ApiModelBase + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._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 = NetworkApi.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 + + # 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/NetworkApi/lib/pnap_network_api/configuration.rb b/NetworkApi/lib/pnap_network_api/configuration.rb index c4a461a2..fc780711 100644 --- a/NetworkApi/lib/pnap_network_api/configuration.rb +++ b/NetworkApi/lib/pnap_network_api/configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -79,6 +79,14 @@ class Configuration # @return [true, false] attr_accessor :debugging + # Set this to ignore operation servers for the API client. This is useful when you need to + # send requests to a different server than the one specified in the OpenAPI document. + # Will default to the base url defined in the spec but can be overridden by setting + # `scheme`, `host`, `base_path` directly. + # Default to false. + # @return [true, false] + attr_accessor :ignore_operation_servers + # Defines the logger used for debugging. # Default to `Rails.logger` (when in Rails) or logging to STDOUT. # @@ -166,6 +174,7 @@ def initialize @timeout = 0 @params_encoding = nil @debugging = false + @ignore_operation_servers = false @inject_format = false @force_ending_format = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) @@ -200,6 +209,7 @@ def base_path=(base_path) # Returns base URL for specified operation based on server settings def base_url(operation = nil) + return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers if operation_server_settings.key?(operation) then index = server_operation_index.fetch(operation, server_index) server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) diff --git a/NetworkApi/lib/pnap_network_api/models/asn_details.rb b/NetworkApi/lib/pnap_network_api/models/asn_details.rb index 4613a305..5949a99d 100644 --- a/NetworkApi/lib/pnap_network_api/models/asn_details.rb +++ b/NetworkApi/lib/pnap_network_api/models/asn_details.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkApi # BGP Peer Group ASN details. - class AsnDetails + class AsnDetails < ApiModelBase # The BGP Peer Group ASN. attr_accessor :asn @@ -38,9 +38,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -67,9 +72,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkApi::AsnDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::AsnDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -127,6 +133,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] asn Value to be assigned + def asn=(asn) + if asn.nil? + fail ArgumentError, 'asn cannot be nil' + end + + @asn = asn + end + + # Custom attribute writer method with validation + # @param [Object] is_bring_your_own Value to be assigned + def is_bring_your_own=(is_bring_your_own) + if is_bring_your_own.nil? + fail ArgumentError, 'is_bring_your_own cannot be nil' + end + + @is_bring_your_own = is_bring_your_own + end + + # Custom attribute writer method with validation + # @param [Object] verification_status Value to be assigned + def verification_status=(verification_status) + if verification_status.nil? + fail ArgumentError, 'verification_status cannot be nil' + end + + @verification_status = verification_status + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -173,61 +209,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -244,24 +225,6 @@ def to_hash 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/NetworkApi/lib/pnap_network_api/models/bgp_ip_prefix.rb b/NetworkApi/lib/pnap_network_api/models/bgp_ip_prefix.rb new file mode 100644 index 00000000..8eb2c810 --- /dev/null +++ b/NetworkApi/lib/pnap_network_api/models/bgp_ip_prefix.rb @@ -0,0 +1,247 @@ +=begin +#Networks API + +#Create, list, edit and delete public/private networks with the Network API. Use public networks to place multiple servers on the same network or VLAN. Assign new servers with IP addresses from the same CIDR range. Use private networks to avoid unnecessary egress data charges. Model your networks according to your business needs.

Helpful knowledge base articles are available for multi-private backend networks, public networks and border gateway protocol peer groups.

All URLs are relative to (https://api.phoenixnap.com/networks/v1/) + +The version of the OpenAPI document: 1.0 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'date' +require 'time' + +module NetworkApi + # The BGP IP Prefix. + class BgpIpPrefix < ApiModelBase + # IP allocation ID. + attr_accessor :ip_allocation_id + + # The IP block in CIDR format, dependent on IP version. + attr_accessor :cidr + + # The IP block version. + attr_accessor :ip_version + + # The BGP IP Prefix status. Can have one of the following values: `PENDING`, `BUSY`, `READY`, `ERROR` and `DELETING`. + attr_accessor :status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'ip_allocation_id' => :'ipAllocationId', + :'cidr' => :'cidr', + :'ip_version' => :'ipVersion', + :'status' => :'status' + } + end + + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + acceptable_attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'ip_allocation_id' => :'String', + :'cidr' => :'String', + :'ip_version' => :'String', + :'status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_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 `NetworkApi::BgpIpPrefix` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::BgpIpPrefix`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'ip_allocation_id') + self.ip_allocation_id = attributes[:'ip_allocation_id'] + else + self.ip_allocation_id = nil + end + + if attributes.key?(:'cidr') + self.cidr = attributes[:'cidr'] + else + self.cidr = nil + end + + if attributes.key?(:'ip_version') + self.ip_version = attributes[:'ip_version'] + else + self.ip_version = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + 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 + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @ip_allocation_id.nil? + invalid_properties.push('invalid value for "ip_allocation_id", ip_allocation_id cannot be nil.') + end + + if @cidr.nil? + invalid_properties.push('invalid value for "cidr", cidr cannot be nil.') + end + + if @ip_version.nil? + invalid_properties.push('invalid value for "ip_version", ip_version cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status 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? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @ip_allocation_id.nil? + return false if @cidr.nil? + return false if @ip_version.nil? + return false if @status.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] ip_allocation_id Value to be assigned + def ip_allocation_id=(ip_allocation_id) + if ip_allocation_id.nil? + fail ArgumentError, 'ip_allocation_id cannot be nil' + end + + @ip_allocation_id = ip_allocation_id + end + + # Custom attribute writer method with validation + # @param [Object] cidr Value to be assigned + def cidr=(cidr) + if cidr.nil? + fail ArgumentError, 'cidr cannot be nil' + end + + @cidr = cidr + end + + # Custom attribute writer method with validation + # @param [Object] ip_version Value to be assigned + def ip_version=(ip_version) + if ip_version.nil? + fail ArgumentError, 'ip_version cannot be nil' + end + + @ip_version = ip_version + end + + # Custom attribute writer method with validation + # @param [Object] status Value to be assigned + def status=(status) + if status.nil? + fail ArgumentError, 'status cannot be nil' + end + + @status = status + 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 && + ip_allocation_id == o.ip_allocation_id && + cidr == o.cidr && + ip_version == o.ip_version && + 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 + [ip_allocation_id, cidr, ip_version, 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) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{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[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_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.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + end + +end diff --git a/NetworkApi/lib/pnap_network_api/models/bgp_ipv4_prefix.rb b/NetworkApi/lib/pnap_network_api/models/bgp_ipv4_prefix.rb index a9df74ba..23abaf64 100644 --- a/NetworkApi/lib/pnap_network_api/models/bgp_ipv4_prefix.rb +++ b/NetworkApi/lib/pnap_network_api/models/bgp_ipv4_prefix.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,8 +14,8 @@ require 'time' module NetworkApi - # The BGP IPv4 Prefix. - class BgpIPv4Prefix + # The BGP IPv4 Prefix. Deprecated in favour of generic BgpIpPrefix. + class BgpIPv4Prefix < ApiModelBase # IPv4 allocation ID. attr_accessor :ipv4_allocation_id @@ -42,9 +42,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -72,9 +77,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkApi::BgpIPv4Prefix`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::BgpIPv4Prefix`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -156,6 +162,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] ipv4_allocation_id Value to be assigned + def ipv4_allocation_id=(ipv4_allocation_id) + if ipv4_allocation_id.nil? + fail ArgumentError, 'ipv4_allocation_id cannot be nil' + end + + @ipv4_allocation_id = ipv4_allocation_id + end + # Custom attribute writer method with validation # @param [Object] cidr Value to be assigned def cidr=(cidr) @@ -171,6 +187,36 @@ def cidr=(cidr) @cidr = cidr end + # Custom attribute writer method with validation + # @param [Object] status Value to be assigned + def status=(status) + if status.nil? + fail ArgumentError, 'status cannot be nil' + end + + @status = status + end + + # Custom attribute writer method with validation + # @param [Object] is_bring_your_own_ip Value to be assigned + def is_bring_your_own_ip=(is_bring_your_own_ip) + if is_bring_your_own_ip.nil? + fail ArgumentError, 'is_bring_your_own_ip cannot be nil' + end + + @is_bring_your_own_ip = is_bring_your_own_ip + end + + # Custom attribute writer method with validation + # @param [Object] in_use Value to be assigned + def in_use=(in_use) + if in_use.nil? + fail ArgumentError, 'in_use cannot be nil' + end + + @in_use = in_use + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -218,61 +264,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -289,24 +280,6 @@ def to_hash 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/NetworkApi/lib/pnap_network_api/models/bgp_peer_group.rb b/NetworkApi/lib/pnap_network_api/models/bgp_peer_group.rb index 26b05b9c..d6901d0e 100644 --- a/NetworkApi/lib/pnap_network_api/models/bgp_peer_group.rb +++ b/NetworkApi/lib/pnap_network_api/models/bgp_peer_group.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,19 +15,22 @@ module NetworkApi # The Border Gateway Protocol (BGP) Peer Group. - class BgpPeerGroup + class BgpPeerGroup < ApiModelBase # The unique identifier of the BGP Peer Group. attr_accessor :id # The BGP Peer Group status. Can have one of the following values: `PENDING`, `ON_HOLD`, `BUSY`, `READY`, `ERROR`, `PENDING_DELETION` and `DELETING`. attr_accessor :status - # The BGP Peer Group location. Can have one of the following values: `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`. + # The BGP Peer Group location. Can have one of the following values: `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`. attr_accessor :location - # The List of the BGP Peer Group IPv4 prefixes. + # The List of the BGP Peer Group IPv4 prefixes. Deprecated in favour of generic ipPrefixes. attr_accessor :ipv4_prefixes + # The List of the BGP Peer Group IP prefixes. + attr_accessor :ip_prefixes + attr_accessor :target_asn_details attr_accessor :active_asn_details @@ -47,6 +50,9 @@ class BgpPeerGroup # The IPv4 Peering Loopback addresses of the BGP Peer Group. Valid IP formats are IPv4 addresses. attr_accessor :peering_loopbacks_v4 + # The IPv6 Peering Loopback addresses of the BGP Peer Group. Valid IP formats are IPv6 addresses. + attr_accessor :peering_loopbacks_v6 + # The Keep Alive Timer in seconds of the BGP Peer Group. attr_accessor :keep_alive_timer_seconds @@ -66,6 +72,7 @@ def self.attribute_map :'status' => :'status', :'location' => :'location', :'ipv4_prefixes' => :'ipv4Prefixes', + :'ip_prefixes' => :'ipPrefixes', :'target_asn_details' => :'targetAsnDetails', :'active_asn_details' => :'activeAsnDetails', :'password' => :'password', @@ -73,6 +80,7 @@ def self.attribute_map :'rpki_roa_origin_asn' => :'rpkiRoaOriginAsn', :'e_bgp_multi_hop' => :'eBgpMultiHop', :'peering_loopbacks_v4' => :'peeringLoopbacksV4', + :'peering_loopbacks_v6' => :'peeringLoopbacksV6', :'keep_alive_timer_seconds' => :'keepAliveTimerSeconds', :'hold_timer_seconds' => :'holdTimerSeconds', :'created_on' => :'createdOn', @@ -80,9 +88,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -92,6 +105,7 @@ def self.openapi_types :'status' => :'String', :'location' => :'String', :'ipv4_prefixes' => :'Array', + :'ip_prefixes' => :'Array', :'target_asn_details' => :'AsnDetails', :'active_asn_details' => :'AsnDetails', :'password' => :'String', @@ -99,6 +113,7 @@ def self.openapi_types :'rpki_roa_origin_asn' => :'Integer', :'e_bgp_multi_hop' => :'Integer', :'peering_loopbacks_v4' => :'Array', + :'peering_loopbacks_v6' => :'Array', :'keep_alive_timer_seconds' => :'Integer', :'hold_timer_seconds' => :'Integer', :'created_on' => :'String', @@ -120,9 +135,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkApi::BgpPeerGroup`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::BgpPeerGroup`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -153,6 +169,14 @@ def initialize(attributes = {}) self.ipv4_prefixes = nil end + if attributes.key?(:'ip_prefixes') + if (value = attributes[:'ip_prefixes']).is_a?(Array) + self.ip_prefixes = value + end + else + self.ip_prefixes = nil + end + if attributes.key?(:'target_asn_details') self.target_asn_details = attributes[:'target_asn_details'] else @@ -195,6 +219,14 @@ def initialize(attributes = {}) self.peering_loopbacks_v4 = nil end + if attributes.key?(:'peering_loopbacks_v6') + if (value = attributes[:'peering_loopbacks_v6']).is_a?(Array) + self.peering_loopbacks_v6 = value + end + else + self.peering_loopbacks_v6 = nil + end + if attributes.key?(:'keep_alive_timer_seconds') self.keep_alive_timer_seconds = attributes[:'keep_alive_timer_seconds'] else @@ -237,6 +269,10 @@ def list_invalid_properties invalid_properties.push('invalid value for "ipv4_prefixes", ipv4_prefixes cannot be nil.') end + if @ip_prefixes.nil? + invalid_properties.push('invalid value for "ip_prefixes", ip_prefixes cannot be nil.') + end + if @target_asn_details.nil? invalid_properties.push('invalid value for "target_asn_details", target_asn_details cannot be nil.') end @@ -250,7 +286,7 @@ def list_invalid_properties end if @password.to_s.length < 8 - invalid_properties.push('invalid value for "password", the character length must be great than or equal to 8.') + invalid_properties.push('invalid value for "password", the character length must be greater than or equal to 8.') end pattern = Regexp.new(/^[a-zA-Z0-9!@#$%^&*()\-|\[\]{}=;:<>,.]+$/) @@ -274,6 +310,10 @@ def list_invalid_properties invalid_properties.push('invalid value for "peering_loopbacks_v4", peering_loopbacks_v4 cannot be nil.') end + if @peering_loopbacks_v6.nil? + invalid_properties.push('invalid value for "peering_loopbacks_v6", peering_loopbacks_v6 cannot be nil.') + end + if @keep_alive_timer_seconds.nil? invalid_properties.push('invalid value for "keep_alive_timer_seconds", keep_alive_timer_seconds cannot be nil.') end @@ -293,6 +333,7 @@ def valid? return false if @status.nil? return false if @location.nil? return false if @ipv4_prefixes.nil? + return false if @ip_prefixes.nil? return false if @target_asn_details.nil? return false if @password.nil? return false if @password.to_s.length > 32 @@ -302,11 +343,72 @@ def valid? return false if @rpki_roa_origin_asn.nil? return false if @e_bgp_multi_hop.nil? return false if @peering_loopbacks_v4.nil? + return false if @peering_loopbacks_v6.nil? return false if @keep_alive_timer_seconds.nil? return false if @hold_timer_seconds.nil? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] status Value to be assigned + def status=(status) + if status.nil? + fail ArgumentError, 'status cannot be nil' + end + + @status = status + end + + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + + # Custom attribute writer method with validation + # @param [Object] ipv4_prefixes Value to be assigned + def ipv4_prefixes=(ipv4_prefixes) + if ipv4_prefixes.nil? + fail ArgumentError, 'ipv4_prefixes cannot be nil' + end + + @ipv4_prefixes = ipv4_prefixes + end + + # Custom attribute writer method with validation + # @param [Object] ip_prefixes Value to be assigned + def ip_prefixes=(ip_prefixes) + if ip_prefixes.nil? + fail ArgumentError, 'ip_prefixes cannot be nil' + end + + @ip_prefixes = ip_prefixes + end + + # Custom attribute writer method with validation + # @param [Object] target_asn_details Value to be assigned + def target_asn_details=(target_asn_details) + if target_asn_details.nil? + fail ArgumentError, 'target_asn_details cannot be nil' + end + + @target_asn_details = target_asn_details + end + # Custom attribute writer method with validation # @param [Object] password Value to be assigned def password=(password) @@ -319,7 +421,7 @@ def password=(password) end if password.to_s.length < 8 - fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 8.' + fail ArgumentError, 'invalid value for "password", the character length must be greater than or equal to 8.' end pattern = Regexp.new(/^[a-zA-Z0-9!@#$%^&*()\-|\[\]{}=;:<>,.]+$/) @@ -330,6 +432,76 @@ def password=(password) @password = password end + # Custom attribute writer method with validation + # @param [Object] advertised_routes Value to be assigned + def advertised_routes=(advertised_routes) + if advertised_routes.nil? + fail ArgumentError, 'advertised_routes cannot be nil' + end + + @advertised_routes = advertised_routes + end + + # Custom attribute writer method with validation + # @param [Object] rpki_roa_origin_asn Value to be assigned + def rpki_roa_origin_asn=(rpki_roa_origin_asn) + if rpki_roa_origin_asn.nil? + fail ArgumentError, 'rpki_roa_origin_asn cannot be nil' + end + + @rpki_roa_origin_asn = rpki_roa_origin_asn + end + + # Custom attribute writer method with validation + # @param [Object] e_bgp_multi_hop Value to be assigned + def e_bgp_multi_hop=(e_bgp_multi_hop) + if e_bgp_multi_hop.nil? + fail ArgumentError, 'e_bgp_multi_hop cannot be nil' + end + + @e_bgp_multi_hop = e_bgp_multi_hop + end + + # Custom attribute writer method with validation + # @param [Object] peering_loopbacks_v4 Value to be assigned + def peering_loopbacks_v4=(peering_loopbacks_v4) + if peering_loopbacks_v4.nil? + fail ArgumentError, 'peering_loopbacks_v4 cannot be nil' + end + + @peering_loopbacks_v4 = peering_loopbacks_v4 + end + + # Custom attribute writer method with validation + # @param [Object] peering_loopbacks_v6 Value to be assigned + def peering_loopbacks_v6=(peering_loopbacks_v6) + if peering_loopbacks_v6.nil? + fail ArgumentError, 'peering_loopbacks_v6 cannot be nil' + end + + @peering_loopbacks_v6 = peering_loopbacks_v6 + end + + # Custom attribute writer method with validation + # @param [Object] keep_alive_timer_seconds Value to be assigned + def keep_alive_timer_seconds=(keep_alive_timer_seconds) + if keep_alive_timer_seconds.nil? + fail ArgumentError, 'keep_alive_timer_seconds cannot be nil' + end + + @keep_alive_timer_seconds = keep_alive_timer_seconds + end + + # Custom attribute writer method with validation + # @param [Object] hold_timer_seconds Value to be assigned + def hold_timer_seconds=(hold_timer_seconds) + if hold_timer_seconds.nil? + fail ArgumentError, 'hold_timer_seconds cannot be nil' + end + + @hold_timer_seconds = hold_timer_seconds + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -339,6 +511,7 @@ def ==(o) status == o.status && location == o.location && ipv4_prefixes == o.ipv4_prefixes && + ip_prefixes == o.ip_prefixes && target_asn_details == o.target_asn_details && active_asn_details == o.active_asn_details && password == o.password && @@ -346,6 +519,7 @@ def ==(o) rpki_roa_origin_asn == o.rpki_roa_origin_asn && e_bgp_multi_hop == o.e_bgp_multi_hop && peering_loopbacks_v4 == o.peering_loopbacks_v4 && + peering_loopbacks_v6 == o.peering_loopbacks_v6 && keep_alive_timer_seconds == o.keep_alive_timer_seconds && hold_timer_seconds == o.hold_timer_seconds && created_on == o.created_on && @@ -361,7 +535,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, status, location, ipv4_prefixes, target_asn_details, active_asn_details, password, advertised_routes, rpki_roa_origin_asn, e_bgp_multi_hop, peering_loopbacks_v4, keep_alive_timer_seconds, hold_timer_seconds, created_on, last_updated_on].hash + [id, status, location, ipv4_prefixes, ip_prefixes, target_asn_details, active_asn_details, password, advertised_routes, rpki_roa_origin_asn, e_bgp_multi_hop, peering_loopbacks_v4, peering_loopbacks_v6, keep_alive_timer_seconds, hold_timer_seconds, created_on, last_updated_on].hash end # Builds the object from hash @@ -387,61 +561,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -458,24 +577,6 @@ def to_hash 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/NetworkApi/lib/pnap_network_api/models/bgp_peer_group_create.rb b/NetworkApi/lib/pnap_network_api/models/bgp_peer_group_create.rb index ef7b6130..f376ecf8 100644 --- a/NetworkApi/lib/pnap_network_api/models/bgp_peer_group_create.rb +++ b/NetworkApi/lib/pnap_network_api/models/bgp_peer_group_create.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,8 +15,8 @@ module NetworkApi # Create a BGP Peer Group. - class BgpPeerGroupCreate - # The BGP Peer Group location. Can have one of the following values: `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`. + class BgpPeerGroupCreate < ApiModelBase + # The BGP Peer Group location. Can have one of the following values: `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`. attr_accessor :location # The BGP Peer Group ASN. @@ -38,9 +38,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -67,9 +72,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkApi::BgpPeerGroupCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::BgpPeerGroupCreate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -115,7 +121,7 @@ def list_invalid_properties end if !@password.nil? && @password.to_s.length < 8 - invalid_properties.push('invalid value for "password", the character length must be great than or equal to 8.') + invalid_properties.push('invalid value for "password", the character length must be greater than or equal to 8.') end pattern = Regexp.new(/^[a-zA-Z0-9!@#$%^&*()\-|\[\]{}=;:<>,.]+$/) @@ -143,6 +149,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + + # Custom attribute writer method with validation + # @param [Object] asn Value to be assigned + def asn=(asn) + if asn.nil? + fail ArgumentError, 'asn cannot be nil' + end + + @asn = asn + end + # Custom attribute writer method with validation # @param [Object] password Value to be assigned def password=(password) @@ -155,7 +181,7 @@ def password=(password) end if password.to_s.length < 8 - fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 8.' + fail ArgumentError, 'invalid value for "password", the character length must be greater than or equal to 8.' end pattern = Regexp.new(/^[a-zA-Z0-9!@#$%^&*()\-|\[\]{}=;:<>,.]+$/) @@ -166,6 +192,16 @@ def password=(password) @password = password end + # Custom attribute writer method with validation + # @param [Object] advertised_routes Value to be assigned + def advertised_routes=(advertised_routes) + if advertised_routes.nil? + fail ArgumentError, 'advertised_routes cannot be nil' + end + + @advertised_routes = advertised_routes + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -212,61 +248,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -283,24 +264,6 @@ def to_hash 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/NetworkApi/lib/pnap_network_api/models/bgp_peer_group_patch.rb b/NetworkApi/lib/pnap_network_api/models/bgp_peer_group_patch.rb index 93db2637..bf5c008f 100644 --- a/NetworkApi/lib/pnap_network_api/models/bgp_peer_group_patch.rb +++ b/NetworkApi/lib/pnap_network_api/models/bgp_peer_group_patch.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkApi # Update a BGP Peer Group. - class BgpPeerGroupPatch + class BgpPeerGroupPatch < ApiModelBase # The BGP Peer Group ASN. attr_accessor :asn @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkApi::BgpPeerGroupPatch`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::BgpPeerGroupPatch`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -92,7 +98,7 @@ def list_invalid_properties end if !@password.nil? && @password.to_s.length < 8 - invalid_properties.push('invalid value for "password", the character length must be great than or equal to 8.') + invalid_properties.push('invalid value for "password", the character length must be greater than or equal to 8.') end pattern = Regexp.new(/^[a-zA-Z0-9!@#$%^&*()\-|\[\]{}=;:<>,.]+$/) @@ -125,7 +131,7 @@ def password=(password) end if password.to_s.length < 8 - fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 8.' + fail ArgumentError, 'invalid value for "password", the character length must be greater than or equal to 8.' end pattern = Regexp.new(/^[a-zA-Z0-9!@#$%^&*()\-|\[\]{}=;:<>,.]+$/) @@ -181,61 +187,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -252,24 +203,6 @@ def to_hash 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/NetworkApi/lib/pnap_network_api/models/error.rb b/NetworkApi/lib/pnap_network_api/models/error.rb index b8b9d4df..080b5bb4 100644 --- a/NetworkApi/lib/pnap_network_api/models/error.rb +++ b/NetworkApi/lib/pnap_network_api/models/error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module NetworkApi - class Error + class Error < ApiModelBase # The description detailing the cause of the error code. attr_accessor :message @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkApi::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::Error`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -96,6 +102,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] message Value to be assigned + def message=(message) + if message.nil? + fail ArgumentError, 'message cannot be nil' + end + + @message = message + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -140,61 +156,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -211,24 +172,6 @@ def to_hash 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/NetworkApi/lib/pnap_network_api/models/network_membership.rb b/NetworkApi/lib/pnap_network_api/models/network_membership.rb index 843f25b2..b02dea19 100644 --- a/NetworkApi/lib/pnap_network_api/models/network_membership.rb +++ b/NetworkApi/lib/pnap_network_api/models/network_membership.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkApi # Resource details linked to the Network. - class NetworkMembership + class NetworkMembership < ApiModelBase # The resource identifier. attr_accessor :resource_id @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkApi::NetworkMembership`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::NetworkMembership`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -120,6 +126,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] resource_id Value to be assigned + def resource_id=(resource_id) + if resource_id.nil? + fail ArgumentError, 'resource_id cannot be nil' + end + + @resource_id = resource_id + end + + # Custom attribute writer method with validation + # @param [Object] resource_type Value to be assigned + def resource_type=(resource_type) + if resource_type.nil? + fail ArgumentError, 'resource_type cannot be nil' + end + + @resource_type = resource_type + end + + # Custom attribute writer method with validation + # @param [Object] ips Value to be assigned + def ips=(ips) + if ips.nil? + fail ArgumentError, 'ips cannot be nil' + end + + @ips = ips + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -165,61 +201,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -236,24 +217,6 @@ def to_hash 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/NetworkApi/lib/pnap_network_api/models/private_network.rb b/NetworkApi/lib/pnap_network_api/models/private_network.rb index 5ea8e309..4c35bc21 100644 --- a/NetworkApi/lib/pnap_network_api/models/private_network.rb +++ b/NetworkApi/lib/pnap_network_api/models/private_network.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkApi # Private Network details. - class PrivateNetwork + class PrivateNetwork < ApiModelBase # The private network identifier. attr_accessor :id @@ -69,9 +69,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -106,9 +111,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkApi::PrivateNetwork`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::PrivateNetwork`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -204,7 +210,7 @@ def list_invalid_properties end if @name.to_s.length < 1 - invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end if !@description.nil? && @description.to_s.length > 250 @@ -266,6 +272,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + # Custom attribute writer method with validation # @param [Object] name Value to be assigned def name=(name) @@ -278,7 +294,7 @@ def name=(name) end if name.to_s.length < 1 - fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.' end @name = name @@ -298,6 +314,86 @@ def description=(description) @description = description end + # Custom attribute writer method with validation + # @param [Object] vlan_id Value to be assigned + def vlan_id=(vlan_id) + if vlan_id.nil? + fail ArgumentError, 'vlan_id cannot be nil' + end + + @vlan_id = vlan_id + end + + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + @type = type + end + + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + + # Custom attribute writer method with validation + # @param [Object] location_default Value to be assigned + def location_default=(location_default) + if location_default.nil? + fail ArgumentError, 'location_default cannot be nil' + end + + @location_default = location_default + end + + # Custom attribute writer method with validation + # @param [Object] servers Value to be assigned + def servers=(servers) + if servers.nil? + fail ArgumentError, 'servers cannot be nil' + end + + @servers = servers + end + + # Custom attribute writer method with validation + # @param [Object] memberships Value to be assigned + def memberships=(memberships) + if memberships.nil? + fail ArgumentError, 'memberships cannot be nil' + end + + @memberships = memberships + end + + # Custom attribute writer method with validation + # @param [Object] status Value to be assigned + def status=(status) + if status.nil? + fail ArgumentError, 'status cannot be nil' + end + + @status = status + end + + # Custom attribute writer method with validation + # @param [Object] created_on Value to be assigned + def created_on=(created_on) + if created_on.nil? + fail ArgumentError, 'created_on cannot be nil' + end + + @created_on = created_on + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -352,61 +448,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -423,24 +464,6 @@ def to_hash 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/NetworkApi/lib/pnap_network_api/models/private_network_create.rb b/NetworkApi/lib/pnap_network_api/models/private_network_create.rb index 3b8b9dec..420f98ea 100644 --- a/NetworkApi/lib/pnap_network_api/models/private_network_create.rb +++ b/NetworkApi/lib/pnap_network_api/models/private_network_create.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,14 +15,14 @@ module NetworkApi # Details of Private Network to be created. - class PrivateNetworkCreate + class PrivateNetworkCreate < ApiModelBase # The friendly name of this private network. This name should be unique. attr_accessor :name # The description of this private network. attr_accessor :description - # The location of this private network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`. + # The location of this private network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`. attr_accessor :location # Identifies network as the default private network for the specified location. @@ -46,9 +46,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -77,9 +82,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkApi::PrivateNetworkCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::PrivateNetworkCreate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -129,7 +135,7 @@ def list_invalid_properties end if @name.to_s.length < 1 - invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/) @@ -183,7 +189,7 @@ def name=(name) end if name.to_s.length < 1 - fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.' end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/) @@ -208,6 +214,16 @@ def description=(description) @description = description end + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + # Custom attribute writer method with validation # @param [Object] vlan_id Value to be assigned def vlan_id=(vlan_id) @@ -274,61 +290,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -345,24 +306,6 @@ def to_hash 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/NetworkApi/lib/pnap_network_api/models/private_network_modify.rb b/NetworkApi/lib/pnap_network_api/models/private_network_modify.rb index 6619f266..19f266ee 100644 --- a/NetworkApi/lib/pnap_network_api/models/private_network_modify.rb +++ b/NetworkApi/lib/pnap_network_api/models/private_network_modify.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkApi # Object including details to be modified in the Private Network. - class PrivateNetworkModify + class PrivateNetworkModify < ApiModelBase # A friendly name given to the private network. This name should be unique. attr_accessor :name @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkApi::PrivateNetworkModify`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::PrivateNetworkModify`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -100,7 +106,7 @@ def list_invalid_properties end if @name.to_s.length < 1 - invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/) @@ -144,7 +150,7 @@ def name=(name) end if name.to_s.length < 1 - fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.' end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/) @@ -169,6 +175,16 @@ def description=(description) @description = description end + # Custom attribute writer method with validation + # @param [Object] location_default Value to be assigned + def location_default=(location_default) + if location_default.nil? + fail ArgumentError, 'location_default cannot be nil' + end + + @location_default = location_default + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -214,61 +230,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -285,24 +246,6 @@ def to_hash 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/NetworkApi/lib/pnap_network_api/models/private_network_server.rb b/NetworkApi/lib/pnap_network_api/models/private_network_server.rb index 57b08a02..3e1a5b39 100644 --- a/NetworkApi/lib/pnap_network_api/models/private_network_server.rb +++ b/NetworkApi/lib/pnap_network_api/models/private_network_server.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkApi # Server details linked to the Private Network. - class PrivateNetworkServer + class PrivateNetworkServer < ApiModelBase # The server identifier. attr_accessor :id @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkApi::PrivateNetworkServer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::PrivateNetworkServer`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -104,6 +110,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] ips Value to be assigned + def ips=(ips) + if ips.nil? + fail ArgumentError, 'ips cannot be nil' + end + + @ips = ips + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -148,61 +174,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -219,24 +190,6 @@ def to_hash 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/NetworkApi/lib/pnap_network_api/models/public_network.rb b/NetworkApi/lib/pnap_network_api/models/public_network.rb index 1070db66..a8ce6822 100644 --- a/NetworkApi/lib/pnap_network_api/models/public_network.rb +++ b/NetworkApi/lib/pnap_network_api/models/public_network.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkApi # Public Network details. - class PublicNetwork + class PublicNetwork < ApiModelBase # The public network identifier. attr_accessor :id @@ -28,7 +28,7 @@ class PublicNetwork # The friendly name of this public network. attr_accessor :name - # The location of this public network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`. + # The location of this public network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`. attr_accessor :location # The description of this public network. @@ -62,9 +62,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -97,9 +102,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkApi::PublicNetwork`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::PublicNetwork`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -191,7 +197,7 @@ def list_invalid_properties end if @name.to_s.length < 1 - invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end if @location.nil? @@ -235,6 +241,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] vlan_id Value to be assigned + def vlan_id=(vlan_id) + if vlan_id.nil? + fail ArgumentError, 'vlan_id cannot be nil' + end + + @vlan_id = vlan_id + end + + # Custom attribute writer method with validation + # @param [Object] memberships Value to be assigned + def memberships=(memberships) + if memberships.nil? + fail ArgumentError, 'memberships cannot be nil' + end + + @memberships = memberships + end + # Custom attribute writer method with validation # @param [Object] name Value to be assigned def name=(name) @@ -247,12 +283,22 @@ def name=(name) end if name.to_s.length < 1 - fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.' end @name = name end + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + # Custom attribute writer method with validation # @param [Object] description Value to be assigned def description=(description) @@ -267,6 +313,36 @@ def description=(description) @description = description end + # Custom attribute writer method with validation + # @param [Object] status Value to be assigned + def status=(status) + if status.nil? + fail ArgumentError, 'status cannot be nil' + end + + @status = status + end + + # Custom attribute writer method with validation + # @param [Object] created_on Value to be assigned + def created_on=(created_on) + if created_on.nil? + fail ArgumentError, 'created_on cannot be nil' + end + + @created_on = created_on + end + + # Custom attribute writer method with validation + # @param [Object] ip_blocks Value to be assigned + def ip_blocks=(ip_blocks) + if ip_blocks.nil? + fail ArgumentError, 'ip_blocks cannot be nil' + end + + @ip_blocks = ip_blocks + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -319,61 +395,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -390,24 +411,6 @@ def to_hash 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/NetworkApi/lib/pnap_network_api/models/public_network_create.rb b/NetworkApi/lib/pnap_network_api/models/public_network_create.rb index 1225b0b3..c26be024 100644 --- a/NetworkApi/lib/pnap_network_api/models/public_network_create.rb +++ b/NetworkApi/lib/pnap_network_api/models/public_network_create.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,14 +15,14 @@ module NetworkApi # Details of Public Network to be created. - class PublicNetworkCreate + class PublicNetworkCreate < ApiModelBase # The friendly name of this public network. This name should be unique. attr_accessor :name # The description of this public network. attr_accessor :description - # The location of this public network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`. + # The location of this public network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`. attr_accessor :location # The VLAN that will be assigned to this network. @@ -46,9 +46,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -77,9 +82,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkApi::PublicNetworkCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::PublicNetworkCreate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -129,7 +135,7 @@ def list_invalid_properties end if @name.to_s.length < 1 - invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/) @@ -188,7 +194,7 @@ def name=(name) end if name.to_s.length < 1 - fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.' end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/) @@ -213,6 +219,16 @@ def description=(description) @description = description end + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + # Custom attribute writer method with validation # @param [Object] vlan_id Value to be assigned def vlan_id=(vlan_id) @@ -293,61 +309,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -364,24 +325,6 @@ def to_hash 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/NetworkApi/lib/pnap_network_api/models/public_network_ip_block.rb b/NetworkApi/lib/pnap_network_api/models/public_network_ip_block.rb index c975f841..1963f162 100644 --- a/NetworkApi/lib/pnap_network_api/models/public_network_ip_block.rb +++ b/NetworkApi/lib/pnap_network_api/models/public_network_ip_block.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkApi # The assigned IP block to the Public Network. - class PublicNetworkIpBlock + class PublicNetworkIpBlock < ApiModelBase # The IP Block identifier. attr_accessor :id @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkApi::PublicNetworkIpBlock`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::PublicNetworkIpBlock`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -118,6 +124,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] cidr Value to be assigned + def cidr=(cidr) + if cidr.nil? + fail ArgumentError, 'cidr cannot be nil' + end + + @cidr = cidr + end + + # Custom attribute writer method with validation + # @param [Object] used_ips_count Value to be assigned + def used_ips_count=(used_ips_count) + if used_ips_count.nil? + fail ArgumentError, 'used_ips_count cannot be nil' + end + + @used_ips_count = used_ips_count + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -163,61 +199,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -234,24 +215,6 @@ def to_hash 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/NetworkApi/lib/pnap_network_api/models/public_network_ip_block_create.rb b/NetworkApi/lib/pnap_network_api/models/public_network_ip_block_create.rb index b0ed72b7..31ca0314 100644 --- a/NetworkApi/lib/pnap_network_api/models/public_network_ip_block_create.rb +++ b/NetworkApi/lib/pnap_network_api/models/public_network_ip_block_create.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkApi # Details of IP block to be assigned to Public Network. - class PublicNetworkIpBlockCreate + class PublicNetworkIpBlockCreate < ApiModelBase # The IP Block identifier. attr_accessor :id @@ -26,9 +26,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkApi::PublicNetworkIpBlockCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::PublicNetworkIpBlockCreate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -86,6 +92,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -129,61 +145,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -200,24 +161,6 @@ def to_hash 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/NetworkApi/lib/pnap_network_api/models/public_network_modify.rb b/NetworkApi/lib/pnap_network_api/models/public_network_modify.rb index 2230cabe..4597c8a1 100644 --- a/NetworkApi/lib/pnap_network_api/models/public_network_modify.rb +++ b/NetworkApi/lib/pnap_network_api/models/public_network_modify.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkApi # Public Network Modifiable Details. - class PublicNetworkModify + class PublicNetworkModify < ApiModelBase # A friendly name given to the network. This name should be unique. attr_accessor :name @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkApi::PublicNetworkModify`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkApi::PublicNetworkModify`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -92,7 +98,7 @@ def list_invalid_properties end if !@name.nil? && @name.to_s.length < 1 - invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/) @@ -130,7 +136,7 @@ def name=(name) end if name.to_s.length < 1 - fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.' end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/) @@ -200,61 +206,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -271,24 +222,6 @@ def to_hash 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/NetworkApi/lib/pnap_network_api/version.rb b/NetworkApi/lib/pnap_network_api/version.rb index 708269a4..09f6add8 100644 --- a/NetworkApi/lib/pnap_network_api/version.rb +++ b/NetworkApi/lib/pnap_network_api/version.rb @@ -6,8 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 - +Generator version: 7.20.0 =end def get_version() diff --git a/NetworkApi/pnap_network_api.gemspec b/NetworkApi/pnap_network_api.gemspec index 8f214e63..5d67ed4e 100644 --- a/NetworkApi/pnap_network_api.gemspec +++ b/NetworkApi/pnap_network_api.gemspec @@ -8,7 +8,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -19,14 +19,14 @@ Gem::Specification.new do |s| s.name = "pnap_network_api" s.version = NetworkApi::VERSION s.platform = Gem::Platform::RUBY - s.authors = ["PhoenixNAP"] + s.authors = ["OpenAPI-Generator"] s.email = ["support@phoenixnap.com"] - s.homepage = "https://phoenixnap.com/bare-metal-cloud" + s.homepage = "https://openapi-generator.tech" s.summary = "Networks API Ruby Gem" - s.description = "Networks API Ruby Gem" + s.description = "Create, list, edit and delete public/private networks with the Network API. Use public networks to place multiple servers on the same network or VLAN. Assign new servers with IP addresses from the same CIDR range. Use private networks to avoid unnecessary egress data charges. Model your networks according to your business needs.

Helpful knowledge base articles are available for multi-private backend networks, public networks and border gateway protocol peer groups.

All URLs are relative to (https://api.phoenixnap.com/networks/v1/) " s.license = "MPL-2.0" s.required_ruby_version = ">= 2.7" - s.metadata = { "source_code_uri" => "https://github.com/phoenixnap/ruby-sdk-bmc" } + s.metadata = {} s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' @@ -36,4 +36,4 @@ Gem::Specification.new do |s| s.test_files = `find spec/*`.split("\n") s.executables = [] s.require_paths = ["lib"] -end +end \ No newline at end of file diff --git a/NetworkApi/spec/api/bgp_peer_groups_api_spec.rb b/NetworkApi/spec/api/bgp_peer_groups_api_spec.rb index bdf07625..41fe352f 100644 --- a/NetworkApi/spec/api/bgp_peer_groups_api_spec.rb +++ b/NetworkApi/spec/api/bgp_peer_groups_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/NetworkApi/spec/api/private_networks_api_spec.rb b/NetworkApi/spec/api/private_networks_api_spec.rb index b28be8b3..a4bc6bd8 100644 --- a/NetworkApi/spec/api/private_networks_api_spec.rb +++ b/NetworkApi/spec/api/private_networks_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/NetworkApi/spec/api/public_networks_api_spec.rb b/NetworkApi/spec/api/public_networks_api_spec.rb index f9002c30..59bf85fa 100644 --- a/NetworkApi/spec/api/public_networks_api_spec.rb +++ b/NetworkApi/spec/api/public_networks_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/NetworkApi/spec/models/asn_details_spec.rb b/NetworkApi/spec/models/asn_details_spec.rb index 15808c61..03497f1a 100644 --- a/NetworkApi/spec/models/asn_details_spec.rb +++ b/NetworkApi/spec/models/asn_details_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkApi::AsnDetails do - let(:instance) { NetworkApi::AsnDetails.new } + #let(:instance) { NetworkApi::AsnDetails.new } describe 'test an instance of AsnDetails' do it 'should create an instance of AsnDetails' do diff --git a/NetworkApi/spec/models/bgp_ip_prefix_spec.rb b/NetworkApi/spec/models/bgp_ip_prefix_spec.rb new file mode 100644 index 00000000..f8424203 --- /dev/null +++ b/NetworkApi/spec/models/bgp_ip_prefix_spec.rb @@ -0,0 +1,54 @@ +=begin +#Networks API + +#Create, list, edit and delete public/private networks with the Network API. Use public networks to place multiple servers on the same network or VLAN. Assign new servers with IP addresses from the same CIDR range. Use private networks to avoid unnecessary egress data charges. Model your networks according to your business needs.

Helpful knowledge base articles are available for multi-private backend networks, public networks and border gateway protocol peer groups.

All URLs are relative to (https://api.phoenixnap.com/networks/v1/) + +The version of the OpenAPI document: 1.0 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for NetworkApi::BgpIpPrefix +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe NetworkApi::BgpIpPrefix do + #let(:instance) { NetworkApi::BgpIpPrefix.new } + + describe 'test an instance of BgpIpPrefix' do + it 'should create an instance of BgpIpPrefix' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(NetworkApi::BgpIpPrefix) + end + end + + describe 'test attribute "ip_allocation_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "cidr"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "ip_version"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/NetworkApi/spec/models/bgp_ipv4_prefix_spec.rb b/NetworkApi/spec/models/bgp_ipv4_prefix_spec.rb index f79fe4f4..923303ee 100644 --- a/NetworkApi/spec/models/bgp_ipv4_prefix_spec.rb +++ b/NetworkApi/spec/models/bgp_ipv4_prefix_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkApi::BgpIPv4Prefix do - let(:instance) { NetworkApi::BgpIPv4Prefix.new } + #let(:instance) { NetworkApi::BgpIPv4Prefix.new } describe 'test an instance of BgpIPv4Prefix' do it 'should create an instance of BgpIPv4Prefix' do diff --git a/NetworkApi/spec/models/bgp_peer_group_create_spec.rb b/NetworkApi/spec/models/bgp_peer_group_create_spec.rb index b0b33ae8..f39545bb 100644 --- a/NetworkApi/spec/models/bgp_peer_group_create_spec.rb +++ b/NetworkApi/spec/models/bgp_peer_group_create_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkApi::BgpPeerGroupCreate do - let(:instance) { NetworkApi::BgpPeerGroupCreate.new } + #let(:instance) { NetworkApi::BgpPeerGroupCreate.new } describe 'test an instance of BgpPeerGroupCreate' do it 'should create an instance of BgpPeerGroupCreate' do diff --git a/NetworkApi/spec/models/bgp_peer_group_patch_spec.rb b/NetworkApi/spec/models/bgp_peer_group_patch_spec.rb index 242bfad2..f4e05164 100644 --- a/NetworkApi/spec/models/bgp_peer_group_patch_spec.rb +++ b/NetworkApi/spec/models/bgp_peer_group_patch_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkApi::BgpPeerGroupPatch do - let(:instance) { NetworkApi::BgpPeerGroupPatch.new } + #let(:instance) { NetworkApi::BgpPeerGroupPatch.new } describe 'test an instance of BgpPeerGroupPatch' do it 'should create an instance of BgpPeerGroupPatch' do diff --git a/NetworkApi/spec/models/bgp_peer_group_spec.rb b/NetworkApi/spec/models/bgp_peer_group_spec.rb index a4091697..444c5387 100644 --- a/NetworkApi/spec/models/bgp_peer_group_spec.rb +++ b/NetworkApi/spec/models/bgp_peer_group_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkApi::BgpPeerGroup do - let(:instance) { NetworkApi::BgpPeerGroup.new } + #let(:instance) { NetworkApi::BgpPeerGroup.new } describe 'test an instance of BgpPeerGroup' do it 'should create an instance of BgpPeerGroup' do @@ -51,6 +51,12 @@ end end + describe 'test attribute "ip_prefixes"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + describe 'test attribute "target_asn_details"' do it 'should work' do # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ @@ -93,6 +99,12 @@ end end + describe 'test attribute "peering_loopbacks_v6"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + describe 'test attribute "keep_alive_timer_seconds"' do it 'should work' do # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ diff --git a/NetworkApi/spec/models/error_spec.rb b/NetworkApi/spec/models/error_spec.rb index e0e00955..79bbe891 100644 --- a/NetworkApi/spec/models/error_spec.rb +++ b/NetworkApi/spec/models/error_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkApi::Error do - let(:instance) { NetworkApi::Error.new } + #let(:instance) { NetworkApi::Error.new } describe 'test an instance of Error' do it 'should create an instance of Error' do diff --git a/NetworkApi/spec/models/network_membership_spec.rb b/NetworkApi/spec/models/network_membership_spec.rb index f5389010..0aaca935 100644 --- a/NetworkApi/spec/models/network_membership_spec.rb +++ b/NetworkApi/spec/models/network_membership_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkApi::NetworkMembership do - let(:instance) { NetworkApi::NetworkMembership.new } + #let(:instance) { NetworkApi::NetworkMembership.new } describe 'test an instance of NetworkMembership' do it 'should create an instance of NetworkMembership' do diff --git a/NetworkApi/spec/models/private_network_create_spec.rb b/NetworkApi/spec/models/private_network_create_spec.rb index d71c26bc..a470db74 100644 --- a/NetworkApi/spec/models/private_network_create_spec.rb +++ b/NetworkApi/spec/models/private_network_create_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkApi::PrivateNetworkCreate do - let(:instance) { NetworkApi::PrivateNetworkCreate.new } + #let(:instance) { NetworkApi::PrivateNetworkCreate.new } describe 'test an instance of PrivateNetworkCreate' do it 'should create an instance of PrivateNetworkCreate' do diff --git a/NetworkApi/spec/models/private_network_modify_spec.rb b/NetworkApi/spec/models/private_network_modify_spec.rb index e661338d..7686c86d 100644 --- a/NetworkApi/spec/models/private_network_modify_spec.rb +++ b/NetworkApi/spec/models/private_network_modify_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkApi::PrivateNetworkModify do - let(:instance) { NetworkApi::PrivateNetworkModify.new } + #let(:instance) { NetworkApi::PrivateNetworkModify.new } describe 'test an instance of PrivateNetworkModify' do it 'should create an instance of PrivateNetworkModify' do diff --git a/NetworkApi/spec/models/private_network_server_spec.rb b/NetworkApi/spec/models/private_network_server_spec.rb index f015d161..f49d15ca 100644 --- a/NetworkApi/spec/models/private_network_server_spec.rb +++ b/NetworkApi/spec/models/private_network_server_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkApi::PrivateNetworkServer do - let(:instance) { NetworkApi::PrivateNetworkServer.new } + #let(:instance) { NetworkApi::PrivateNetworkServer.new } describe 'test an instance of PrivateNetworkServer' do it 'should create an instance of PrivateNetworkServer' do diff --git a/NetworkApi/spec/models/private_network_spec.rb b/NetworkApi/spec/models/private_network_spec.rb index 0e2d00fe..e2eed4ec 100644 --- a/NetworkApi/spec/models/private_network_spec.rb +++ b/NetworkApi/spec/models/private_network_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkApi::PrivateNetwork do - let(:instance) { NetworkApi::PrivateNetwork.new } + #let(:instance) { NetworkApi::PrivateNetwork.new } describe 'test an instance of PrivateNetwork' do it 'should create an instance of PrivateNetwork' do diff --git a/NetworkApi/spec/models/public_network_create_spec.rb b/NetworkApi/spec/models/public_network_create_spec.rb index c8b9a4ad..3aee3af0 100644 --- a/NetworkApi/spec/models/public_network_create_spec.rb +++ b/NetworkApi/spec/models/public_network_create_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkApi::PublicNetworkCreate do - let(:instance) { NetworkApi::PublicNetworkCreate.new } + #let(:instance) { NetworkApi::PublicNetworkCreate.new } describe 'test an instance of PublicNetworkCreate' do it 'should create an instance of PublicNetworkCreate' do diff --git a/NetworkApi/spec/models/public_network_ip_block_create_spec.rb b/NetworkApi/spec/models/public_network_ip_block_create_spec.rb index 51a2d811..a2adbe0f 100644 --- a/NetworkApi/spec/models/public_network_ip_block_create_spec.rb +++ b/NetworkApi/spec/models/public_network_ip_block_create_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkApi::PublicNetworkIpBlockCreate do - let(:instance) { NetworkApi::PublicNetworkIpBlockCreate.new } + #let(:instance) { NetworkApi::PublicNetworkIpBlockCreate.new } describe 'test an instance of PublicNetworkIpBlockCreate' do it 'should create an instance of PublicNetworkIpBlockCreate' do diff --git a/NetworkApi/spec/models/public_network_ip_block_spec.rb b/NetworkApi/spec/models/public_network_ip_block_spec.rb index a48ee4c3..fc20ea60 100644 --- a/NetworkApi/spec/models/public_network_ip_block_spec.rb +++ b/NetworkApi/spec/models/public_network_ip_block_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkApi::PublicNetworkIpBlock do - let(:instance) { NetworkApi::PublicNetworkIpBlock.new } + #let(:instance) { NetworkApi::PublicNetworkIpBlock.new } describe 'test an instance of PublicNetworkIpBlock' do it 'should create an instance of PublicNetworkIpBlock' do diff --git a/NetworkApi/spec/models/public_network_modify_spec.rb b/NetworkApi/spec/models/public_network_modify_spec.rb index 71dba76e..a06619db 100644 --- a/NetworkApi/spec/models/public_network_modify_spec.rb +++ b/NetworkApi/spec/models/public_network_modify_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkApi::PublicNetworkModify do - let(:instance) { NetworkApi::PublicNetworkModify.new } + #let(:instance) { NetworkApi::PublicNetworkModify.new } describe 'test an instance of PublicNetworkModify' do it 'should create an instance of PublicNetworkModify' do diff --git a/NetworkApi/spec/models/public_network_spec.rb b/NetworkApi/spec/models/public_network_spec.rb index 6b165738..b586e8da 100644 --- a/NetworkApi/spec/models/public_network_spec.rb +++ b/NetworkApi/spec/models/public_network_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkApi::PublicNetwork do - let(:instance) { NetworkApi::PublicNetwork.new } + #let(:instance) { NetworkApi::PublicNetwork.new } describe 'test an instance of PublicNetwork' do it 'should create an instance of PublicNetwork' do diff --git a/NetworkApi/spec/spec_helper.rb b/NetworkApi/spec/spec_helper.rb index 550d5ea5..c8e56db6 100644 --- a/NetworkApi/spec/spec_helper.rb +++ b/NetworkApi/spec/spec_helper.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/NetworkStorageApi/VERSION b/NetworkStorageApi/VERSION index 26e33797..e0102586 100644 --- a/NetworkStorageApi/VERSION +++ b/NetworkStorageApi/VERSION @@ -1 +1 @@ -2.0.4 \ No newline at end of file +2.0.5 diff --git a/NetworkStorageApi/lib/pnap_network_storage_api.rb b/NetworkStorageApi/lib/pnap_network_storage_api.rb index fedd0add..3ae82943 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api.rb @@ -6,13 +6,14 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end # Common files require 'pnap_network_storage_api/api_client' require 'pnap_network_storage_api/api_error' +require 'pnap_network_storage_api/api_model_base' require 'pnap_network_storage_api/version' require 'pnap_network_storage_api/configuration' diff --git a/NetworkStorageApi/lib/pnap_network_storage_api/api/storage_networks_api.rb b/NetworkStorageApi/lib/pnap_network_storage_api/api/storage_networks_api.rb index 1575f107..e853a0fa 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/api/storage_networks_api.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/api/storage_networks_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -48,7 +48,7 @@ def storage_networks_get_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -111,7 +111,7 @@ def storage_networks_id_delete_with_http_info(storage_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -174,7 +174,7 @@ def storage_networks_id_get_with_http_info(storage_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -243,7 +243,7 @@ def storage_networks_id_patch_with_http_info(storage_id, storage_network_update, # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -311,7 +311,7 @@ def storage_networks_post_with_http_info(storage_network_create, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -382,7 +382,7 @@ def storage_networks_storage_network_id_volumes_get_with_http_info(storage_id, o # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -451,7 +451,7 @@ def storage_networks_storage_network_id_volumes_post_with_http_info(storage_id, # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -525,7 +525,7 @@ def storage_networks_storage_network_id_volumes_volume_id_delete_with_http_info( # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -594,7 +594,7 @@ def storage_networks_storage_network_id_volumes_volume_id_get_with_http_info(sto # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -669,7 +669,7 @@ def storage_networks_storage_network_id_volumes_volume_id_patch_with_http_info(s # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -749,7 +749,7 @@ def storage_networks_storage_network_id_volumes_volume_id_tags_put_with_http_inf # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? diff --git a/NetworkStorageApi/lib/pnap_network_storage_api/api_client.rb b/NetworkStorageApi/lib/pnap_network_storage_api/api_client.rb index f53ef1e4..51142f1b 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/api_client.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/api_client.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -52,7 +52,8 @@ def self.default # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers. def call_api(http_method, path, opts = {}) request = build_request(http_method, path, opts) - tempfile = download_file(request) if opts[:return_type] == 'File' + tempfile = nil + (download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File' response = request.run if @config.debugging @@ -191,19 +192,17 @@ def download_file(request) chunk.force_encoding(encoding) tempfile.write(chunk) end - # run the request to ensure the tempfile is created successfully before returning it - request.run - if tempfile + request.on_complete do + if !tempfile + fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + end tempfile.close @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ "will be deleted automatically with GC. It's also recommended to delete the temp file "\ "explicitly with `tempfile.delete`" - else - fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + yield tempfile if block_given? end - - tempfile end # Check if the given MIME is a JSON MIME. @@ -215,7 +214,7 @@ def download_file(request) # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type. @@ -282,9 +281,13 @@ def convert_to_type(data, return_type) data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else - # models (e.g. Pet) or oneOf + # models (e.g. Pet) or oneOf/anyOf klass = NetworkStorageApi.const_get(return_type) - klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of) + klass.build(data) + else + klass.build_from_hash(data) + end end end @@ -294,7 +297,7 @@ def convert_to_type(data, return_type) # @param [String] filename the filename to be sanitized # @return [String] the sanitized filename def sanitize_filename(filename) - filename.gsub(/.*[\/\\]/, '') + filename.split(/[\/\\]/).last end def build_request_url(path, opts = {}) @@ -394,4 +397,4 @@ def build_collection_param(param, collection_format) end end end -end +end \ No newline at end of file diff --git a/NetworkStorageApi/lib/pnap_network_storage_api/api_error.rb b/NetworkStorageApi/lib/pnap_network_storage_api/api_error.rb index f95db7d2..df6c2d10 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/api_error.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/api_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/NetworkStorageApi/lib/pnap_network_storage_api/api_model_base.rb b/NetworkStorageApi/lib/pnap_network_storage_api/api_model_base.rb new file mode 100644 index 00000000..25300c73 --- /dev/null +++ b/NetworkStorageApi/lib/pnap_network_storage_api/api_model_base.rb @@ -0,0 +1,88 @@ +=begin +#Network Storage API + +#Create, list, edit, and delete storage networks with the Network Storage API. Use storage networks to expand storage capacity on a private network.
Knowledge base articles to help you can be found here
All URLs are relative to (https://api.phoenixnap.com/network-storage/v1/) + +The version of the OpenAPI document: 1.0 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +module NetworkStorageApi + class ApiModelBase + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._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 = NetworkStorageApi.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 + + # 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/NetworkStorageApi/lib/pnap_network_storage_api/configuration.rb b/NetworkStorageApi/lib/pnap_network_storage_api/configuration.rb index 02ec654e..590ea167 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/configuration.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -79,6 +79,14 @@ class Configuration # @return [true, false] attr_accessor :debugging + # Set this to ignore operation servers for the API client. This is useful when you need to + # send requests to a different server than the one specified in the OpenAPI document. + # Will default to the base url defined in the spec but can be overridden by setting + # `scheme`, `host`, `base_path` directly. + # Default to false. + # @return [true, false] + attr_accessor :ignore_operation_servers + # Defines the logger used for debugging. # Default to `Rails.logger` (when in Rails) or logging to STDOUT. # @@ -166,6 +174,7 @@ def initialize @timeout = 0 @params_encoding = nil @debugging = false + @ignore_operation_servers = false @inject_format = false @force_ending_format = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) @@ -200,6 +209,7 @@ def base_path=(base_path) # Returns base URL for specified operation based on server settings def base_url(operation = nil) + return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers if operation_server_settings.key?(operation) then index = server_operation_index.fetch(operation, server_index) server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) diff --git a/NetworkStorageApi/lib/pnap_network_storage_api/models/error.rb b/NetworkStorageApi/lib/pnap_network_storage_api/models/error.rb index 88db33b1..86aad7f1 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/models/error.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/models/error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module NetworkStorageApi - class Error + class Error < ApiModelBase # The description detailing the cause of the error code. attr_accessor :message @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkStorageApi::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::Error`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -96,6 +102,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] message Value to be assigned + def message=(message) + if message.nil? + fail ArgumentError, 'message cannot be nil' + end + + @message = message + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -140,61 +156,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkStorageApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -211,24 +172,6 @@ def to_hash 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/NetworkStorageApi/lib/pnap_network_storage_api/models/nfs_permissions.rb b/NetworkStorageApi/lib/pnap_network_storage_api/models/nfs_permissions.rb index b6a50cf9..b7c0442a 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/models/nfs_permissions.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/models/nfs_permissions.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkStorageApi # NFS specific permissions on a volume. - class NfsPermissions + class NfsPermissions < ApiModelBase # Read/Write access. attr_accessor :read_write @@ -42,9 +42,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -72,9 +77,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkStorageApi::NfsPermissions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::NfsPermissions`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -172,61 +178,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkStorageApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -243,24 +194,6 @@ def to_hash 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/NetworkStorageApi/lib/pnap_network_storage_api/models/nfs_permissions_create.rb b/NetworkStorageApi/lib/pnap_network_storage_api/models/nfs_permissions_create.rb index e8970df5..40c75e78 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/models/nfs_permissions_create.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/models/nfs_permissions_create.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkStorageApi # NFS specific permissions on a volume. - class NfsPermissionsCreate + class NfsPermissionsCreate < ApiModelBase # Read/Write access. attr_accessor :read_write @@ -42,9 +42,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -72,9 +77,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkStorageApi::NfsPermissionsCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::NfsPermissionsCreate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -172,61 +178,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkStorageApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -243,24 +194,6 @@ def to_hash 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/NetworkStorageApi/lib/pnap_network_storage_api/models/nfs_permissions_update.rb b/NetworkStorageApi/lib/pnap_network_storage_api/models/nfs_permissions_update.rb index 8c45170e..ad637181 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/models/nfs_permissions_update.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/models/nfs_permissions_update.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkStorageApi # Update NFS specific permissions on a volume. - class NfsPermissionsUpdate + class NfsPermissionsUpdate < ApiModelBase # Read/Write access. attr_accessor :read_write @@ -42,9 +42,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -72,9 +77,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkStorageApi::NfsPermissionsUpdate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::NfsPermissionsUpdate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -172,61 +178,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkStorageApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -243,24 +194,6 @@ def to_hash 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/NetworkStorageApi/lib/pnap_network_storage_api/models/permissions.rb b/NetworkStorageApi/lib/pnap_network_storage_api/models/permissions.rb index 621b4249..7907f1cd 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/models/permissions.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/models/permissions.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkStorageApi # Permissions for a volume. - class Permissions + class Permissions < ApiModelBase attr_accessor :nfs # Attribute mapping from ruby-style variable name to JSON key. @@ -25,9 +25,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkStorageApi::Permissions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::Permissions`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -121,61 +127,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkStorageApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -192,24 +143,6 @@ def to_hash 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/NetworkStorageApi/lib/pnap_network_storage_api/models/permissions_create.rb b/NetworkStorageApi/lib/pnap_network_storage_api/models/permissions_create.rb index 76df6b9a..9c7f052f 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/models/permissions_create.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/models/permissions_create.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkStorageApi # Update permissions for a volume. - class PermissionsCreate + class PermissionsCreate < ApiModelBase attr_accessor :nfs # Attribute mapping from ruby-style variable name to JSON key. @@ -25,9 +25,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkStorageApi::PermissionsCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::PermissionsCreate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -121,61 +127,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkStorageApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -192,24 +143,6 @@ def to_hash 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/NetworkStorageApi/lib/pnap_network_storage_api/models/permissions_update.rb b/NetworkStorageApi/lib/pnap_network_storage_api/models/permissions_update.rb index 623263da..d4f8fba5 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/models/permissions_update.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/models/permissions_update.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkStorageApi # Update permissions for a volume. - class PermissionsUpdate + class PermissionsUpdate < ApiModelBase attr_accessor :nfs # Attribute mapping from ruby-style variable name to JSON key. @@ -25,9 +25,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -51,9 +56,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkStorageApi::PermissionsUpdate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::PermissionsUpdate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -121,61 +127,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkStorageApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -192,24 +143,6 @@ def to_hash 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/NetworkStorageApi/lib/pnap_network_storage_api/models/status.rb b/NetworkStorageApi/lib/pnap_network_storage_api/models/status.rb index 955dffd1..e2f64aa9 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/models/status.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/models/status.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/NetworkStorageApi/lib/pnap_network_storage_api/models/storage_network.rb b/NetworkStorageApi/lib/pnap_network_storage_api/models/storage_network.rb index 315522b4..c8c70ba0 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/models/storage_network.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/models/storage_network.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkStorageApi # Storage network. - class StorageNetwork + class StorageNetwork < ApiModelBase # Storage network ID. attr_accessor :id @@ -83,9 +83,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -118,9 +123,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkStorageApi::StorageNetwork`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::StorageNetwork`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -237,61 +243,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkStorageApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -308,24 +259,6 @@ def to_hash 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/NetworkStorageApi/lib/pnap_network_storage_api/models/storage_network_create.rb b/NetworkStorageApi/lib/pnap_network_storage_api/models/storage_network_create.rb index e9ac940e..acc3837f 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/models/storage_network_create.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/models/storage_network_create.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkStorageApi # Create Storage Network. - class StorageNetworkCreate + class StorageNetworkCreate < ApiModelBase # Storage network friendly name. attr_accessor :name @@ -42,9 +42,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -72,9 +77,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkStorageApi::StorageNetworkCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::StorageNetworkCreate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -122,7 +128,7 @@ def list_invalid_properties end if @name.to_s.length < 1 - invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/) @@ -191,7 +197,7 @@ def name=(name) end if name.to_s.length < 1 - fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.' end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/) @@ -216,6 +222,16 @@ def description=(description) @description = description end + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + # Custom attribute writer method with validation # @param [Object] volumes Value to be assigned def volumes=(volumes) @@ -299,61 +315,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkStorageApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -370,24 +331,6 @@ def to_hash 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/NetworkStorageApi/lib/pnap_network_storage_api/models/storage_network_update.rb b/NetworkStorageApi/lib/pnap_network_storage_api/models/storage_network_update.rb index 78a58316..65f070de 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/models/storage_network_update.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/models/storage_network_update.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkStorageApi # Update storage network. - class StorageNetworkUpdate + class StorageNetworkUpdate < ApiModelBase # Storage network friendly name. attr_accessor :name @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkStorageApi::StorageNetworkUpdate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::StorageNetworkUpdate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -83,7 +89,7 @@ def list_invalid_properties end if !@name.nil? && @name.to_s.length < 1 - invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/) @@ -121,7 +127,7 @@ def name=(name) end if name.to_s.length < 1 - fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.' end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/) @@ -190,61 +196,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkStorageApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -261,24 +212,6 @@ def to_hash 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/NetworkStorageApi/lib/pnap_network_storage_api/models/storage_network_volume_create.rb b/NetworkStorageApi/lib/pnap_network_storage_api/models/storage_network_volume_create.rb index 1dd594ef..f19fa990 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/models/storage_network_volume_create.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/models/storage_network_volume_create.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkStorageApi # Create Volume. - class StorageNetworkVolumeCreate + class StorageNetworkVolumeCreate < ApiModelBase # Volume friendly name. attr_accessor :name @@ -42,9 +42,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -72,9 +77,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkStorageApi::StorageNetworkVolumeCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::StorageNetworkVolumeCreate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -120,7 +126,7 @@ def list_invalid_properties end if @name.to_s.length < 1 - invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/) @@ -137,7 +143,7 @@ def list_invalid_properties end if !@path_suffix.nil? && @path_suffix.to_s.length < 0 - invalid_properties.push('invalid value for "path_suffix", the character length must be great than or equal to 0.') + invalid_properties.push('invalid value for "path_suffix", the character length must be greater than or equal to 0.') end pattern = Regexp.new(/^(\/[\w-]+)+$|^$/) @@ -185,7 +191,7 @@ def name=(name) end if name.to_s.length < 1 - fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.' end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/) @@ -222,7 +228,7 @@ def path_suffix=(path_suffix) end if path_suffix.to_s.length < 0 - fail ArgumentError, 'invalid value for "path_suffix", the character length must be great than or equal to 0.' + fail ArgumentError, 'invalid value for "path_suffix", the character length must be greater than or equal to 0.' end pattern = Regexp.new(/^(\/[\w-]+)+$|^$/) @@ -294,61 +300,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkStorageApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -365,24 +316,6 @@ def to_hash 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/NetworkStorageApi/lib/pnap_network_storage_api/models/tag_assignment.rb b/NetworkStorageApi/lib/pnap_network_storage_api/models/tag_assignment.rb index f3f89a57..3a662bb6 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/models/tag_assignment.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/models/tag_assignment.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkStorageApi # Tag assigned to resource. - class TagAssignment + class TagAssignment < ApiModelBase # The unique id of the tag. attr_accessor :id @@ -64,9 +64,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -94,9 +99,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkStorageApi::TagAssignment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::TagAssignment`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -160,6 +166,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + + # Custom attribute writer method with validation + # @param [Object] is_billing_tag Value to be assigned + def is_billing_tag=(is_billing_tag) + if is_billing_tag.nil? + fail ArgumentError, 'is_billing_tag cannot be nil' + end + + @is_billing_tag = is_billing_tag + end + # Custom attribute writer method checking allowed values (enum). # @param [Object] created_by Object to be assigned def created_by=(created_by) @@ -217,61 +253,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkStorageApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -288,24 +269,6 @@ def to_hash 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/NetworkStorageApi/lib/pnap_network_storage_api/models/tag_assignment_request.rb b/NetworkStorageApi/lib/pnap_network_storage_api/models/tag_assignment_request.rb index 155eb1e8..d5f1d1a8 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/models/tag_assignment_request.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/models/tag_assignment_request.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkStorageApi # Tag request to assign to resource. - class TagAssignmentRequest + class TagAssignmentRequest < ApiModelBase # The name of the tag. Tag names are case-sensitive, and should be composed of a maximum of 100 characters including UTF-8 Unicode letters, numbers, and the following symbols: '-', '_'. Regex: [A-zÀ-ú0-9_-]{1,100}. attr_accessor :name @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkStorageApi::TagAssignmentRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::TagAssignmentRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -95,6 +101,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -139,61 +155,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkStorageApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -210,24 +171,6 @@ def to_hash 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/NetworkStorageApi/lib/pnap_network_storage_api/models/volume.rb b/NetworkStorageApi/lib/pnap_network_storage_api/models/volume.rb index a318ac30..bbcee026 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/models/volume.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/models/volume.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkStorageApi # Volume for a storage network. - class Volume + class Volume < ApiModelBase # Volume ID. attr_accessor :id @@ -93,9 +93,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -131,9 +136,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkStorageApi::Volume`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::Volume`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -263,61 +269,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkStorageApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -334,24 +285,6 @@ def to_hash 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/NetworkStorageApi/lib/pnap_network_storage_api/models/volume_create.rb b/NetworkStorageApi/lib/pnap_network_storage_api/models/volume_create.rb index de5dec69..17b2e80b 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/models/volume_create.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/models/volume_create.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkStorageApi # Create Volume. - class VolumeCreate + class VolumeCreate < ApiModelBase # Volume friendly name. attr_accessor :name @@ -45,9 +45,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -76,9 +81,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkStorageApi::VolumeCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::VolumeCreate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -128,7 +134,7 @@ def list_invalid_properties end if @name.to_s.length < 1 - invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/) @@ -145,7 +151,7 @@ def list_invalid_properties end if !@path_suffix.nil? && @path_suffix.to_s.length < 0 - invalid_properties.push('invalid value for "path_suffix", the character length must be great than or equal to 0.') + invalid_properties.push('invalid value for "path_suffix", the character length must be greater than or equal to 0.') end pattern = Regexp.new(/^(\/[\w-]+)+$|^$/) @@ -193,7 +199,7 @@ def name=(name) end if name.to_s.length < 1 - fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.' end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/) @@ -230,7 +236,7 @@ def path_suffix=(path_suffix) end if path_suffix.to_s.length < 0 - fail ArgumentError, 'invalid value for "path_suffix", the character length must be great than or equal to 0.' + fail ArgumentError, 'invalid value for "path_suffix", the character length must be greater than or equal to 0.' end pattern = Regexp.new(/^(\/[\w-]+)+$|^$/) @@ -303,61 +309,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkStorageApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -374,24 +325,6 @@ def to_hash 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/NetworkStorageApi/lib/pnap_network_storage_api/models/volume_update.rb b/NetworkStorageApi/lib/pnap_network_storage_api/models/volume_update.rb index 22c6fb5f..9b5919fb 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/models/volume_update.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/models/volume_update.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module NetworkStorageApi # Update storage network volume. - class VolumeUpdate + class VolumeUpdate < ApiModelBase # Volume friendly name. attr_accessor :name @@ -41,9 +41,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -71,9 +76,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `NetworkStorageApi::VolumeUpdate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::VolumeUpdate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -109,7 +115,7 @@ def list_invalid_properties end if !@name.nil? && @name.to_s.length < 1 - invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/) @@ -130,7 +136,7 @@ def list_invalid_properties end if !@path_suffix.nil? && @path_suffix.to_s.length < 0 - invalid_properties.push('invalid value for "path_suffix", the character length must be great than or equal to 0.') + invalid_properties.push('invalid value for "path_suffix", the character length must be greater than or equal to 0.') end pattern = Regexp.new(/^(\/[\w-]+)+$|^$/) @@ -168,7 +174,7 @@ def name=(name) end if name.to_s.length < 1 - fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.' end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9(). -])+$/) @@ -219,7 +225,7 @@ def path_suffix=(path_suffix) end if path_suffix.to_s.length < 0 - fail ArgumentError, 'invalid value for "path_suffix", the character length must be great than or equal to 0.' + fail ArgumentError, 'invalid value for "path_suffix", the character length must be greater than or equal to 0.' end pattern = Regexp.new(/^(\/[\w-]+)+$|^$/) @@ -277,61 +283,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = NetworkStorageApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -348,24 +299,6 @@ def to_hash 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/NetworkStorageApi/lib/pnap_network_storage_api/version.rb b/NetworkStorageApi/lib/pnap_network_storage_api/version.rb index a18e60ca..8c4f5f3a 100644 --- a/NetworkStorageApi/lib/pnap_network_storage_api/version.rb +++ b/NetworkStorageApi/lib/pnap_network_storage_api/version.rb @@ -6,8 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 - +Generator version: 7.20.0 =end def get_version() diff --git a/NetworkStorageApi/pnap_network_storage_api.gemspec b/NetworkStorageApi/pnap_network_storage_api.gemspec index c215a8b4..516a3063 100644 --- a/NetworkStorageApi/pnap_network_storage_api.gemspec +++ b/NetworkStorageApi/pnap_network_storage_api.gemspec @@ -8,7 +8,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -19,14 +19,14 @@ Gem::Specification.new do |s| s.name = "pnap_network_storage_api" s.version = NetworkStorageApi::VERSION s.platform = Gem::Platform::RUBY - s.authors = ["PhoenixNAP"] + s.authors = ["OpenAPI-Generator"] s.email = ["support@phoenixnap.com"] - s.homepage = "https://phoenixnap.com/bare-metal-cloud" + s.homepage = "https://openapi-generator.tech" s.summary = "Network Storage API Ruby Gem" - s.description = "Network Storage API Ruby Gem" + s.description = "Create, list, edit, and delete storage networks with the Network Storage API. Use storage networks to expand storage capacity on a private network.
Knowledge base articles to help you can be found here
All URLs are relative to (https://api.phoenixnap.com/network-storage/v1/) " s.license = "MPL-2.0" s.required_ruby_version = ">= 2.7" - s.metadata = { "source_code_uri" => "https://github.com/phoenixnap/ruby-sdk-bmc" } + s.metadata = {} s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' @@ -36,4 +36,4 @@ Gem::Specification.new do |s| s.test_files = `find spec/*`.split("\n") s.executables = [] s.require_paths = ["lib"] -end +end \ No newline at end of file diff --git a/NetworkStorageApi/spec/api/storage_networks_api_spec.rb b/NetworkStorageApi/spec/api/storage_networks_api_spec.rb index 12d327ce..dfa8b59a 100644 --- a/NetworkStorageApi/spec/api/storage_networks_api_spec.rb +++ b/NetworkStorageApi/spec/api/storage_networks_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/NetworkStorageApi/spec/models/error_spec.rb b/NetworkStorageApi/spec/models/error_spec.rb index 561b70ec..213d10b2 100644 --- a/NetworkStorageApi/spec/models/error_spec.rb +++ b/NetworkStorageApi/spec/models/error_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkStorageApi::Error do - let(:instance) { NetworkStorageApi::Error.new } + #let(:instance) { NetworkStorageApi::Error.new } describe 'test an instance of Error' do it 'should create an instance of Error' do diff --git a/NetworkStorageApi/spec/models/nfs_permissions_create_spec.rb b/NetworkStorageApi/spec/models/nfs_permissions_create_spec.rb index d24fbdb5..46978f32 100644 --- a/NetworkStorageApi/spec/models/nfs_permissions_create_spec.rb +++ b/NetworkStorageApi/spec/models/nfs_permissions_create_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkStorageApi::NfsPermissionsCreate do - let(:instance) { NetworkStorageApi::NfsPermissionsCreate.new } + #let(:instance) { NetworkStorageApi::NfsPermissionsCreate.new } describe 'test an instance of NfsPermissionsCreate' do it 'should create an instance of NfsPermissionsCreate' do diff --git a/NetworkStorageApi/spec/models/nfs_permissions_spec.rb b/NetworkStorageApi/spec/models/nfs_permissions_spec.rb index 67d390b0..440bffb0 100644 --- a/NetworkStorageApi/spec/models/nfs_permissions_spec.rb +++ b/NetworkStorageApi/spec/models/nfs_permissions_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkStorageApi::NfsPermissions do - let(:instance) { NetworkStorageApi::NfsPermissions.new } + #let(:instance) { NetworkStorageApi::NfsPermissions.new } describe 'test an instance of NfsPermissions' do it 'should create an instance of NfsPermissions' do diff --git a/NetworkStorageApi/spec/models/nfs_permissions_update_spec.rb b/NetworkStorageApi/spec/models/nfs_permissions_update_spec.rb index c00ffde7..17ca70b3 100644 --- a/NetworkStorageApi/spec/models/nfs_permissions_update_spec.rb +++ b/NetworkStorageApi/spec/models/nfs_permissions_update_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkStorageApi::NfsPermissionsUpdate do - let(:instance) { NetworkStorageApi::NfsPermissionsUpdate.new } + #let(:instance) { NetworkStorageApi::NfsPermissionsUpdate.new } describe 'test an instance of NfsPermissionsUpdate' do it 'should create an instance of NfsPermissionsUpdate' do diff --git a/NetworkStorageApi/spec/models/permissions_create_spec.rb b/NetworkStorageApi/spec/models/permissions_create_spec.rb index 62efbf6d..bad819be 100644 --- a/NetworkStorageApi/spec/models/permissions_create_spec.rb +++ b/NetworkStorageApi/spec/models/permissions_create_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkStorageApi::PermissionsCreate do - let(:instance) { NetworkStorageApi::PermissionsCreate.new } + #let(:instance) { NetworkStorageApi::PermissionsCreate.new } describe 'test an instance of PermissionsCreate' do it 'should create an instance of PermissionsCreate' do diff --git a/NetworkStorageApi/spec/models/permissions_spec.rb b/NetworkStorageApi/spec/models/permissions_spec.rb index 6bc01e60..161ed1aa 100644 --- a/NetworkStorageApi/spec/models/permissions_spec.rb +++ b/NetworkStorageApi/spec/models/permissions_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkStorageApi::Permissions do - let(:instance) { NetworkStorageApi::Permissions.new } + #let(:instance) { NetworkStorageApi::Permissions.new } describe 'test an instance of Permissions' do it 'should create an instance of Permissions' do diff --git a/NetworkStorageApi/spec/models/permissions_update_spec.rb b/NetworkStorageApi/spec/models/permissions_update_spec.rb index 2ac5e5a7..77def49c 100644 --- a/NetworkStorageApi/spec/models/permissions_update_spec.rb +++ b/NetworkStorageApi/spec/models/permissions_update_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkStorageApi::PermissionsUpdate do - let(:instance) { NetworkStorageApi::PermissionsUpdate.new } + #let(:instance) { NetworkStorageApi::PermissionsUpdate.new } describe 'test an instance of PermissionsUpdate' do it 'should create an instance of PermissionsUpdate' do diff --git a/NetworkStorageApi/spec/models/status_spec.rb b/NetworkStorageApi/spec/models/status_spec.rb index 09c1b95d..e2564569 100644 --- a/NetworkStorageApi/spec/models/status_spec.rb +++ b/NetworkStorageApi/spec/models/status_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkStorageApi::Status do - let(:instance) { NetworkStorageApi::Status.new } + #let(:instance) { NetworkStorageApi::Status.new } describe 'test an instance of Status' do it 'should create an instance of Status' do diff --git a/NetworkStorageApi/spec/models/storage_network_create_spec.rb b/NetworkStorageApi/spec/models/storage_network_create_spec.rb index 8a999e4d..fe705172 100644 --- a/NetworkStorageApi/spec/models/storage_network_create_spec.rb +++ b/NetworkStorageApi/spec/models/storage_network_create_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkStorageApi::StorageNetworkCreate do - let(:instance) { NetworkStorageApi::StorageNetworkCreate.new } + #let(:instance) { NetworkStorageApi::StorageNetworkCreate.new } describe 'test an instance of StorageNetworkCreate' do it 'should create an instance of StorageNetworkCreate' do diff --git a/NetworkStorageApi/spec/models/storage_network_spec.rb b/NetworkStorageApi/spec/models/storage_network_spec.rb index ed4132ff..7532aa8e 100644 --- a/NetworkStorageApi/spec/models/storage_network_spec.rb +++ b/NetworkStorageApi/spec/models/storage_network_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkStorageApi::StorageNetwork do - let(:instance) { NetworkStorageApi::StorageNetwork.new } + #let(:instance) { NetworkStorageApi::StorageNetwork.new } describe 'test an instance of StorageNetwork' do it 'should create an instance of StorageNetwork' do diff --git a/NetworkStorageApi/spec/models/storage_network_update_spec.rb b/NetworkStorageApi/spec/models/storage_network_update_spec.rb index 1405ca10..ce7de78f 100644 --- a/NetworkStorageApi/spec/models/storage_network_update_spec.rb +++ b/NetworkStorageApi/spec/models/storage_network_update_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkStorageApi::StorageNetworkUpdate do - let(:instance) { NetworkStorageApi::StorageNetworkUpdate.new } + #let(:instance) { NetworkStorageApi::StorageNetworkUpdate.new } describe 'test an instance of StorageNetworkUpdate' do it 'should create an instance of StorageNetworkUpdate' do diff --git a/NetworkStorageApi/spec/models/storage_network_volume_create_spec.rb b/NetworkStorageApi/spec/models/storage_network_volume_create_spec.rb index 3f1005c2..de67939f 100644 --- a/NetworkStorageApi/spec/models/storage_network_volume_create_spec.rb +++ b/NetworkStorageApi/spec/models/storage_network_volume_create_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkStorageApi::StorageNetworkVolumeCreate do - let(:instance) { NetworkStorageApi::StorageNetworkVolumeCreate.new } + #let(:instance) { NetworkStorageApi::StorageNetworkVolumeCreate.new } describe 'test an instance of StorageNetworkVolumeCreate' do it 'should create an instance of StorageNetworkVolumeCreate' do diff --git a/NetworkStorageApi/spec/models/tag_assignment_request_spec.rb b/NetworkStorageApi/spec/models/tag_assignment_request_spec.rb index 872fae14..587a293b 100644 --- a/NetworkStorageApi/spec/models/tag_assignment_request_spec.rb +++ b/NetworkStorageApi/spec/models/tag_assignment_request_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkStorageApi::TagAssignmentRequest do - let(:instance) { NetworkStorageApi::TagAssignmentRequest.new } + #let(:instance) { NetworkStorageApi::TagAssignmentRequest.new } describe 'test an instance of TagAssignmentRequest' do it 'should create an instance of TagAssignmentRequest' do diff --git a/NetworkStorageApi/spec/models/tag_assignment_spec.rb b/NetworkStorageApi/spec/models/tag_assignment_spec.rb index e2e605f1..468bcbb0 100644 --- a/NetworkStorageApi/spec/models/tag_assignment_spec.rb +++ b/NetworkStorageApi/spec/models/tag_assignment_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkStorageApi::TagAssignment do - let(:instance) { NetworkStorageApi::TagAssignment.new } + #let(:instance) { NetworkStorageApi::TagAssignment.new } describe 'test an instance of TagAssignment' do it 'should create an instance of TagAssignment' do diff --git a/NetworkStorageApi/spec/models/volume_create_spec.rb b/NetworkStorageApi/spec/models/volume_create_spec.rb index 3516ea48..e4c2fe7c 100644 --- a/NetworkStorageApi/spec/models/volume_create_spec.rb +++ b/NetworkStorageApi/spec/models/volume_create_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkStorageApi::VolumeCreate do - let(:instance) { NetworkStorageApi::VolumeCreate.new } + #let(:instance) { NetworkStorageApi::VolumeCreate.new } describe 'test an instance of VolumeCreate' do it 'should create an instance of VolumeCreate' do diff --git a/NetworkStorageApi/spec/models/volume_spec.rb b/NetworkStorageApi/spec/models/volume_spec.rb index de68cbba..113d20aa 100644 --- a/NetworkStorageApi/spec/models/volume_spec.rb +++ b/NetworkStorageApi/spec/models/volume_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkStorageApi::Volume do - let(:instance) { NetworkStorageApi::Volume.new } + #let(:instance) { NetworkStorageApi::Volume.new } describe 'test an instance of Volume' do it 'should create an instance of Volume' do diff --git a/NetworkStorageApi/spec/models/volume_update_spec.rb b/NetworkStorageApi/spec/models/volume_update_spec.rb index 9a5c139b..803170ae 100644 --- a/NetworkStorageApi/spec/models/volume_update_spec.rb +++ b/NetworkStorageApi/spec/models/volume_update_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe NetworkStorageApi::VolumeUpdate do - let(:instance) { NetworkStorageApi::VolumeUpdate.new } + #let(:instance) { NetworkStorageApi::VolumeUpdate.new } describe 'test an instance of VolumeUpdate' do it 'should create an instance of VolumeUpdate' do diff --git a/NetworkStorageApi/spec/spec_helper.rb b/NetworkStorageApi/spec/spec_helper.rb index 47881e8e..d5488b4b 100644 --- a/NetworkStorageApi/spec/spec_helper.rb +++ b/NetworkStorageApi/spec/spec_helper.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/PaymentsApi/VERSION b/PaymentsApi/VERSION index a6a3a43c..90a27f9c 100644 --- a/PaymentsApi/VERSION +++ b/PaymentsApi/VERSION @@ -1 +1 @@ -1.0.4 \ No newline at end of file +1.0.5 diff --git a/PaymentsApi/lib/pnap_payments_api.rb b/PaymentsApi/lib/pnap_payments_api.rb index c84c41d1..717deeee 100644 --- a/PaymentsApi/lib/pnap_payments_api.rb +++ b/PaymentsApi/lib/pnap_payments_api.rb @@ -6,13 +6,14 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end # Common files require 'pnap_payments_api/api_client' require 'pnap_payments_api/api_error' +require 'pnap_payments_api/api_model_base' require 'pnap_payments_api/version' require 'pnap_payments_api/configuration' diff --git a/PaymentsApi/lib/pnap_payments_api/api/transactions_api.rb b/PaymentsApi/lib/pnap_payments_api/api/transactions_api.rb index 92b651e3..494d6416 100644 --- a/PaymentsApi/lib/pnap_payments_api/api/transactions_api.rb +++ b/PaymentsApi/lib/pnap_payments_api/api/transactions_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -51,7 +51,7 @@ def transaction_id_get_with_http_info(transaction_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -146,7 +146,7 @@ def transactions_get_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} diff --git a/PaymentsApi/lib/pnap_payments_api/api_client.rb b/PaymentsApi/lib/pnap_payments_api/api_client.rb index 272abe6f..15d351da 100644 --- a/PaymentsApi/lib/pnap_payments_api/api_client.rb +++ b/PaymentsApi/lib/pnap_payments_api/api_client.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -52,7 +52,8 @@ def self.default # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers. def call_api(http_method, path, opts = {}) request = build_request(http_method, path, opts) - tempfile = download_file(request) if opts[:return_type] == 'File' + tempfile = nil + (download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File' response = request.run if @config.debugging @@ -191,19 +192,17 @@ def download_file(request) chunk.force_encoding(encoding) tempfile.write(chunk) end - # run the request to ensure the tempfile is created successfully before returning it - request.run - if tempfile + request.on_complete do + if !tempfile + fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + end tempfile.close @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ "will be deleted automatically with GC. It's also recommended to delete the temp file "\ "explicitly with `tempfile.delete`" - else - fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + yield tempfile if block_given? end - - tempfile end # Check if the given MIME is a JSON MIME. @@ -215,7 +214,7 @@ def download_file(request) # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type. @@ -282,9 +281,13 @@ def convert_to_type(data, return_type) data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else - # models (e.g. Pet) or oneOf + # models (e.g. Pet) or oneOf/anyOf klass = PaymentsApi.const_get(return_type) - klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of) + klass.build(data) + else + klass.build_from_hash(data) + end end end @@ -294,7 +297,7 @@ def convert_to_type(data, return_type) # @param [String] filename the filename to be sanitized # @return [String] the sanitized filename def sanitize_filename(filename) - filename.gsub(/.*[\/\\]/, '') + filename.split(/[\/\\]/).last end def build_request_url(path, opts = {}) @@ -394,4 +397,4 @@ def build_collection_param(param, collection_format) end end end -end +end \ No newline at end of file diff --git a/PaymentsApi/lib/pnap_payments_api/api_error.rb b/PaymentsApi/lib/pnap_payments_api/api_error.rb index 12b4dcb1..678302cf 100644 --- a/PaymentsApi/lib/pnap_payments_api/api_error.rb +++ b/PaymentsApi/lib/pnap_payments_api/api_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/PaymentsApi/lib/pnap_payments_api/api_model_base.rb b/PaymentsApi/lib/pnap_payments_api/api_model_base.rb new file mode 100644 index 00000000..15d79b05 --- /dev/null +++ b/PaymentsApi/lib/pnap_payments_api/api_model_base.rb @@ -0,0 +1,88 @@ +=begin +#Payments API + +#Payments API are currently designed to fetch Transactions only. + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +module PaymentsApi + class ApiModelBase + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._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 = PaymentsApi.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 + + # 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/PaymentsApi/lib/pnap_payments_api/configuration.rb b/PaymentsApi/lib/pnap_payments_api/configuration.rb index 6a0a8887..e69015a8 100644 --- a/PaymentsApi/lib/pnap_payments_api/configuration.rb +++ b/PaymentsApi/lib/pnap_payments_api/configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -79,6 +79,14 @@ class Configuration # @return [true, false] attr_accessor :debugging + # Set this to ignore operation servers for the API client. This is useful when you need to + # send requests to a different server than the one specified in the OpenAPI document. + # Will default to the base url defined in the spec but can be overridden by setting + # `scheme`, `host`, `base_path` directly. + # Default to false. + # @return [true, false] + attr_accessor :ignore_operation_servers + # Defines the logger used for debugging. # Default to `Rails.logger` (when in Rails) or logging to STDOUT. # @@ -166,6 +174,7 @@ def initialize @timeout = 0 @params_encoding = nil @debugging = false + @ignore_operation_servers = false @inject_format = false @force_ending_format = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) @@ -200,6 +209,7 @@ def base_path=(base_path) # Returns base URL for specified operation based on server settings def base_url(operation = nil) + return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers if operation_server_settings.key?(operation) then index = server_operation_index.fetch(operation, server_index) server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) diff --git a/PaymentsApi/lib/pnap_payments_api/models/card_payment_method_details.rb b/PaymentsApi/lib/pnap_payments_api/models/card_payment_method_details.rb index 4bf84b18..f98a6cc5 100644 --- a/PaymentsApi/lib/pnap_payments_api/models/card_payment_method_details.rb +++ b/PaymentsApi/lib/pnap_payments_api/models/card_payment_method_details.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module PaymentsApi # Card payment details of a transaction. - class CardPaymentMethodDetails + class CardPaymentMethodDetails < ApiModelBase # The Card Type. Supported Card Types include: VISA, MASTERCARD, DISCOVER, JCB & AMEX. attr_accessor :card_type @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `PaymentsApi::CardPaymentMethodDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `PaymentsApi::CardPaymentMethodDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -108,6 +114,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] card_type Value to be assigned + def card_type=(card_type) + if card_type.nil? + fail ArgumentError, 'card_type cannot be nil' + end + + @card_type = card_type + end + # Custom attribute writer method with validation # @param [Object] last_four_digits Value to be assigned def last_four_digits=(last_four_digits) @@ -167,61 +183,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = PaymentsApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -238,24 +199,6 @@ def to_hash 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/PaymentsApi/lib/pnap_payments_api/models/error.rb b/PaymentsApi/lib/pnap_payments_api/models/error.rb index af881b5e..395055f0 100644 --- a/PaymentsApi/lib/pnap_payments_api/models/error.rb +++ b/PaymentsApi/lib/pnap_payments_api/models/error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module PaymentsApi - class Error + class Error < ApiModelBase # The description detailing the cause of the error code. attr_accessor :message @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `PaymentsApi::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `PaymentsApi::Error`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -96,6 +102,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] message Value to be assigned + def message=(message) + if message.nil? + fail ArgumentError, 'message cannot be nil' + end + + @message = message + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -140,61 +156,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = PaymentsApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -211,24 +172,6 @@ def to_hash 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/PaymentsApi/lib/pnap_payments_api/models/paginated_response.rb b/PaymentsApi/lib/pnap_payments_api/models/paginated_response.rb index 01c1515d..9aef13be 100644 --- a/PaymentsApi/lib/pnap_payments_api/models/paginated_response.rb +++ b/PaymentsApi/lib/pnap_payments_api/models/paginated_response.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module PaymentsApi - class PaginatedResponse + class PaginatedResponse < ApiModelBase # Maximum number of items in the page (actual returned length can be less). attr_accessor :limit @@ -33,9 +33,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -61,9 +66,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `PaymentsApi::PaginatedResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `PaymentsApi::PaginatedResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -117,6 +123,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] limit Value to be assigned + def limit=(limit) + if limit.nil? + fail ArgumentError, 'limit cannot be nil' + end + + @limit = limit + end + + # Custom attribute writer method with validation + # @param [Object] offset Value to be assigned + def offset=(offset) + if offset.nil? + fail ArgumentError, 'offset cannot be nil' + end + + @offset = offset + end + + # Custom attribute writer method with validation + # @param [Object] total Value to be assigned + def total=(total) + if total.nil? + fail ArgumentError, 'total cannot be nil' + end + + @total = total + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -162,61 +198,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = PaymentsApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -233,24 +214,6 @@ def to_hash 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/PaymentsApi/lib/pnap_payments_api/models/paginated_transactions.rb b/PaymentsApi/lib/pnap_payments_api/models/paginated_transactions.rb index 1fb9a688..90138051 100644 --- a/PaymentsApi/lib/pnap_payments_api/models/paginated_transactions.rb +++ b/PaymentsApi/lib/pnap_payments_api/models/paginated_transactions.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module PaymentsApi - class PaginatedTransactions + class PaginatedTransactions < ApiModelBase # Maximum number of items in the page (actual returned length can be less). attr_accessor :limit @@ -36,9 +36,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -72,9 +77,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `PaymentsApi::PaginatedTransactions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `PaymentsApi::PaginatedTransactions`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -141,6 +147,46 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] limit Value to be assigned + def limit=(limit) + if limit.nil? + fail ArgumentError, 'limit cannot be nil' + end + + @limit = limit + end + + # Custom attribute writer method with validation + # @param [Object] offset Value to be assigned + def offset=(offset) + if offset.nil? + fail ArgumentError, 'offset cannot be nil' + end + + @offset = offset + end + + # Custom attribute writer method with validation + # @param [Object] total Value to be assigned + def total=(total) + if total.nil? + fail ArgumentError, 'total cannot be nil' + end + + @total = total + end + + # Custom attribute writer method with validation + # @param [Object] results Value to be assigned + def results=(results) + if results.nil? + fail ArgumentError, 'results cannot be nil' + end + + @results = results + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -187,61 +233,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = PaymentsApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -258,24 +249,6 @@ def to_hash 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/PaymentsApi/lib/pnap_payments_api/models/transaction.rb b/PaymentsApi/lib/pnap_payments_api/models/transaction.rb index 2555a427..5aa9d91a 100644 --- a/PaymentsApi/lib/pnap_payments_api/models/transaction.rb +++ b/PaymentsApi/lib/pnap_payments_api/models/transaction.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module PaymentsApi # Transaction response model. - class Transaction + class Transaction < ApiModelBase # The Transaction ID. attr_accessor :id @@ -52,9 +52,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -85,9 +90,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `PaymentsApi::Transaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `PaymentsApi::Transaction`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -189,6 +195,76 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] status Value to be assigned + def status=(status) + if status.nil? + fail ArgumentError, 'status cannot be nil' + end + + @status = status + end + + # Custom attribute writer method with validation + # @param [Object] amount Value to be assigned + def amount=(amount) + if amount.nil? + fail ArgumentError, 'amount cannot be nil' + end + + @amount = amount + end + + # Custom attribute writer method with validation + # @param [Object] currency Value to be assigned + def currency=(currency) + if currency.nil? + fail ArgumentError, 'currency cannot be nil' + end + + @currency = currency + end + + # Custom attribute writer method with validation + # @param [Object] date Value to be assigned + def date=(date) + if date.nil? + fail ArgumentError, 'date cannot be nil' + end + + @date = date + end + + # Custom attribute writer method with validation + # @param [Object] metadata Value to be assigned + def metadata=(metadata) + if metadata.nil? + fail ArgumentError, 'metadata cannot be nil' + end + + @metadata = metadata + end + + # Custom attribute writer method with validation + # @param [Object] card_payment_method_details Value to be assigned + def card_payment_method_details=(card_payment_method_details) + if card_payment_method_details.nil? + fail ArgumentError, 'card_payment_method_details cannot be nil' + end + + @card_payment_method_details = card_payment_method_details + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -239,61 +315,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = PaymentsApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -310,24 +331,6 @@ def to_hash 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/PaymentsApi/lib/pnap_payments_api/models/transaction_metadata.rb b/PaymentsApi/lib/pnap_payments_api/models/transaction_metadata.rb index 1257e7f7..8a798d27 100644 --- a/PaymentsApi/lib/pnap_payments_api/models/transaction_metadata.rb +++ b/PaymentsApi/lib/pnap_payments_api/models/transaction_metadata.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module PaymentsApi # Transaction's metadata. - class TransactionMetadata + class TransactionMetadata < ApiModelBase # The Invoice ID that this transaction pertains to. attr_accessor :invoice_id @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `PaymentsApi::TransactionMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `PaymentsApi::TransactionMetadata`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -111,6 +117,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] invoice_id Value to be assigned + def invoice_id=(invoice_id) + if invoice_id.nil? + fail ArgumentError, 'invoice_id cannot be nil' + end + + @invoice_id = invoice_id + end + + # Custom attribute writer method with validation + # @param [Object] is_auto_charge Value to be assigned + def is_auto_charge=(is_auto_charge) + if is_auto_charge.nil? + fail ArgumentError, 'is_auto_charge cannot be nil' + end + + @is_auto_charge = is_auto_charge + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -156,61 +182,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = PaymentsApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -227,24 +198,6 @@ def to_hash 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/PaymentsApi/lib/pnap_payments_api/version.rb b/PaymentsApi/lib/pnap_payments_api/version.rb index 6bef2b24..76b030c2 100644 --- a/PaymentsApi/lib/pnap_payments_api/version.rb +++ b/PaymentsApi/lib/pnap_payments_api/version.rb @@ -6,8 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 - +Generator version: 7.20.0 =end def get_version() diff --git a/PaymentsApi/pnap_payments_api.gemspec b/PaymentsApi/pnap_payments_api.gemspec index fc14735f..5e3e36c3 100644 --- a/PaymentsApi/pnap_payments_api.gemspec +++ b/PaymentsApi/pnap_payments_api.gemspec @@ -8,7 +8,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -19,14 +19,14 @@ Gem::Specification.new do |s| s.name = "pnap_payments_api" s.version = PaymentsApi::VERSION s.platform = Gem::Platform::RUBY - s.authors = ["PhoenixNAP"] + s.authors = ["OpenAPI-Generator"] s.email = ["support@phoenixnap.com"] - s.homepage = "https://phoenixnap.com/bare-metal-cloud" + s.homepage = "https://openapi-generator.tech" s.summary = "Payments API Ruby Gem" - s.description = "Payments API Ruby Gem" + s.description = "Payments API are currently designed to fetch Transactions only." s.license = "MPL-2.0" s.required_ruby_version = ">= 2.7" - s.metadata = { "source_code_uri" => "https://github.com/phoenixnap/ruby-sdk-bmc" } + s.metadata = {} s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' @@ -36,4 +36,4 @@ Gem::Specification.new do |s| s.test_files = `find spec/*`.split("\n") s.executables = [] s.require_paths = ["lib"] -end +end \ No newline at end of file diff --git a/PaymentsApi/spec/api/transactions_api_spec.rb b/PaymentsApi/spec/api/transactions_api_spec.rb index a47fbb31..ed5425ed 100644 --- a/PaymentsApi/spec/api/transactions_api_spec.rb +++ b/PaymentsApi/spec/api/transactions_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/PaymentsApi/spec/models/card_payment_method_details_spec.rb b/PaymentsApi/spec/models/card_payment_method_details_spec.rb index 9ec781af..a0bb3712 100644 --- a/PaymentsApi/spec/models/card_payment_method_details_spec.rb +++ b/PaymentsApi/spec/models/card_payment_method_details_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe PaymentsApi::CardPaymentMethodDetails do - let(:instance) { PaymentsApi::CardPaymentMethodDetails.new } + #let(:instance) { PaymentsApi::CardPaymentMethodDetails.new } describe 'test an instance of CardPaymentMethodDetails' do it 'should create an instance of CardPaymentMethodDetails' do diff --git a/PaymentsApi/spec/models/error_spec.rb b/PaymentsApi/spec/models/error_spec.rb index ac5db32b..c7d22055 100644 --- a/PaymentsApi/spec/models/error_spec.rb +++ b/PaymentsApi/spec/models/error_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe PaymentsApi::Error do - let(:instance) { PaymentsApi::Error.new } + #let(:instance) { PaymentsApi::Error.new } describe 'test an instance of Error' do it 'should create an instance of Error' do diff --git a/PaymentsApi/spec/models/paginated_response_spec.rb b/PaymentsApi/spec/models/paginated_response_spec.rb index d044f456..cdf10899 100644 --- a/PaymentsApi/spec/models/paginated_response_spec.rb +++ b/PaymentsApi/spec/models/paginated_response_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe PaymentsApi::PaginatedResponse do - let(:instance) { PaymentsApi::PaginatedResponse.new } + #let(:instance) { PaymentsApi::PaginatedResponse.new } describe 'test an instance of PaginatedResponse' do it 'should create an instance of PaginatedResponse' do diff --git a/PaymentsApi/spec/models/paginated_transactions_spec.rb b/PaymentsApi/spec/models/paginated_transactions_spec.rb index 3c1138a1..b8422047 100644 --- a/PaymentsApi/spec/models/paginated_transactions_spec.rb +++ b/PaymentsApi/spec/models/paginated_transactions_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe PaymentsApi::PaginatedTransactions do - let(:instance) { PaymentsApi::PaginatedTransactions.new } + #let(:instance) { PaymentsApi::PaginatedTransactions.new } describe 'test an instance of PaginatedTransactions' do it 'should create an instance of PaginatedTransactions' do diff --git a/PaymentsApi/spec/models/transaction_metadata_spec.rb b/PaymentsApi/spec/models/transaction_metadata_spec.rb index 4d03ef6f..ec46448b 100644 --- a/PaymentsApi/spec/models/transaction_metadata_spec.rb +++ b/PaymentsApi/spec/models/transaction_metadata_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe PaymentsApi::TransactionMetadata do - let(:instance) { PaymentsApi::TransactionMetadata.new } + #let(:instance) { PaymentsApi::TransactionMetadata.new } describe 'test an instance of TransactionMetadata' do it 'should create an instance of TransactionMetadata' do diff --git a/PaymentsApi/spec/models/transaction_spec.rb b/PaymentsApi/spec/models/transaction_spec.rb index 0d37adb7..f071c46e 100644 --- a/PaymentsApi/spec/models/transaction_spec.rb +++ b/PaymentsApi/spec/models/transaction_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe PaymentsApi::Transaction do - let(:instance) { PaymentsApi::Transaction.new } + #let(:instance) { PaymentsApi::Transaction.new } describe 'test an instance of Transaction' do it 'should create an instance of Transaction' do diff --git a/PaymentsApi/spec/spec_helper.rb b/PaymentsApi/spec/spec_helper.rb index abca99f7..0c13dc67 100644 --- a/PaymentsApi/spec/spec_helper.rb +++ b/PaymentsApi/spec/spec_helper.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/RancherApi/VERSION b/RancherApi/VERSION index 26e33797..e0102586 100644 --- a/RancherApi/VERSION +++ b/RancherApi/VERSION @@ -1 +1 @@ -2.0.4 \ No newline at end of file +2.0.5 diff --git a/RancherApi/docs/Cluster.md b/RancherApi/docs/Cluster.md index 2e5657b0..d4fb329e 100644 --- a/RancherApi/docs/Cluster.md +++ b/RancherApi/docs/Cluster.md @@ -7,7 +7,7 @@ | **id** | **String** | (Read-only) The Cluster identifier. | [optional][readonly] | | **name** | **String** | Cluster name. This field is autogenerated if not provided. | [optional] | | **description** | **String** | Cluster description. | [optional] | -| **location** | **String** | Deployment location. Cannot be changed once a cluster is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. | | +| **location** | **String** | Deployment location. Cannot be changed once a cluster is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. | | | **initial_cluster_version** | **String** | (Read-only) The Rancher version that was installed on the cluster during the first creation process. | [optional][readonly] | | **node_pools** | [**Array<NodePool>**](NodePool.md) | The node pools associated with the cluster. | [optional] | | **configuration** | [**RancherClusterConfig**](RancherClusterConfig.md) | | [optional] | diff --git a/RancherApi/docs/ClustersApi.md b/RancherApi/docs/ClustersApi.md index fb830118..2eaf47e0 100644 --- a/RancherApi/docs/ClustersApi.md +++ b/RancherApi/docs/ClustersApi.md @@ -220,7 +220,7 @@ end Create a Rancher Server Deployment. -Create a Rancher Server Deployment as described in Rancher Docs Architecture. Rancher Server allows the creation, import and management of multiple Downstream User Kubernetes Clusters. This is not a Downstream User Cluster. Knowledge base article to help you can be found here. +Create a Rancher Server Deployment as described in Rancher Docs Architecture. Rancher Server allows the creation, import and management of multiple Downstream User Kubernetes Clusters. This is not a Downstream User Cluster. Knowledge base article to help you can be found here. ### Examples diff --git a/RancherApi/docs/WorkloadClusterConfig.md b/RancherApi/docs/WorkloadClusterConfig.md index 3197c59f..374c5e97 100644 --- a/RancherApi/docs/WorkloadClusterConfig.md +++ b/RancherApi/docs/WorkloadClusterConfig.md @@ -6,8 +6,8 @@ | ---- | ---- | ----------- | ----- | | **name** | **String** | The name of the workload cluster. This field is autogenerated if not provided. | [optional] | | **server_count** | **Integer** | Number of configured servers. Currently only server counts of 1 and 3 are possible. | [optional][default to 1] | -| **server_type** | **String** | Node server type. Cannot be changed once the cluster is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c1.small`, `d1.c2.small`, `d1.c3.small`, `d1.c4.small`, `d1.c1.medium`, `d1.c2.medium`, `d1.c3.medium`, `d1.c4.medium`, `d1.c1.large`, `d1.c2.large`, `d1.c3.large`, `d1.c4.large`, `d1.m1.medium`, `d1.m2.medium`, `d1.m3.medium`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge` or `d3.g2.c3.xlarge`. | [default to 's0.d1.small'] | -| **location** | **String** | Workload cluster location. Cannot be changed once cluster is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. | | +| **server_type** | **String** | Node server type. Cannot be changed once the cluster is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c4.small`, `d1.c4.medium`, `d1.c4.large`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge` or `d3.g2.c3.xlarge`. | [default to 's0.d1.small'] | +| **location** | **String** | Workload cluster location. Cannot be changed once cluster is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. | | ## Example diff --git a/RancherApi/lib/pnap_rancher_api.rb b/RancherApi/lib/pnap_rancher_api.rb index bc3be0af..e47f4608 100644 --- a/RancherApi/lib/pnap_rancher_api.rb +++ b/RancherApi/lib/pnap_rancher_api.rb @@ -6,13 +6,14 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end # Common files require 'pnap_rancher_api/api_client' require 'pnap_rancher_api/api_error' +require 'pnap_rancher_api/api_model_base' require 'pnap_rancher_api/version' require 'pnap_rancher_api/configuration' diff --git a/RancherApi/lib/pnap_rancher_api/api/clusters_api.rb b/RancherApi/lib/pnap_rancher_api/api/clusters_api.rb index fa4a8244..7e13e0e4 100644 --- a/RancherApi/lib/pnap_rancher_api/api/clusters_api.rb +++ b/RancherApi/lib/pnap_rancher_api/api/clusters_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -45,7 +45,7 @@ def clusters_get_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -108,7 +108,7 @@ def clusters_id_delete_with_http_info(id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -171,7 +171,7 @@ def clusters_id_get_with_http_info(id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -203,7 +203,7 @@ def clusters_id_get_with_http_info(id, opts = {}) end # Create a Rancher Server Deployment. - # Create a Rancher Server Deployment as described in Rancher Docs Architecture. Rancher Server allows the creation, import and management of multiple Downstream User Kubernetes Clusters. This is not a Downstream User Cluster. Knowledge base article to help you can be found here. + # Create a Rancher Server Deployment as described in Rancher Docs Architecture. Rancher Server allows the creation, import and management of multiple Downstream User Kubernetes Clusters. This is not a Downstream User Cluster. Knowledge base article to help you can be found here. # @param cluster [Cluster] # @param [Hash] opts the optional parameters # @return [Cluster] @@ -213,7 +213,7 @@ def clusters_post(cluster, opts = {}) end # Create a Rancher Server Deployment. - # Create a Rancher Server Deployment as described in <a href='https://ranchermanager.docs.rancher.com/v2.6/reference-guides/rancher-manager-architecture#rancher-server-architecture' target='_blank'>Rancher Docs Architecture</a>. Rancher Server allows the creation, import and management of multiple Downstream User Kubernetes Clusters. <b>This is not a Downstream User Cluster</b>. Knowledge base article to help you can be found <a href='https://phoenixnap.com/kb/bmc-rancher-workload-cluster#ftoc-heading-5' target='_blank'>here</a>. + # Create a Rancher Server Deployment as described in <a href='https://ranchermanager.docs.rancher.com/reference-guides/rancher-manager-architecture' target='_blank'>Rancher Docs Architecture</a>. Rancher Server allows the creation, import and management of multiple Downstream User Kubernetes Clusters. <b>This is not a Downstream User Cluster</b>. Knowledge base article to help you can be found <a href='https://phoenixnap.com/kb/bmc-rancher-workload-cluster#ftoc-heading-5' target='_blank'>here</a>. # @param cluster [Cluster] # @param [Hash] opts the optional parameters # @return [Array<(Cluster, Integer, Hash)>] Cluster data, response status code and response headers @@ -234,7 +234,7 @@ def clusters_post_with_http_info(cluster, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? diff --git a/RancherApi/lib/pnap_rancher_api/api_client.rb b/RancherApi/lib/pnap_rancher_api/api_client.rb index f90895a8..72554574 100644 --- a/RancherApi/lib/pnap_rancher_api/api_client.rb +++ b/RancherApi/lib/pnap_rancher_api/api_client.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -52,7 +52,8 @@ def self.default # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers. def call_api(http_method, path, opts = {}) request = build_request(http_method, path, opts) - tempfile = download_file(request) if opts[:return_type] == 'File' + tempfile = nil + (download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File' response = request.run if @config.debugging @@ -191,19 +192,17 @@ def download_file(request) chunk.force_encoding(encoding) tempfile.write(chunk) end - # run the request to ensure the tempfile is created successfully before returning it - request.run - if tempfile + request.on_complete do + if !tempfile + fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + end tempfile.close @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ "will be deleted automatically with GC. It's also recommended to delete the temp file "\ "explicitly with `tempfile.delete`" - else - fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + yield tempfile if block_given? end - - tempfile end # Check if the given MIME is a JSON MIME. @@ -215,7 +214,7 @@ def download_file(request) # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type. @@ -282,9 +281,13 @@ def convert_to_type(data, return_type) data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else - # models (e.g. Pet) or oneOf + # models (e.g. Pet) or oneOf/anyOf klass = RancherApi.const_get(return_type) - klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of) + klass.build(data) + else + klass.build_from_hash(data) + end end end @@ -294,7 +297,7 @@ def convert_to_type(data, return_type) # @param [String] filename the filename to be sanitized # @return [String] the sanitized filename def sanitize_filename(filename) - filename.gsub(/.*[\/\\]/, '') + filename.split(/[\/\\]/).last end def build_request_url(path, opts = {}) @@ -394,4 +397,4 @@ def build_collection_param(param, collection_format) end end end -end +end \ No newline at end of file diff --git a/RancherApi/lib/pnap_rancher_api/api_error.rb b/RancherApi/lib/pnap_rancher_api/api_error.rb index b4b948c9..c4eb2c1c 100644 --- a/RancherApi/lib/pnap_rancher_api/api_error.rb +++ b/RancherApi/lib/pnap_rancher_api/api_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/RancherApi/lib/pnap_rancher_api/api_model_base.rb b/RancherApi/lib/pnap_rancher_api/api_model_base.rb new file mode 100644 index 00000000..dcddb1ed --- /dev/null +++ b/RancherApi/lib/pnap_rancher_api/api_model_base.rb @@ -0,0 +1,88 @@ +=begin +#Rancher Solution API + +#Simplify enterprise-grade Kubernetes cluster operations and management with Rancher on Bare Metal Cloud. Deploy Kubernetes clusters using a few API calls.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/solutions/rancher/v1beta) + +The version of the OpenAPI document: 0.1 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +module RancherApi + class ApiModelBase + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._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 = RancherApi.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 + + # 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/RancherApi/lib/pnap_rancher_api/configuration.rb b/RancherApi/lib/pnap_rancher_api/configuration.rb index c6e9dd2e..39ffdafd 100644 --- a/RancherApi/lib/pnap_rancher_api/configuration.rb +++ b/RancherApi/lib/pnap_rancher_api/configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -79,6 +79,14 @@ class Configuration # @return [true, false] attr_accessor :debugging + # Set this to ignore operation servers for the API client. This is useful when you need to + # send requests to a different server than the one specified in the OpenAPI document. + # Will default to the base url defined in the spec but can be overridden by setting + # `scheme`, `host`, `base_path` directly. + # Default to false. + # @return [true, false] + attr_accessor :ignore_operation_servers + # Defines the logger used for debugging. # Default to `Rails.logger` (when in Rails) or logging to STDOUT. # @@ -166,6 +174,7 @@ def initialize @timeout = 0 @params_encoding = nil @debugging = false + @ignore_operation_servers = false @inject_format = false @force_ending_format = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) @@ -200,6 +209,7 @@ def base_path=(base_path) # Returns base URL for specified operation based on server settings def base_url(operation = nil) + return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers if operation_server_settings.key?(operation) then index = server_operation_index.fetch(operation, server_index) server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) diff --git a/RancherApi/lib/pnap_rancher_api/models/cluster.rb b/RancherApi/lib/pnap_rancher_api/models/cluster.rb index 2608c6f9..f4219a03 100644 --- a/RancherApi/lib/pnap_rancher_api/models/cluster.rb +++ b/RancherApi/lib/pnap_rancher_api/models/cluster.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module RancherApi # Cluster details. - class Cluster + class Cluster < ApiModelBase # (Read-only) The Cluster identifier. attr_accessor :id @@ -25,7 +25,7 @@ class Cluster # Cluster description. attr_accessor :description - # Deployment location. Cannot be changed once a cluster is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. + # Deployment location. Cannot be changed once a cluster is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. attr_accessor :location # (Read-only) The Rancher version that was installed on the cluster during the first creation process. @@ -59,9 +59,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -94,9 +99,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `RancherApi::Cluster`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `RancherApi::Cluster`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -176,6 +182,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + # Custom attribute writer method with validation # @param [Object] node_pools Value to be assigned def node_pools=(node_pools) @@ -246,61 +262,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = RancherApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -317,24 +278,6 @@ def to_hash 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/RancherApi/lib/pnap_rancher_api/models/delete_result.rb b/RancherApi/lib/pnap_rancher_api/models/delete_result.rb index 1c467f32..16eb0b80 100644 --- a/RancherApi/lib/pnap_rancher_api/models/delete_result.rb +++ b/RancherApi/lib/pnap_rancher_api/models/delete_result.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module RancherApi # Result of a successful delete action. - class DeleteResult + class DeleteResult < ApiModelBase # Solution cluster has been deleted. attr_accessor :result @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `RancherApi::DeleteResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `RancherApi::DeleteResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -102,6 +108,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] result Value to be assigned + def result=(result) + if result.nil? + fail ArgumentError, 'result cannot be nil' + end + + @result = result + end + + # Custom attribute writer method with validation + # @param [Object] cluster_id Value to be assigned + def cluster_id=(cluster_id) + if cluster_id.nil? + fail ArgumentError, 'cluster_id cannot be nil' + end + + @cluster_id = cluster_id + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -146,61 +172,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = RancherApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -217,24 +188,6 @@ def to_hash 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/RancherApi/lib/pnap_rancher_api/models/error.rb b/RancherApi/lib/pnap_rancher_api/models/error.rb index 8c0fe226..80ea4a0c 100644 --- a/RancherApi/lib/pnap_rancher_api/models/error.rb +++ b/RancherApi/lib/pnap_rancher_api/models/error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module RancherApi - class Error + class Error < ApiModelBase # The description detailing the cause of the error code. attr_accessor :message @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `RancherApi::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `RancherApi::Error`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -96,6 +102,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] message Value to be assigned + def message=(message) + if message.nil? + fail ArgumentError, 'message cannot be nil' + end + + @message = message + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -140,61 +156,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = RancherApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -211,24 +172,6 @@ def to_hash 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/RancherApi/lib/pnap_rancher_api/models/node.rb b/RancherApi/lib/pnap_rancher_api/models/node.rb index 68b95f8d..b96bd56a 100644 --- a/RancherApi/lib/pnap_rancher_api/models/node.rb +++ b/RancherApi/lib/pnap_rancher_api/models/node.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module RancherApi # Node details. - class Node + class Node < ApiModelBase # The server identifier. attr_accessor :server_id @@ -26,9 +26,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -52,9 +57,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `RancherApi::Node`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `RancherApi::Node`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -122,61 +128,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = RancherApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -193,24 +144,6 @@ def to_hash 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/RancherApi/lib/pnap_rancher_api/models/node_pool.rb b/RancherApi/lib/pnap_rancher_api/models/node_pool.rb index 498eba97..ea06ed56 100644 --- a/RancherApi/lib/pnap_rancher_api/models/node_pool.rb +++ b/RancherApi/lib/pnap_rancher_api/models/node_pool.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module RancherApi # Node Pool Configuration. A node pool contains the name and configuration for a cluster's node pool. Node pools are set of nodes with a common configuration and specification. - class NodePool + class NodePool < ApiModelBase # The name of the node pool. attr_accessor :name @@ -41,9 +41,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -71,9 +76,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `RancherApi::NodePool`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `RancherApi::NodePool`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -113,7 +119,7 @@ def list_invalid_properties end if !@name.nil? && @name.to_s.length < 1 - invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.') + invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/) @@ -146,7 +152,7 @@ def name=(name) end if name.to_s.length < 1 - fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.' end pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/) @@ -204,61 +210,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = RancherApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -275,24 +226,6 @@ def to_hash 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/RancherApi/lib/pnap_rancher_api/models/rancher_cluster_certificates.rb b/RancherApi/lib/pnap_rancher_api/models/rancher_cluster_certificates.rb index 2cfd10c0..7ba367dd 100644 --- a/RancherApi/lib/pnap_rancher_api/models/rancher_cluster_certificates.rb +++ b/RancherApi/lib/pnap_rancher_api/models/rancher_cluster_certificates.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module RancherApi # (Write-only) Define the custom SSL certificates to be used instead of defaults. - class RancherClusterCertificates + class RancherClusterCertificates < ApiModelBase # The SSL CA certificate to be used for rancher admin. attr_accessor :ca_certificate @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `RancherApi::RancherClusterCertificates`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `RancherApi::RancherClusterCertificates`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -142,61 +148,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = RancherApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -213,24 +164,6 @@ def to_hash 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/RancherApi/lib/pnap_rancher_api/models/rancher_cluster_config.rb b/RancherApi/lib/pnap_rancher_api/models/rancher_cluster_config.rb index 368698f8..09b7da04 100644 --- a/RancherApi/lib/pnap_rancher_api/models/rancher_cluster_config.rb +++ b/RancherApi/lib/pnap_rancher_api/models/rancher_cluster_config.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module RancherApi # (Write-only) Rancher configuration parameters. - class RancherClusterConfig + class RancherClusterConfig < ApiModelBase # Shared secret used to join a server or agent to a cluster. attr_accessor :token @@ -49,9 +49,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -81,9 +86,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `RancherApi::RancherClusterConfig`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `RancherApi::RancherClusterConfig`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -185,61 +191,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = RancherApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -256,24 +207,6 @@ def to_hash 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/RancherApi/lib/pnap_rancher_api/models/rancher_server_metadata.rb b/RancherApi/lib/pnap_rancher_api/models/rancher_server_metadata.rb index b281af4c..954492b2 100644 --- a/RancherApi/lib/pnap_rancher_api/models/rancher_server_metadata.rb +++ b/RancherApi/lib/pnap_rancher_api/models/rancher_server_metadata.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module RancherApi # (Read Only) Connection parameters to use to connect to the Rancher Server Administrative GUI. - class RancherServerMetadata + class RancherServerMetadata < ApiModelBase # The Rancher Server URL. attr_accessor :url @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `RancherApi::RancherServerMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `RancherApi::RancherServerMetadata`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -142,61 +148,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = RancherApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -213,24 +164,6 @@ def to_hash 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/RancherApi/lib/pnap_rancher_api/models/ssh_config.rb b/RancherApi/lib/pnap_rancher_api/models/ssh_config.rb index 6b2cb752..f7b7fbb9 100644 --- a/RancherApi/lib/pnap_rancher_api/models/ssh_config.rb +++ b/RancherApi/lib/pnap_rancher_api/models/ssh_config.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module RancherApi # (Write-only) Configuration defining which public SSH keys are pre-installed as authorized on the server. - class SshConfig + class SshConfig < ApiModelBase # Define whether public keys marked as default should be installed on this node. These are public keys that were already recorded on this system. Use GET /ssh-keys to retrieve a list of possible values. attr_accessor :install_default_keys @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `RancherApi::SshConfig`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `RancherApi::SshConfig`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -148,61 +154,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = RancherApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -219,24 +170,6 @@ def to_hash 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/RancherApi/lib/pnap_rancher_api/models/workload_cluster_config.rb b/RancherApi/lib/pnap_rancher_api/models/workload_cluster_config.rb index cb72bfde..13767de8 100644 --- a/RancherApi/lib/pnap_rancher_api/models/workload_cluster_config.rb +++ b/RancherApi/lib/pnap_rancher_api/models/workload_cluster_config.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,17 +15,17 @@ module RancherApi # (Write-only) Workload cluster configuration parameters. - class WorkloadClusterConfig + class WorkloadClusterConfig < ApiModelBase # The name of the workload cluster. This field is autogenerated if not provided. attr_accessor :name # Number of configured servers. Currently only server counts of 1 and 3 are possible. attr_accessor :server_count - # Node server type. Cannot be changed once the cluster is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c1.small`, `d1.c2.small`, `d1.c3.small`, `d1.c4.small`, `d1.c1.medium`, `d1.c2.medium`, `d1.c3.medium`, `d1.c4.medium`, `d1.c1.large`, `d1.c2.large`, `d1.c3.large`, `d1.c4.large`, `d1.m1.medium`, `d1.m2.medium`, `d1.m3.medium`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge` or `d3.g2.c3.xlarge`. + # Node server type. Cannot be changed once the cluster is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c4.small`, `d1.c4.medium`, `d1.c4.large`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge` or `d3.g2.c3.xlarge`. attr_accessor :server_type - # Workload cluster location. Cannot be changed once cluster is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. + # Workload cluster location. Cannot be changed once cluster is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. attr_accessor :location # Attribute mapping from ruby-style variable name to JSON key. @@ -38,9 +38,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -67,9 +72,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `RancherApi::WorkloadClusterConfig`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `RancherApi::WorkloadClusterConfig`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -122,6 +128,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] server_type Value to be assigned + def server_type=(server_type) + if server_type.nil? + fail ArgumentError, 'server_type cannot be nil' + end + + @server_type = server_type + end + + # Custom attribute writer method with validation + # @param [Object] location Value to be assigned + def location=(location) + if location.nil? + fail ArgumentError, 'location cannot be nil' + end + + @location = location + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -168,61 +194,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = RancherApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -239,24 +210,6 @@ def to_hash 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/RancherApi/lib/pnap_rancher_api/version.rb b/RancherApi/lib/pnap_rancher_api/version.rb index d3b1c759..07949acb 100644 --- a/RancherApi/lib/pnap_rancher_api/version.rb +++ b/RancherApi/lib/pnap_rancher_api/version.rb @@ -6,8 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 - +Generator version: 7.20.0 =end def get_version() diff --git a/RancherApi/pnap_rancher_api.gemspec b/RancherApi/pnap_rancher_api.gemspec index 923969e0..b57c5fed 100644 --- a/RancherApi/pnap_rancher_api.gemspec +++ b/RancherApi/pnap_rancher_api.gemspec @@ -8,7 +8,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -19,14 +19,14 @@ Gem::Specification.new do |s| s.name = "pnap_rancher_api" s.version = RancherApi::VERSION s.platform = Gem::Platform::RUBY - s.authors = ["PhoenixNAP"] + s.authors = ["OpenAPI-Generator"] s.email = ["support@phoenixnap.com"] - s.homepage = "https://phoenixnap.com/bare-metal-cloud" + s.homepage = "https://openapi-generator.tech" s.summary = "Rancher Solution API Ruby Gem" - s.description = "Rancher Solution API Ruby Gem" + s.description = "Simplify enterprise-grade Kubernetes cluster operations and management with Rancher on Bare Metal Cloud. Deploy Kubernetes clusters using a few API calls.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/solutions/rancher/v1beta) " s.license = "MPL-2.0" s.required_ruby_version = ">= 2.7" - s.metadata = { "source_code_uri" => "https://github.com/phoenixnap/ruby-sdk-bmc" } + s.metadata = {} s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' @@ -36,4 +36,4 @@ Gem::Specification.new do |s| s.test_files = `find spec/*`.split("\n") s.executables = [] s.require_paths = ["lib"] -end +end \ No newline at end of file diff --git a/RancherApi/spec/api/clusters_api_spec.rb b/RancherApi/spec/api/clusters_api_spec.rb index c62392e3..82d42543 100644 --- a/RancherApi/spec/api/clusters_api_spec.rb +++ b/RancherApi/spec/api/clusters_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -69,7 +69,7 @@ # unit tests for clusters_post # Create a Rancher Server Deployment. - # Create a Rancher Server Deployment as described in <a href='https://ranchermanager.docs.rancher.com/v2.6/reference-guides/rancher-manager-architecture#rancher-server-architecture' target='_blank'>Rancher Docs Architecture</a>. Rancher Server allows the creation, import and management of multiple Downstream User Kubernetes Clusters. <b>This is not a Downstream User Cluster</b>. Knowledge base article to help you can be found <a href='https://phoenixnap.com/kb/bmc-rancher-workload-cluster#ftoc-heading-5' target='_blank'>here</a>. + # Create a Rancher Server Deployment as described in <a href='https://ranchermanager.docs.rancher.com/reference-guides/rancher-manager-architecture' target='_blank'>Rancher Docs Architecture</a>. Rancher Server allows the creation, import and management of multiple Downstream User Kubernetes Clusters. <b>This is not a Downstream User Cluster</b>. Knowledge base article to help you can be found <a href='https://phoenixnap.com/kb/bmc-rancher-workload-cluster#ftoc-heading-5' target='_blank'>here</a>. # @param cluster # @param [Hash] opts the optional parameters # @return [Cluster] diff --git a/RancherApi/spec/models/cluster_spec.rb b/RancherApi/spec/models/cluster_spec.rb index 687def8c..1e56bd68 100644 --- a/RancherApi/spec/models/cluster_spec.rb +++ b/RancherApi/spec/models/cluster_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe RancherApi::Cluster do - let(:instance) { RancherApi::Cluster.new } + #let(:instance) { RancherApi::Cluster.new } describe 'test an instance of Cluster' do it 'should create an instance of Cluster' do diff --git a/RancherApi/spec/models/delete_result_spec.rb b/RancherApi/spec/models/delete_result_spec.rb index c19a064a..b959f1c6 100644 --- a/RancherApi/spec/models/delete_result_spec.rb +++ b/RancherApi/spec/models/delete_result_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe RancherApi::DeleteResult do - let(:instance) { RancherApi::DeleteResult.new } + #let(:instance) { RancherApi::DeleteResult.new } describe 'test an instance of DeleteResult' do it 'should create an instance of DeleteResult' do diff --git a/RancherApi/spec/models/error_spec.rb b/RancherApi/spec/models/error_spec.rb index 1b8a55f3..45064f21 100644 --- a/RancherApi/spec/models/error_spec.rb +++ b/RancherApi/spec/models/error_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe RancherApi::Error do - let(:instance) { RancherApi::Error.new } + #let(:instance) { RancherApi::Error.new } describe 'test an instance of Error' do it 'should create an instance of Error' do diff --git a/RancherApi/spec/models/node_pool_spec.rb b/RancherApi/spec/models/node_pool_spec.rb index 1812f513..0dcd1ac6 100644 --- a/RancherApi/spec/models/node_pool_spec.rb +++ b/RancherApi/spec/models/node_pool_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe RancherApi::NodePool do - let(:instance) { RancherApi::NodePool.new } + #let(:instance) { RancherApi::NodePool.new } describe 'test an instance of NodePool' do it 'should create an instance of NodePool' do diff --git a/RancherApi/spec/models/node_spec.rb b/RancherApi/spec/models/node_spec.rb index ca465e9f..51cfabed 100644 --- a/RancherApi/spec/models/node_spec.rb +++ b/RancherApi/spec/models/node_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe RancherApi::Node do - let(:instance) { RancherApi::Node.new } + #let(:instance) { RancherApi::Node.new } describe 'test an instance of Node' do it 'should create an instance of Node' do diff --git a/RancherApi/spec/models/rancher_cluster_certificates_spec.rb b/RancherApi/spec/models/rancher_cluster_certificates_spec.rb index d769f055..83cf009f 100644 --- a/RancherApi/spec/models/rancher_cluster_certificates_spec.rb +++ b/RancherApi/spec/models/rancher_cluster_certificates_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe RancherApi::RancherClusterCertificates do - let(:instance) { RancherApi::RancherClusterCertificates.new } + #let(:instance) { RancherApi::RancherClusterCertificates.new } describe 'test an instance of RancherClusterCertificates' do it 'should create an instance of RancherClusterCertificates' do diff --git a/RancherApi/spec/models/rancher_cluster_config_spec.rb b/RancherApi/spec/models/rancher_cluster_config_spec.rb index 5f2879a8..a677939b 100644 --- a/RancherApi/spec/models/rancher_cluster_config_spec.rb +++ b/RancherApi/spec/models/rancher_cluster_config_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe RancherApi::RancherClusterConfig do - let(:instance) { RancherApi::RancherClusterConfig.new } + #let(:instance) { RancherApi::RancherClusterConfig.new } describe 'test an instance of RancherClusterConfig' do it 'should create an instance of RancherClusterConfig' do diff --git a/RancherApi/spec/models/rancher_server_metadata_spec.rb b/RancherApi/spec/models/rancher_server_metadata_spec.rb index 99640cd1..4cb8f7f5 100644 --- a/RancherApi/spec/models/rancher_server_metadata_spec.rb +++ b/RancherApi/spec/models/rancher_server_metadata_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe RancherApi::RancherServerMetadata do - let(:instance) { RancherApi::RancherServerMetadata.new } + #let(:instance) { RancherApi::RancherServerMetadata.new } describe 'test an instance of RancherServerMetadata' do it 'should create an instance of RancherServerMetadata' do diff --git a/RancherApi/spec/models/ssh_config_spec.rb b/RancherApi/spec/models/ssh_config_spec.rb index d54735c2..2eb7868d 100644 --- a/RancherApi/spec/models/ssh_config_spec.rb +++ b/RancherApi/spec/models/ssh_config_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe RancherApi::SshConfig do - let(:instance) { RancherApi::SshConfig.new } + #let(:instance) { RancherApi::SshConfig.new } describe 'test an instance of SshConfig' do it 'should create an instance of SshConfig' do diff --git a/RancherApi/spec/models/workload_cluster_config_spec.rb b/RancherApi/spec/models/workload_cluster_config_spec.rb index a6b61227..5b17586a 100644 --- a/RancherApi/spec/models/workload_cluster_config_spec.rb +++ b/RancherApi/spec/models/workload_cluster_config_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe RancherApi::WorkloadClusterConfig do - let(:instance) { RancherApi::WorkloadClusterConfig.new } + #let(:instance) { RancherApi::WorkloadClusterConfig.new } describe 'test an instance of WorkloadClusterConfig' do it 'should create an instance of WorkloadClusterConfig' do diff --git a/RancherApi/spec/spec_helper.rb b/RancherApi/spec/spec_helper.rb index d951fde2..aaf61ba4 100644 --- a/RancherApi/spec/spec_helper.rb +++ b/RancherApi/spec/spec_helper.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 0.1 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/TagApi/VERSION b/TagApi/VERSION index 26e33797..e0102586 100644 --- a/TagApi/VERSION +++ b/TagApi/VERSION @@ -1 +1 @@ -2.0.4 \ No newline at end of file +2.0.5 diff --git a/TagApi/lib/pnap_tag_api.rb b/TagApi/lib/pnap_tag_api.rb index 5d712b38..8dd5d34d 100644 --- a/TagApi/lib/pnap_tag_api.rb +++ b/TagApi/lib/pnap_tag_api.rb @@ -6,13 +6,14 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end # Common files require 'pnap_tag_api/api_client' require 'pnap_tag_api/api_error' +require 'pnap_tag_api/api_model_base' require 'pnap_tag_api/version' require 'pnap_tag_api/configuration' diff --git a/TagApi/lib/pnap_tag_api/api/tags_api.rb b/TagApi/lib/pnap_tag_api/api/tags_api.rb index a4bac9ce..f124dbf9 100644 --- a/TagApi/lib/pnap_tag_api/api/tags_api.rb +++ b/TagApi/lib/pnap_tag_api/api/tags_api.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -48,7 +48,7 @@ def tags_get_with_http_info(opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -111,7 +111,7 @@ def tags_post_with_http_info(tag_create, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? @@ -179,7 +179,7 @@ def tags_tag_id_delete_with_http_info(tag_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -242,7 +242,7 @@ def tags_tag_id_get_with_http_info(tag_id, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} @@ -311,7 +311,7 @@ def tags_tag_id_patch_with_http_info(tag_id, tag_update, opts = {}) # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? diff --git a/TagApi/lib/pnap_tag_api/api_client.rb b/TagApi/lib/pnap_tag_api/api_client.rb index 647ffd09..fbcab8e3 100644 --- a/TagApi/lib/pnap_tag_api/api_client.rb +++ b/TagApi/lib/pnap_tag_api/api_client.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -52,7 +52,8 @@ def self.default # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers. def call_api(http_method, path, opts = {}) request = build_request(http_method, path, opts) - tempfile = download_file(request) if opts[:return_type] == 'File' + tempfile = nil + (download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File' response = request.run if @config.debugging @@ -191,19 +192,17 @@ def download_file(request) chunk.force_encoding(encoding) tempfile.write(chunk) end - # run the request to ensure the tempfile is created successfully before returning it - request.run - if tempfile + request.on_complete do + if !tempfile + fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + end tempfile.close @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ "will be deleted automatically with GC. It's also recommended to delete the temp file "\ "explicitly with `tempfile.delete`" - else - fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}") + yield tempfile if block_given? end - - tempfile end # Check if the given MIME is a JSON MIME. @@ -215,7 +214,7 @@ def download_file(request) # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type. @@ -282,9 +281,13 @@ def convert_to_type(data, return_type) data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else - # models (e.g. Pet) or oneOf + # models (e.g. Pet) or oneOf/anyOf klass = TagApi.const_get(return_type) - klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of) + klass.build(data) + else + klass.build_from_hash(data) + end end end @@ -294,7 +297,7 @@ def convert_to_type(data, return_type) # @param [String] filename the filename to be sanitized # @return [String] the sanitized filename def sanitize_filename(filename) - filename.gsub(/.*[\/\\]/, '') + filename.split(/[\/\\]/).last end def build_request_url(path, opts = {}) @@ -394,4 +397,4 @@ def build_collection_param(param, collection_format) end end end -end +end \ No newline at end of file diff --git a/TagApi/lib/pnap_tag_api/api_error.rb b/TagApi/lib/pnap_tag_api/api_error.rb index 24da4378..38e8113b 100644 --- a/TagApi/lib/pnap_tag_api/api_error.rb +++ b/TagApi/lib/pnap_tag_api/api_error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/TagApi/lib/pnap_tag_api/api_model_base.rb b/TagApi/lib/pnap_tag_api/api_model_base.rb new file mode 100644 index 00000000..a69579a6 --- /dev/null +++ b/TagApi/lib/pnap_tag_api/api_model_base.rb @@ -0,0 +1,88 @@ +=begin +#Tags API + +#Tags are case-sensitive key-value pairs that simplify resource management. The Tag Manager API allows you to create and manage such tags to later assign them to related resources in your Bare Metal Cloud (through the respective resource apis) in order to group and categorize them.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/tag-manager/v1/) + +The version of the OpenAPI document: 1.0 +Contact: support@phoenixnap.com +Generated by: https://openapi-generator.tech +Generator version: 7.20.0 + +=end + +module TagApi + class ApiModelBase + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._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 = TagApi.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 + + # 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/TagApi/lib/pnap_tag_api/configuration.rb b/TagApi/lib/pnap_tag_api/configuration.rb index fbb8e874..6480916f 100644 --- a/TagApi/lib/pnap_tag_api/configuration.rb +++ b/TagApi/lib/pnap_tag_api/configuration.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -79,6 +79,14 @@ class Configuration # @return [true, false] attr_accessor :debugging + # Set this to ignore operation servers for the API client. This is useful when you need to + # send requests to a different server than the one specified in the OpenAPI document. + # Will default to the base url defined in the spec but can be overridden by setting + # `scheme`, `host`, `base_path` directly. + # Default to false. + # @return [true, false] + attr_accessor :ignore_operation_servers + # Defines the logger used for debugging. # Default to `Rails.logger` (when in Rails) or logging to STDOUT. # @@ -166,6 +174,7 @@ def initialize @timeout = 0 @params_encoding = nil @debugging = false + @ignore_operation_servers = false @inject_format = false @force_ending_format = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) @@ -200,6 +209,7 @@ def base_path=(base_path) # Returns base URL for specified operation based on server settings def base_url(operation = nil) + return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers if operation_server_settings.key?(operation) then index = server_operation_index.fetch(operation, server_index) server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) diff --git a/TagApi/lib/pnap_tag_api/models/delete_result.rb b/TagApi/lib/pnap_tag_api/models/delete_result.rb index 4300de7c..9cf6eca6 100644 --- a/TagApi/lib/pnap_tag_api/models/delete_result.rb +++ b/TagApi/lib/pnap_tag_api/models/delete_result.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module TagApi # Result of a successful delete action. - class DeleteResult + class DeleteResult < ApiModelBase # Tag deletion result message. attr_accessor :result @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `TagApi::DeleteResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `TagApi::DeleteResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -102,6 +108,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] result Value to be assigned + def result=(result) + if result.nil? + fail ArgumentError, 'result cannot be nil' + end + + @result = result + end + + # Custom attribute writer method with validation + # @param [Object] tag_id Value to be assigned + def tag_id=(tag_id) + if tag_id.nil? + fail ArgumentError, 'tag_id cannot be nil' + end + + @tag_id = tag_id + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -146,61 +172,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = TagApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -217,24 +188,6 @@ def to_hash 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/TagApi/lib/pnap_tag_api/models/error.rb b/TagApi/lib/pnap_tag_api/models/error.rb index ac222147..09547f5e 100644 --- a/TagApi/lib/pnap_tag_api/models/error.rb +++ b/TagApi/lib/pnap_tag_api/models/error.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -14,7 +14,7 @@ require 'time' module TagApi - class Error + class Error < ApiModelBase # The description detailing the cause of the error code. attr_accessor :message @@ -29,9 +29,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -56,9 +61,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `TagApi::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `TagApi::Error`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -96,6 +102,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] message Value to be assigned + def message=(message) + if message.nil? + fail ArgumentError, 'message cannot be nil' + end + + @message = message + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -140,61 +156,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = TagApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -211,24 +172,6 @@ def to_hash 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/TagApi/lib/pnap_tag_api/models/resource_assignment.rb b/TagApi/lib/pnap_tag_api/models/resource_assignment.rb index e7032755..8bdf89ec 100644 --- a/TagApi/lib/pnap_tag_api/models/resource_assignment.rb +++ b/TagApi/lib/pnap_tag_api/models/resource_assignment.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module TagApi # Resource assigned to a tag. - class ResourceAssignment + class ResourceAssignment < ApiModelBase # The resource name which is automatically generated by the tags-api. It is a unique resource identifier made up of the API name (e.g. bmc, ips), the resource type and the resource ID. This is not to be confused with custom names that are defined for particular resources, such as the server name or network name. attr_accessor :resource_name @@ -30,9 +30,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -57,9 +62,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `TagApi::ResourceAssignment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `TagApi::ResourceAssignment`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -95,6 +101,16 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] resource_name Value to be assigned + def resource_name=(resource_name) + if resource_name.nil? + fail ArgumentError, 'resource_name cannot be nil' + end + + @resource_name = resource_name + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -139,61 +155,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = TagApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -210,24 +171,6 @@ def to_hash 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/TagApi/lib/pnap_tag_api/models/tag.rb b/TagApi/lib/pnap_tag_api/models/tag.rb index 55a5c066..431b59b3 100644 --- a/TagApi/lib/pnap_tag_api/models/tag.rb +++ b/TagApi/lib/pnap_tag_api/models/tag.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module TagApi # Tag model. - class Tag + class Tag < ApiModelBase # The unique id of the tag. attr_accessor :id @@ -72,9 +72,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -104,9 +109,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `TagApi::Tag`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `TagApi::Tag`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -184,6 +190,36 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] id Value to be assigned + def id=(id) + if id.nil? + fail ArgumentError, 'id cannot be nil' + end + + @id = id + end + + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + + # Custom attribute writer method with validation + # @param [Object] is_billing_tag Value to be assigned + def is_billing_tag=(is_billing_tag) + if is_billing_tag.nil? + fail ArgumentError, 'is_billing_tag cannot be nil' + end + + @is_billing_tag = is_billing_tag + end + # Custom attribute writer method checking allowed values (enum). # @param [Object] created_by Object to be assigned def created_by=(created_by) @@ -243,61 +279,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = TagApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -314,24 +295,6 @@ def to_hash 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/TagApi/lib/pnap_tag_api/models/tag_create.rb b/TagApi/lib/pnap_tag_api/models/tag_create.rb index 73eb64be..7df66b7e 100644 --- a/TagApi/lib/pnap_tag_api/models/tag_create.rb +++ b/TagApi/lib/pnap_tag_api/models/tag_create.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module TagApi # Tag creation model. - class TagCreate + class TagCreate < ApiModelBase # The unique name of the tag. Tag names are case-sensitive, and should be composed of a maximum of 100 characters including UTF-8 Unicode letters, numbers, and the following symbols: '-', '_'. Regex: [A-zÀ-ú0-9_-]{1,100} attr_accessor :name @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `TagApi::TagCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `TagApi::TagCreate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -111,6 +117,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + + # Custom attribute writer method with validation + # @param [Object] is_billing_tag Value to be assigned + def is_billing_tag=(is_billing_tag) + if is_billing_tag.nil? + fail ArgumentError, 'is_billing_tag cannot be nil' + end + + @is_billing_tag = is_billing_tag + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -156,61 +182,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = TagApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -227,24 +198,6 @@ def to_hash 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/TagApi/lib/pnap_tag_api/models/tag_update.rb b/TagApi/lib/pnap_tag_api/models/tag_update.rb index eddd7502..6f70be79 100644 --- a/TagApi/lib/pnap_tag_api/models/tag_update.rb +++ b/TagApi/lib/pnap_tag_api/models/tag_update.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -15,7 +15,7 @@ module TagApi # Tag update model. - class TagUpdate + class TagUpdate < ApiModelBase # The unique name of the tag. Tag names are case-sensitive, and should be composed of a maximum of 100 characters including UTF-8 Unicode letters, numbers, and the following symbols: '-', '_'. Regex: [A-zÀ-ú0-9_-]{1,100} attr_accessor :name @@ -34,9 +34,14 @@ def self.attribute_map } end + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + # Returns all the JSON keys this model knows about def self.acceptable_attributes - attribute_map.values + acceptable_attribute_map.values end # Attribute type mapping. @@ -62,9 +67,10 @@ def initialize(attributes = {}) end # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map 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 `TagApi::TagUpdate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `TagApi::TagUpdate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } @@ -111,6 +117,26 @@ def valid? true end + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + + # Custom attribute writer method with validation + # @param [Object] is_billing_tag Value to be assigned + def is_billing_tag=(is_billing_tag) + if is_billing_tag.nil? + fail ArgumentError, 'is_billing_tag cannot be nil' + end + + @is_billing_tag = is_billing_tag + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -156,61 +182,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._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 = TagApi.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_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 @@ -227,24 +198,6 @@ def to_hash 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/TagApi/lib/pnap_tag_api/version.rb b/TagApi/lib/pnap_tag_api/version.rb index da4a6cef..f84c354e 100644 --- a/TagApi/lib/pnap_tag_api/version.rb +++ b/TagApi/lib/pnap_tag_api/version.rb @@ -6,8 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 - +Generator version: 7.20.0 =end def get_version() diff --git a/TagApi/pnap_tag_api.gemspec b/TagApi/pnap_tag_api.gemspec index 5cd92a30..458d7f90 100644 --- a/TagApi/pnap_tag_api.gemspec +++ b/TagApi/pnap_tag_api.gemspec @@ -8,7 +8,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -19,14 +19,14 @@ Gem::Specification.new do |s| s.name = "pnap_tag_api" s.version = TagApi::VERSION s.platform = Gem::Platform::RUBY - s.authors = ["PhoenixNAP"] + s.authors = ["OpenAPI-Generator"] s.email = ["support@phoenixnap.com"] - s.homepage = "https://phoenixnap.com/bare-metal-cloud" + s.homepage = "https://openapi-generator.tech" s.summary = "Tags API Ruby Gem" - s.description = "Tags API Ruby Gem" + s.description = "Tags are case-sensitive key-value pairs that simplify resource management. The Tag Manager API allows you to create and manage such tags to later assign them to related resources in your Bare Metal Cloud (through the respective resource apis) in order to group and categorize them.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/tag-manager/v1/) " s.license = "MPL-2.0" s.required_ruby_version = ">= 2.7" - s.metadata = { "source_code_uri" => "https://github.com/phoenixnap/ruby-sdk-bmc" } + s.metadata = {} s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' @@ -36,4 +36,4 @@ Gem::Specification.new do |s| s.test_files = `find spec/*`.split("\n") s.executables = [] s.require_paths = ["lib"] -end +end \ No newline at end of file diff --git a/TagApi/spec/api/tags_api_spec.rb b/TagApi/spec/api/tags_api_spec.rb index 6549ea6d..cde8a258 100644 --- a/TagApi/spec/api/tags_api_spec.rb +++ b/TagApi/spec/api/tags_api_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/TagApi/spec/models/delete_result_spec.rb b/TagApi/spec/models/delete_result_spec.rb index 56d02846..55afe5b8 100644 --- a/TagApi/spec/models/delete_result_spec.rb +++ b/TagApi/spec/models/delete_result_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe TagApi::DeleteResult do - let(:instance) { TagApi::DeleteResult.new } + #let(:instance) { TagApi::DeleteResult.new } describe 'test an instance of DeleteResult' do it 'should create an instance of DeleteResult' do diff --git a/TagApi/spec/models/error_spec.rb b/TagApi/spec/models/error_spec.rb index 0ab5aa8d..b95db183 100644 --- a/TagApi/spec/models/error_spec.rb +++ b/TagApi/spec/models/error_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe TagApi::Error do - let(:instance) { TagApi::Error.new } + #let(:instance) { TagApi::Error.new } describe 'test an instance of Error' do it 'should create an instance of Error' do diff --git a/TagApi/spec/models/resource_assignment_spec.rb b/TagApi/spec/models/resource_assignment_spec.rb index ba1aac96..3d28477a 100644 --- a/TagApi/spec/models/resource_assignment_spec.rb +++ b/TagApi/spec/models/resource_assignment_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe TagApi::ResourceAssignment do - let(:instance) { TagApi::ResourceAssignment.new } + #let(:instance) { TagApi::ResourceAssignment.new } describe 'test an instance of ResourceAssignment' do it 'should create an instance of ResourceAssignment' do diff --git a/TagApi/spec/models/tag_create_spec.rb b/TagApi/spec/models/tag_create_spec.rb index 2208bd48..a42bd391 100644 --- a/TagApi/spec/models/tag_create_spec.rb +++ b/TagApi/spec/models/tag_create_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe TagApi::TagCreate do - let(:instance) { TagApi::TagCreate.new } + #let(:instance) { TagApi::TagCreate.new } describe 'test an instance of TagCreate' do it 'should create an instance of TagCreate' do diff --git a/TagApi/spec/models/tag_spec.rb b/TagApi/spec/models/tag_spec.rb index 0b50ca8c..bc42f0fd 100644 --- a/TagApi/spec/models/tag_spec.rb +++ b/TagApi/spec/models/tag_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe TagApi::Tag do - let(:instance) { TagApi::Tag.new } + #let(:instance) { TagApi::Tag.new } describe 'test an instance of Tag' do it 'should create an instance of Tag' do diff --git a/TagApi/spec/models/tag_update_spec.rb b/TagApi/spec/models/tag_update_spec.rb index 1ce89597..3695cd92 100644 --- a/TagApi/spec/models/tag_update_spec.rb +++ b/TagApi/spec/models/tag_update_spec.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end @@ -18,7 +18,7 @@ # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe TagApi::TagUpdate do - let(:instance) { TagApi::TagUpdate.new } + #let(:instance) { TagApi::TagUpdate.new } describe 'test an instance of TagUpdate' do it 'should create an instance of TagUpdate' do diff --git a/TagApi/spec/spec_helper.rb b/TagApi/spec/spec_helper.rb index 7d5dd7c5..0bd1cdc8 100644 --- a/TagApi/spec/spec_helper.rb +++ b/TagApi/spec/spec_helper.rb @@ -6,7 +6,7 @@ The version of the OpenAPI document: 1.0 Contact: support@phoenixnap.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.2.0 +Generator version: 7.20.0 =end diff --git a/openapitools.json b/openapitools.json index 64f2cbb5..29399d30 100644 --- a/openapitools.json +++ b/openapitools.json @@ -2,6 +2,6 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "7.2.0" + "version": "7.20.0" } } diff --git a/specs/BillingApi.spec.yaml b/specs/BillingApi.spec.yaml index 5a147740..7ce3f0f2 100644 --- a/specs/BillingApi.spec.yaml +++ b/specs/BillingApi.spec.yaml @@ -471,7 +471,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/LocationEnum' + $ref: '#/components/schemas/ProductLocationEnum' example: - PHX - in: query @@ -490,7 +490,9 @@ paths: required: false schema: type: number - description: Minimal quantity of product needed. Minimum, maximum and default values might differ for different products. For servers, they are 1, 10 and 1 respectively. + minimum: 1 + maximum: 10 + description: Minimum quantity of the product that can be requested. For servers the allowed quantity range is 1 to 10. example: 2 responses: '200': @@ -535,7 +537,7 @@ components: - public-ip - storage LocationEnum: - description: The location code. + description: Supported location codes. All locations are active except AUS, which is deprecated and preserved only for legacy data. type: string enum: - PHX @@ -545,6 +547,36 @@ components: - CHI - SEA - AUS + QuantityUnitEnum: + description: The quantity unit. + type: string + enum: + - TB + - COUNT + Quantity: + type: object + description: Represents the quantity. + properties: + quantity: + description: Quantity size. + type: number + example: 30 + minimum: 1 + unit: + $ref: '#/components/schemas/QuantityUnitEnum' + required: + - quantity + - unit + ReservationDetails: + type: object + description: Details of a Reservation entry inside Rated Usage. + properties: + id: + description: The Reservation identifier. + type: string + example: 83604275-bdba-490a-b87a-978e8dffdb14 + quantity: + $ref: '#/components/schemas/Quantity' DiscountTypeEnum: description: The discount type. type: string @@ -709,7 +741,10 @@ components: reservationId: description: Reservation id associated with this rated usage record. type: string + deprecated: true example: c32a24a1-5949-4b60-99c0-c8aaa3a92b04 + reservationDetails: + $ref: '#/components/schemas/ReservationDetails' discountDetails: $ref: '#/components/schemas/ApplicableDiscountDetails' creditDetails: @@ -732,8 +767,6 @@ components: - unitPriceDescription - quantity - active - - usageSessionId - - correlationId ServerDetails: type: object description: Details of the server associated with this rated usage record. @@ -880,12 +913,7 @@ components: format: date-time example: '2020-03-19T16:39:00Z' required: - - networkStorageId - - networkStorageName - - volumeId - - volumeName - capacityInGb - - createdOn StorageRecord: allOf: - $ref: '#/components/schemas/RatedUsageRecord' @@ -921,6 +949,7 @@ components: - UNIT - FLAT - TB_PER_HOUR + - TB_PER_MONTH ApplicableDiscounts: type: object description: Represents the applicable discount details for a product, including the discounted price and discount information. @@ -940,6 +969,29 @@ components: - GB - TB example: TB + PackageQuantity: + type: object + description: Represents the package size per month, for a product's pricing plan, including the min quantity and max quantity information. + properties: + min: + description: Minimum package quantity. + type: number + example: 0 + max: + description: Maximum package quantity. + type: number + example: 100 + required: + - min + - max + PackageDetails: + type: object + description: Represents details object which contains package quantity and its unit. + properties: + packageQuantity: + $ref: '#/components/schemas/PackageQuantity' + packageUnit: + $ref: '#/components/schemas/PackageUnitEnum' PricingPlan: type: object description: Pricing plan details. @@ -962,7 +1014,6 @@ components: - SGP - CHI - SEA - - AUS - GLOBAL pricingModel: description: The pricing model. @@ -992,8 +1043,13 @@ components: description: Package size per month. type: number example: 50 + deprecated: true packageUnit: - $ref: '#/components/schemas/PackageUnitEnum' + allOf: + - $ref: '#/components/schemas/PackageUnitEnum' + deprecated: true + packageDetails: + $ref: '#/components/schemas/PackageDetails' required: - sku - location @@ -1093,6 +1149,7 @@ components: enum: - server - bandwidth + - storage ReservationModelEnum: description: The reservation model. type: string @@ -1101,13 +1158,52 @@ components: - TWELVE_MONTHS_RESERVATION - TWENTY_FOUR_MONTHS_RESERVATION - THIRTY_SIX_MONTHS_RESERVATION + - CUSTOM_TERM - FREE_TIER + example: ONE_MONTH_RESERVATION + ReservationTerm: + type: object + description: The Reservation term. + properties: + lengthInMonths: + description: Term's length, expressed in months. + type: integer + format: int32 + example: 12 + reservationModel: + $ref: '#/components/schemas/ReservationModelEnum' + required: + - lengthInMonths + - reservationModel + ReservationStateEnum: + description: Reservation state. + type: string + enum: + - REQUESTED + - DECLINED + - IN_REVIEW + - SETTING_UP + - ACTIVE + - EXPIRED ReservationInvoicingModelEnum: description: Reservations created with initial invoice model ON_CREATION will be invoiced on same date when reservation is created. Reservation created with CALENDAR_MONTH initial invoice model will be invoiced at the beginning of next month. type: string enum: - ON_CREATION - CALENDAR_MONTH + Utilization: + type: object + properties: + quantity: + $ref: '#/components/schemas/Quantity' + percentage: + type: number + minimum: 0 + maximum: 100 + example: 30 + required: + - quantity + - percentage Reservation: type: object description: Reservation details @@ -1117,7 +1213,7 @@ components: type: string example: 83604275-bdba-490a-b87a-978e8dffdb14 productCode: - description: The code identifying the product. This code has significant across all locations. + description: The code identifying the product. The same code is used for this product across all locations. type: string example: s1.c1.small productCategory: @@ -1125,9 +1221,17 @@ components: location: $ref: '#/components/schemas/LocationEnum' reservationModel: - $ref: '#/components/schemas/ReservationModelEnum' + allOf: + - $ref: '#/components/schemas/ReservationModelEnum' + deprecated: true + term: + $ref: '#/components/schemas/ReservationTerm' + reservationState: + $ref: '#/components/schemas/ReservationStateEnum' initialInvoiceModel: $ref: '#/components/schemas/ReservationInvoicingModelEnum' + quantity: + $ref: '#/components/schemas/Quantity' startDateTime: description: The point in time (in UTC) when the reservation starts. type: string @@ -1171,12 +1275,16 @@ components: type: string format: date example: '2020-04-19' + utilization: + $ref: '#/components/schemas/Utilization' required: - id - productCode - productCategory - location - reservationModel + - reservationState + - quantity - startDateTime - autoRenew - sku @@ -1190,8 +1298,11 @@ components: description: The sku code of product pricing plan. type: string example: XXX-XXX-XXX + quantity: + $ref: '#/components/schemas/Quantity' required: - sku + - quantity ReservationAutoRenewDisableRequest: description: Disabling auto-renewal for reservation request. type: object @@ -1215,12 +1326,28 @@ components: properties: thresholdConfiguration: $ref: '#/components/schemas/ThresholdConfigurationDetails' + ProductLocationEnum: + description: | + This enum is used only in product-related schemas and contains + only currently active and supported locations. + Deprecated or retired locations are intentionally excluded and will not appear + in create/update operations. + Historical data in other API responses may still reference deprecated locations, + but those values are not part of this enum. + type: string + enum: + - PHX + - ASH + - NLD + - SGP + - CHI + - SEA LocationAvailabilityDetail: type: object description: Info about location, solutions and availability for a product. properties: location: - $ref: '#/components/schemas/LocationEnum' + $ref: '#/components/schemas/ProductLocationEnum' minQuantityRequested: type: number description: Requested quantity. diff --git a/specs/BmcApi.spec.yaml b/specs/BmcApi.spec.yaml index c5066890..25acb9df 100644 --- a/specs/BmcApi.spec.yaml +++ b/specs/BmcApi.spec.yaml @@ -496,18 +496,21 @@ paths: - 10.0.0.2 dhcp: false statusDescription: in-progress + vlanId: 10 DhcpTrue: value: id: 60473a6115e34466c9f8f083 ips: [] dhcp: true statusDescription: in-progress + vlanId: 10 DhcpFalseIpsEmptyForceTrue: value: id: 60473a6115e34466c9f8f083 ips: [] dhcp: false statusDescription: in-progress + vlanId: 10 '400': $ref: '#/components/responses/BadRequest' '401': @@ -560,10 +563,16 @@ paths: ips: - 10.0.0.1 - 10.0.0.2 + dhcp: false + statusDescription: assigned + vlanId: 10 privateNetworkWithoutIpsForceTrue: value: id: 60473a6115e34466c9f8f083 ips: [] + dhcp: false + statusDescription: assigned + vlanId: 10 '400': $ref: '#/components/responses/BadRequest' '401': @@ -645,6 +654,28 @@ paths: application/json: schema: $ref: '#/components/schemas/ServerPublicNetwork' + examples: + PublicNetworkWithProvidedIps: + value: + id: 60473c2509268bc77fd06d29 + ips: + - 182.16.0.146 + - 182.16.0.147 + statusDescription: in-progress + vlanId: 10 + PublicNetworkWithNoIpsAndForceTrue: + value: + id: 60473c2509268bc77fd06d29 + ips: [] + statusDescription: in-progress + vlanId: 10 + PublicNetworkWithIpV6AndComputeSlaacIpTrue: + value: + id: 60473c2509268bc77fd06d29 + ips: + - 2001:db8::f + statusDescription: in-progress + vlanId: 10 '400': $ref: '#/components/responses/BadRequest' '401': @@ -709,6 +740,7 @@ paths: - 182.16.0.147 - 2001:db8::b statusDescription: assigned + vlanId: 10 PublicNetworkWithProvidedIpsAndRanges: value: id: 60473a6115e34466c9f8f088 @@ -718,11 +750,13 @@ paths: - 2001:db8::f - 2001:db8::b - 2001:db8::d statusDescription: assigned + vlanId: 10 PublicNetworkWithNoIpsAndForceTrue: value: id: 60473a6115e34466c9f8f088 ips: [] statusDescription: assigned + vlanId: 10 '400': $ref: '#/components/responses/BadRequest' '401': @@ -1111,6 +1145,43 @@ paths: $ref: '#/components/responses/Conflict' '500': $ref: '#/components/responses/InternalServerError' + /servers/{serverId}/actions/transfer-reservation: + parameters: + - $ref: '#/components/parameters/serverIdPathParam' + post: + tags: + - Servers + description: Transfer server reservation. An active (READY) reservation can be transferred from a server in ERROR or RESERVED status to another HOURLY provisioned server of the same location and type. + summary: Transfer server reservation. + operationId: serversServerIdActionsTransferReservation + security: + - OAuth2: + - bmc + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ReservationTransferDetails' + example: + targetServerId: 54a21648dasda4s9843a17 + responses: + '200': + description: The server reservation has been successfully transferred. + content: + application/json: + schema: + $ref: '#/components/schemas/Server' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '409': + $ref: '#/components/responses/Conflict' + '500': + $ref: '#/components/responses/InternalServerError' /ssh-keys: post: tags: @@ -1487,6 +1558,14 @@ components: - 172.217.22.14 - 10.111.14.40/29 - 10.111.14.66 - 10.111.14.71 + bringYourOwnLicense: + description: | + Use a Bring Your Own (BYO) Windows license. + If true, the server is provisioned in trial mode, and you must activate your own license. + If false (default), the server includes a managed Windows license billed by the platform. + type: boolean + example: false + default: false rootPassword: description: (Read-only) Auto-generated password set for user 'root' on an ESXi or Proxmox server.
The password is not stored and therefore will only be returned in response to provisioning a server. Copy and save it for future reference. readOnly: true @@ -1555,6 +1634,11 @@ components: readOnly: true type: string example: assigned + vlanId: + description: (Read-only) The VLAN on which this network has been configured within the network switch. + readOnly: true + type: integer + example: 10 PrivateNetworkConfiguration: type: object description: Private network details of bare metal server. @@ -1571,7 +1655,7 @@ components: default: USE_OR_CREATE_DEFAULT example: USER_DEFINED privateNetworks: - description: The list of private networks this server is member of. When this field is part of request body, it'll be used to specify the private networks to assign to this server upon provisioning. Used alongside the `USER_DEFINED` configurationType. + description: The list of private networks this server belongs to. If this field is part of a request body, it will be used for specifying the private networks to assign to this server upon provisioning. Used alongside the USER_DEFINED configurationType. type: array items: $ref: '#/components/schemas/ServerPrivateNetwork' @@ -1614,7 +1698,7 @@ components: - NONE default: PURCHASE_NEW ipBlocks: - description: Used to specify the previously purchased IP blocks to assign to this server upon provisioning. Used alongside the USER_DEFINED configurationType. + description: Used for specifying the previously purchased IPv4 blocks to assign to this server upon provisioning. Used alongside the USER_DEFINED configurationType. type: array maxItems: 1 items: @@ -1630,16 +1714,20 @@ components: type: string example: 60473c2509268bc77fd06d29 ips: - description: Configurable/configured IPs on the server.
At least 1 IP address is required. Valid IP format is single IP addresses. All IPs must be within the network's range.
Setting the `computeSlaacIp` field to `true` allows you to provide an empty array of IPs.
Additionally, setting the `force` query parameter to `true` allows you to:
  • Assign no specific IP addresses by designating an empty array of IPs. Note that at least one IP is required for the gateway address to be selected from this network.
  • Assign one or more IP addresses which are already configured on other resource(s) in network.
+ description: Configurable/configured IPs on the server.
At least 1 IP address is required. Valid IP formats include single IP addresses or IP ranges (IPv4 or IPv6). All IPs must be within the network's range.
Setting the `computeSlaacIp` field to `true` allows you to provide an empty array of IPs.
Additionally, setting the `force` query parameter to `true` allows you to:
  • Assign no specific IP addresses by designating an empty array of IPs. Note that at least one IP is required for the gateway address to be selected from this network.
  • Assign one or more IP addresses which are already configured on other resource(s) in network.
type: array items: type: string example: - 182.16.0.146 - - 2001:db8::b + - 10.1.1.20 - 10.1.1.25 + - 2001:db8::f + - 2001:db8::b - 2001:db8::d example: - 182.16.0.146 - - 2001:db8::b + - 10.1.1.20 - 10.1.1.25 + - 2001:db8::f + - 2001:db8::b - 2001:db8::d statusDescription: description: (Read-only) The status of the assignment to the network. readOnly: true @@ -1650,12 +1738,17 @@ components: writeOnly: true type: boolean example: true + vlanId: + description: (Read-only) The VLAN on which this network has been configured within the network switch. + readOnly: true + type: integer + example: 10 PublicNetworkConfiguration: type: object description: Public network details of bare metal server. properties: publicNetworks: - description: The list of public networks this server is member of. When this field is part of request body, it'll be used to specify the public networks to assign to this server upon provisioning. + description: The list of public networks this server belongs to. If this field is part of a request body, it will be used for specifying the public networks to assign to this server on provision. Only IPv4 addresses can be specified. type: array items: $ref: '#/components/schemas/ServerPublicNetwork' @@ -1753,15 +1846,15 @@ components: example: 'Server #1 used for computing.' maxLength: 250 os: - description: The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `rockylinux/rockylinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `proxmox/bullseye`, `proxmox/proxmox8`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`. + description: The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `rockylinux/rockylinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `debian/trixie`, `proxmox/bullseye`, `proxmox/proxmox8`, `proxmox/proxmox9`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`. type: string example: ubuntu/bionic type: - description: Server type ID. Cannot be changed once a server is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c1.small`, `d1.c2.small`, `d1.c3.small`, `d1.c4.small`, `d1.c1.medium`, `d1.c2.medium`, `d1.c3.medium`, `d1.c4.medium`, `d1.c1.large`, `d1.c2.large`, `d1.c3.large`, `d1.c4.large`, `d1.m1.medium`, `d1.m2.medium`, `d1.m3.medium`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `a1.c5.xlarge`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge`, `d3.g2.c3.xlarge`, s4.x6.c6.large or s4.x6.m6.xlarge. + description: Server type ID. Cannot be changed once a server is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c4.small`, `d1.c4.medium`, `d1.c4.large`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `a1.c5.xlarge`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge`, `d3.g2.c3.xlarge`, `d3.g3.c2.medium`, `s4.x6.c6.large`, `s4.x6.m6.xlarge`, `s5.x6.c3.medium`, `s5.x6.c3.large`, `s5.x6.c8.medium`, `s5.x6.c9.medium`, `s5.x6.c8.large`, `s5.x6.c9.large`, `s5.x6.m8.xlarge`, `s5.x6.m9.xlarge`, `s4.c3.medium`, `s4.c6.medium`, `s4.c6.large`, `s4.c6.xlarge`, `s4.s2.large`, `a2.c9.large` or `a2.c9.xlarge`. type: string example: s1.c1.small location: - description: Server location ID. Cannot be changed once a server is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. + description: Server location ID. Cannot be changed once a server is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. type: string example: PHX cpu: @@ -1911,15 +2004,15 @@ components: example: 'Server #1 used for computing.' maxLength: 250 os: - description: The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `rockylinux/rockylinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `proxmox/bullseye`, `proxmox/proxmox8`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`. + description: The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `rockylinux/rockylinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `debian/trixie`, `proxmox/bullseye`, `proxmox/proxmox8`, `proxmox/proxmox9`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`. type: string example: ubuntu/bionic type: - description: Server type ID. Cannot be changed once a server is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c1.small`, `d1.c2.small`, `d1.c3.small`, `d1.c4.small`, `d1.c1.medium`, `d1.c2.medium`, `d1.c3.medium`, `d1.c4.medium`, `d1.c1.large`, `d1.c2.large`, `d1.c3.large`, `d1.c4.large`, `d1.m1.medium`, `d1.m2.medium`, `d1.m3.medium`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `a1.c5.xlarge`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge`, `d3.g2.c3.xlarge`, s4.x6.c6.large or s4.x6.m6.xlarge. + description: Server type ID. Cannot be changed once a server is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c4.small`, `d1.c4.medium`, `d1.c4.large`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `a1.c5.xlarge`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge`, `d3.g2.c3.xlarge`,`d3.g3.c2.medium`, `s4.x6.c6.large`, `s4.x6.m6.xlarge`, `s5.x6.c3.medium`, `s5.x6.c3.large`, `s5.x6.c8.medium`, `s5.x6.c9.medium`, `s5.x6.c8.large`, `s5.x6.c9.large`, `s5.x6.m8.xlarge`, `s5.x6.m9.xlarge`, `s4.c3.medium`, `s4.c6.medium`, `s4.c6.large`, `s4.c6.xlarge`, `s4.s2.large`, `a2.c9.large` or `a2.c9.xlarge`. type: string example: s1.c1.small location: - description: Server location ID. Cannot be changed once a server is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. + description: Server location ID. Cannot be changed once a server is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. type: string example: PHX installDefaultSshKeys: @@ -2015,7 +2108,7 @@ components: description: Update network details of bare metal server. properties: ips: - description: List of IPs to be associated to the server.
Valid IP formats include single IP addresses or IP ranges (IPv4 or IPv6). IPs must be within the network's range.
Setting the `force` query parameter to `true` allows you to:
  • Assign no specific IP addresses by designating an empty array of IPs.
  • Assign one or more IP addresses which are already configured on other resource(s) in network.
  • Assign IP addresses which are considered as reserved in network.
+ description: List of IPs to be associated to the server.
Valid IP formats include single IP addresses or IP ranges (IPv4 or IPv6). All IPs must be within the network's range.
Setting the `force` query parameter to `true` allows you to:
  • Assign no specific IP addresses by designating an empty array of IPs.
  • Assign one or more IP addresses which are already configured on other resource(s) in network.
  • Assign IP addresses which are considered as reserved in network.
type: array items: type: string @@ -2049,7 +2142,7 @@ components: example: 'Server #1 used for computing.' maxLength: 250 os: - description: The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux8`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `proxmox/bullseye`, `proxmox/proxmox8`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`. + description: The server’s OS ID used when the server was created. Currently this field should be set to either `ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux8`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `debian/trixie`, `proxmox/bullseye`, `proxmox/proxmox8`, `proxmox/proxmox9`,`netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`. type: string example: ubuntu/bionic installDefaultSshKeys: @@ -2120,6 +2213,14 @@ components: - 172.217.22.14 - 10.111.14.40/29 - 10.111.14.66 - 10.111.14.71 + bringYourOwnLicense: + description: | + Use a Bring Your Own (BYO) Windows license. + If true, the server is provisioned in trial mode, and you must activate your own license. + If false (default), the server includes a managed Windows license billed by the platform. + type: boolean + example: false + default: false esxi: description: VMWare ESXi configuration properties. type: object @@ -2225,6 +2326,16 @@ components: description: Server pricing model. Currently this field should be set to `ONE_MONTH_RESERVATION`, `TWELVE_MONTHS_RESERVATION`, `TWENTY_FOUR_MONTHS_RESERVATION` or `THIRTY_SIX_MONTHS_RESERVATION`. type: string example: ONE_MONTH_RESERVATION + ReservationTransferDetails: + type: object + description: Reservation transfer details. + required: + - targetServerId + properties: + targetServerId: + description: ID of target server to transfer reservation to. + type: string + example: 54a21648dasda4s9843a17 SshKey: type: object description: SSH Key. diff --git a/specs/IpApi.spec.yaml b/specs/IpApi.spec.yaml index 4424ed36..bc0131ea 100644 --- a/specs/IpApi.spec.yaml +++ b/specs/IpApi.spec.yaml @@ -278,7 +278,7 @@ components: - cidrBlockSize properties: location: - description: IP Block location ID. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. + description: IP Block location ID. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. type: string example: PHX cidrBlockSize: @@ -314,7 +314,7 @@ components: type: string example: 6047127fed34ecc3ba8402d2 location: - description: IP Block location ID. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. + description: IP Block location ID. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. type: string example: PHX cidrBlockSize: diff --git a/specs/LocationApi.spec.yaml b/specs/LocationApi.spec.yaml index e9fbd1d5..8bc8b742 100644 --- a/specs/LocationApi.spec.yaml +++ b/specs/LocationApi.spec.yaml @@ -29,7 +29,7 @@ paths: description: Location of interest in: query schema: - $ref: '#/components/schemas/LocationEnum' + $ref: '#/components/schemas/ProductLocationEnum' example: ASH - name: productCategory required: false @@ -71,7 +71,7 @@ components: productCategoryDescription: Network storage properties: location: - $ref: '#/components/schemas/LocationEnum' + $ref: '#/components/schemas/ProductLocationEnum' locationDescription: type: string example: Phoenix, USA @@ -96,8 +96,14 @@ components: example: Bare metal server required: - productCategory - LocationEnum: - description: The location code. + ProductLocationEnum: + description: | + This enum is used only in product-related schemas and contains + only currently active and supported locations. + Deprecated or retired locations are intentionally excluded and will not appear + in create/update operations. + Historical data in other API responses may still reference deprecated locations, + but those values are not part of this enum. type: string enum: - PHX @@ -106,7 +112,6 @@ components: - SGP - CHI - SEA - - AUS ProductCategoryEnum: description: The product category. type: string diff --git a/specs/NetworkApi.spec.yaml b/specs/NetworkApi.spec.yaml index 8287094f..7ecc1d1d 100644 --- a/specs/NetworkApi.spec.yaml +++ b/specs/NetworkApi.spec.yaml @@ -53,7 +53,7 @@ paths: required: false description: If present will filter the result by the given location of the Private Networks. schema: - description: Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`. + description: Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`. type: string example: PHX responses: @@ -388,7 +388,7 @@ paths: required: false description: If present will filter the result by the given location of the Public Networks. schema: - description: Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`. + description: Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`. type: string example: PHX responses: @@ -943,7 +943,7 @@ paths: required: false description: If present will filter the result by the given location of the BGP Peer Group. schema: - description: Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`. + description: Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`. type: string example: PHX responses: @@ -959,6 +959,15 @@ paths: - id: 60473c2509268bc77fd06d29 status: READY location: ASH + ipPrefixes: + - ipAllocationId: 6047127fed34ecc3ba8402d2 + cidr: 10.111.14.40/29 + ipVersion: V4 + status: READY + - ipAllocationId: 6047127fed34ecc3ba8402e2 + cidr: 2607:ff00:313:80c0::/58 + ipVersion: V6 + status: READY ipv4Prefixes: - ipv4AllocationId: 6047127fed34ecc3ba8402d2 cidr: 10.111.14.40/29 @@ -980,6 +989,9 @@ paths: peeringLoopbacksV4: - 169.254.247.0 - 169.254.247.1 + peeringLoopbacksV6: + - fd00:0:0:1005::1 + - fd00:0:0:1005::2 keepAliveTimerSeconds: 10 holdTimerSeconds: 30 createdOn: '2024-03-01T10:30:00Z' @@ -987,6 +999,11 @@ paths: - id: 60473c2509268bc77fd06d30 status: READY location: PHX + ipPrefixes: + - ipAllocationId: 6047127fed34ecc3ba8402d3 + cidr: 10.121.14.40/29 + ipVersion: V4 + status: READY ipv4Prefixes: - ipv4AllocationId: 6047127fed34ecc3ba8402d3 cidr: 10.121.14.40/29 @@ -1008,6 +1025,9 @@ paths: peeringLoopbacksV4: - 170.254.247.0 - 170.254.247.1 + peeringLoopbacksV6: + - fd00:0:0:1005::1 + - fd00:0:0:1005::2 keepAliveTimerSeconds: 10 holdTimerSeconds: 30 createdOn: '2024-03-01T10:30:00Z' @@ -1060,6 +1080,15 @@ paths: id: 60473c2509268bc77fd06d29 status: PENDING location: PHX + ipPrefixes: + - ipAllocationId: 6047127fed34ecc3ba8402d2 + cidr: 10.111.14.40/29 + ipVersion: V4 + status: READY + - ipAllocationId: 6047127fed34ecc3ba8402e2 + cidr: 2607:ff00:313:80c0::/58 + ipVersion: V6 + status: READY ipv4Prefixes: - ipv4AllocationId: 6047127fed34ecc3ba8402d2 cidr: 10.111.14.40/29 @@ -1077,6 +1106,9 @@ paths: peeringLoopbacksV4: - 169.254.247.0 - 169.254.247.1 + peeringLoopbacksV6: + - fd00:0:0:1005::1 + - fd00:0:0:1005::2 keepAliveTimerSeconds: 10 holdTimerSeconds: 30 lastUpdatedOn: '2024-03-01T14:30:00Z' @@ -1085,6 +1117,15 @@ paths: id: 60473c2509268bc77fd06d29 status: PENDING location: ASH + ipPrefixes: + - ipAllocationId: 6047127fed34ecc3ba8402d2 + cidr: 10.111.14.40/29 + ipVersion: V4 + status: READY + - ipAllocationId: 6047127fed34ecc3ba8402e2 + cidr: 2607:ff00:313:80c0::/58 + ipVersion: V6 + status: READY ipv4Prefixes: - ipv4AllocationId: 6047127fed34ecc3ba8402d2 cidr: 10.111.14.40/29 @@ -1102,6 +1143,9 @@ paths: peeringLoopbacksV4: - 169.254.247.0 - 169.254.247.1 + peeringLoopbacksV6: + - fd00:0:0:1005::1 + - fd00:0:0:1005::2 keepAliveTimerSeconds: 10 holdTimerSeconds: 30 lastUpdatedOn: '2024-03-01T14:30:00Z' @@ -1146,6 +1190,15 @@ paths: id: 60473c2509268bc77fd06d29 status: READY location: ASH + ipPrefixes: + - ipAllocationId: 6047127fed34ecc3ba8402d2 + cidr: 10.111.14.40/29 + ipVersion: V4 + status: READY + - ipAllocationId: 6047127fed34ecc3ba8402e2 + cidr: 2607:ff00:313:80c0::/58 + ipVersion: V6 + status: READY ipv4Prefixes: - ipv4AllocationId: 6047127fed34ecc3ba8402d2 cidr: 10.111.14.40/29 @@ -1167,6 +1220,9 @@ paths: peeringLoopbacksV4: - 169.254.247.0 - 169.254.247.1 + peeringLoopbacksV6: + - fd00:0:0:1005::1 + - fd00:0:0:1005::2 keepAliveTimerSeconds: 10 holdTimerSeconds: 30 createdOn: '2024-03-01T10:30:00Z' @@ -1217,6 +1273,15 @@ paths: id: 60473c2509268bc77fd06d29 status: PENDING location: ASH + ipPrefixes: + - ipAllocationId: 6047127fed34ecc3ba8402d2 + cidr: 10.111.14.40/29 + ipVersion: V4 + status: READY + - ipAllocationId: 6047127fed34ecc3ba8402e2 + cidr: 2607:ff00:313:80c0::/58 + ipVersion: V6 + status: READY ipv4Prefixes: - ipv4AllocationId: 6047127fed34ecc3ba8402d2 cidr: 10.111.14.40/29 @@ -1238,6 +1303,9 @@ paths: peeringLoopbacksV4: - 169.254.247.0 - 169.254.247.1 + peeringLoopbacksV6: + - fd00:0:0:1005::1 + - fd00:0:0:1005::2 keepAliveTimerSeconds: 10 holdTimerSeconds: 30 createdOn: '2024-03-01T10:30:00Z' @@ -1247,6 +1315,15 @@ paths: id: 60473c2509268bc77fd06d29 status: PENDING location: ASH + ipPrefixes: + - ipAllocationId: 6047127fed34ecc3ba8402d2 + cidr: 10.111.14.40/29 + ipVersion: V4 + status: READY + - ipAllocationId: 6047127fed34ecc3ba8402e2 + cidr: 2607:ff00:313:80c0::/58 + ipVersion: V6 + status: READY ipv4Prefixes: - ipv4AllocationId: 6047127fed34ecc3ba8402d2 cidr: 10.111.14.40/29 @@ -1268,6 +1345,9 @@ paths: peeringLoopbacksV4: - 169.254.247.0 - 169.254.247.1 + peeringLoopbacksV6: + - fd00:0:0:1005::1 + - fd00:0:0:1005::2 keepAliveTimerSeconds: 10 holdTimerSeconds: 30 createdOn: '2024-03-01T10:30:00Z' @@ -1304,6 +1384,15 @@ paths: id: 60473c2509268bc77fd06d29 status: PENDING location: ASH + ipPrefixes: + - ipAllocationId: 6047127fed34ecc3ba8402d2 + cidr: 10.111.14.40/29 + ipVersion: V4 + status: READY + - ipAllocationId: 6047127fed34ecc3ba8402e2 + cidr: 2607:ff00:313:80c0::/58 + ipVersion: V6 + status: READY ipv4Prefixes: - ipv4AllocationId: 6047127fed34ecc3ba8402d2 cidr: 10.111.14.40/29 @@ -1325,10 +1414,15 @@ paths: peeringLoopbacksV4: - 169.254.247.0 - 169.254.247.1 + peeringLoopbacksV6: + - fd00:0:0:1005::1 + - fd00:0:0:1005::2 keepAliveTimerSeconds: 10 holdTimerSeconds: 30 createdOn: '2024-03-01T10:30:00Z' lastUpdatedOn: '2024-03-01T14:30:00Z' + '204': + description: The BGP Peer Group has been deleted. '400': $ref: '#/components/responses/BadRequest' '401': @@ -1500,7 +1594,7 @@ components: maxLength: 250 example: Further details on the network location: - description: The location of this private network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`. + description: The location of this private network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`. type: string example: PHX locationDefault: @@ -1594,7 +1688,7 @@ components: maxLength: 100 example: Sample Network location: - description: The location of this public network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`. + description: The location of this public network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`. type: string example: PHX description: @@ -1650,7 +1744,7 @@ components: maxLength: 250 example: Further details on the network. location: - description: The location of this public network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`. + description: The location of this public network. Supported values are `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`. type: string example: PHX vlanId: @@ -1691,7 +1785,8 @@ components: example: true BgpIPv4Prefix: type: object - description: The BGP IPv4 Prefix. + description: The BGP IPv4 Prefix. Deprecated in favour of generic BgpIpPrefix. + deprecated: true required: - ipv4AllocationId - cidr @@ -1720,6 +1815,31 @@ components: description: The Boolean value of the BGP IPv4 Prefix is in use. type: boolean example: false + BgpIpPrefix: + type: object + description: The BGP IP Prefix. + required: + - ipAllocationId + - cidr + - ipVersion + - status + properties: + ipAllocationId: + description: IP allocation ID. + type: string + example: 6047127fed34ecc3ba8402d2 + cidr: + description: The IP block in CIDR format, dependent on IP version. + type: string + example: 10.111.14.40/29 + ipVersion: + description: The IP block version. + type: string + example: V4 + status: + description: 'The BGP IP Prefix status. Can have one of the following values: `PENDING`, `BUSY`, `READY`, `ERROR` and `DELETING`.' + type: string + example: READY AsnDetails: type: object description: BGP Peer Group ASN details. @@ -1754,6 +1874,7 @@ components: - id - status - location + - ipPrefixes - ipv4Prefixes - targetAsnDetails - password @@ -1761,6 +1882,7 @@ components: - rpkiRoaOriginAsn - eBgpMultiHop - peeringLoopbacksV4 + - peeringLoopbacksV6 - keepAliveTimerSeconds - holdTimerSeconds properties: @@ -1773,14 +1895,20 @@ components: type: string example: READY location: - description: 'The BGP Peer Group location. Can have one of the following values: `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`.' + description: 'The BGP Peer Group location. Can have one of the following values: `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`.' type: string example: ASH ipv4Prefixes: - description: The List of the BGP Peer Group IPv4 prefixes. + description: The List of the BGP Peer Group IPv4 prefixes. Deprecated in favour of generic ipPrefixes. + deprecated: true type: array items: $ref: '#/components/schemas/BgpIPv4Prefix' + ipPrefixes: + description: The List of the BGP Peer Group IP prefixes. + type: array + items: + $ref: '#/components/schemas/BgpIpPrefix' targetAsnDetails: $ref: '#/components/schemas/AsnDetails' activeAsnDetails: @@ -1815,6 +1943,15 @@ components: example: - 169.254.247.0 - 169.254.247.1 + peeringLoopbacksV6: + description: The IPv6 Peering Loopback addresses of the BGP Peer Group. Valid IP formats are IPv6 addresses. + type: array + items: + type: string + example: fd00:0:0:1005::2 + example: + - fd00:0:0:1005::1 + - fd00:0:0:1005::2 keepAliveTimerSeconds: description: The Keep Alive Timer in seconds of the BGP Peer Group. type: integer @@ -1842,7 +1979,7 @@ components: - advertisedRoutes properties: location: - description: 'The BGP Peer Group location. Can have one of the following values: `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` and `AUS`.' + description: 'The BGP Peer Group location. Can have one of the following values: `PHX`, `ASH`, `SGP`, `NLD`, `CHI` and `SEA`.' type: string example: ASH asn: diff --git a/specs/RancherApi.spec.yaml b/specs/RancherApi.spec.yaml index 6c5249b3..52d3e443 100644 --- a/specs/RancherApi.spec.yaml +++ b/specs/RancherApi.spec.yaml @@ -35,7 +35,7 @@ paths: tags: - Clusters description: | - Create a Rancher Server Deployment as described in Rancher Docs Architecture. Rancher Server allows the creation, import and management of multiple Downstream User Kubernetes Clusters. + Create a Rancher Server Deployment as described in Rancher Docs Architecture. Rancher Server allows the creation, import and management of multiple Downstream User Kubernetes Clusters. This is not a Downstream User Cluster. Knowledge base article to help you can be found here. summary: Create a Rancher Server Deployment. security: @@ -257,7 +257,7 @@ components: type: string example: My first Rancher Server Cluster. location: - description: Deployment location. Cannot be changed once a cluster is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. + description: Deployment location. Cannot be changed once a cluster is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. type: string example: PHX initialClusterVersion: @@ -381,12 +381,12 @@ components: default: 1 example: 3 serverType: - description: Node server type. Cannot be changed once the cluster is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c1.small`, `d1.c2.small`, `d1.c3.small`, `d1.c4.small`, `d1.c1.medium`, `d1.c2.medium`, `d1.c3.medium`, `d1.c4.medium`, `d1.c1.large`, `d1.c2.large`, `d1.c3.large`, `d1.c4.large`, `d1.m1.medium`, `d1.m2.medium`, `d1.m3.medium`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge` or `d3.g2.c3.xlarge`. + description: Node server type. Cannot be changed once the cluster is created. Currently this field should be set to either `s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c4.small`, `d1.c4.medium`, `d1.c4.large`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge` or `d3.g2.c3.xlarge`. type: string default: s0.d1.small example: s0.d1.small location: - description: Workload cluster location. Cannot be changed once cluster is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`. + description: Workload cluster location. Cannot be changed once cluster is created. Currently this field should be set to `PHX`, `ASH`, `SGP`, `NLD`, `CHI` or `SEA`. type: string example: PHX SshConfig: diff --git a/template/README.mustache b/template/README.mustache index 3537dd51..9c601047 100644 --- a/template/README.mustache +++ b/template/README.mustache @@ -78,9 +78,9 @@ require '{{{gemName}}}' # Configure a proc to get access tokens in lieu of the static access_token configuration config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } {{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} # Configure API key authorization: {{{name}}} - config.api_key['{{{name}}}'] = 'YOUR API KEY' + config.api_key['{{{keyParamName}}}'] = 'YOUR API KEY' # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) - # config.api_key_prefix['{{{name}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}} + # config.api_key_prefix['{{{keyParamName}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}} # Configure OAuth2 access token for authorization: {{{name}}} config.access_token = 'YOUR ACCESS TOKEN' # Configure a proc to get access tokens in lieu of the static access_token configuration diff --git a/template/api_client.mustache b/template/api_client.mustache index 53e9e503..49e6e457 100644 --- a/template/api_client.mustache +++ b/template/api_client.mustache @@ -1,5 +1,6 @@ =begin {{> api_info}} + =end require 'date' @@ -13,6 +14,7 @@ require 'typhoeus' {{#isFaraday}} require 'faraday' require 'faraday/multipart' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0') +require 'marcel' {{/isFaraday}} {{#isHttpx}} require 'httpx' @@ -50,12 +52,15 @@ module {{moduleName}} {{#isTyphoeus}} {{> api_client_typhoeus_partial}} + {{/isTyphoeus}} {{#isFaraday}} {{> api_client_faraday_partial}} + {{/isFaraday}} {{#isHttpx}} {{> api_client_httpx_partial}} + {{/isHttpx}} # Check if the given MIME is a JSON MIME. # JSON MIME examples: @@ -66,7 +71,7 @@ module {{moduleName}} # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type. @@ -133,9 +138,13 @@ module {{moduleName}} data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else - # models (e.g. Pet) or oneOf + # models (e.g. Pet) or oneOf/anyOf klass = {{moduleName}}.const_get(return_type) - klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of) + klass.build(data) + else + klass.build_from_hash(data) + end end end @@ -145,7 +154,7 @@ module {{moduleName}} # @param [String] filename the filename to be sanitized # @return [String] the sanitized filename def sanitize_filename(filename) - filename.gsub(/.*[\/\\]/, '') + filename.split(/[\/\\]/).last end def build_request_url(path, opts = {}) @@ -245,4 +254,4 @@ module {{moduleName}} end end end -end +end \ No newline at end of file diff --git a/template/gemspec.mustache b/template/gemspec.mustache index e0167f52..7082c350 100644 --- a/template/gemspec.mustache +++ b/template/gemspec.mustache @@ -2,6 +2,7 @@ =begin {{> api_info}} + =end $:.push File.expand_path("../lib", __FILE__) @@ -11,25 +12,26 @@ Gem::Specification.new do |s| s.name = "{{gemName}}{{^gemName}}{{{appName}}}{{/gemName}}" s.version = {{moduleName}}::VERSION s.platform = Gem::Platform::RUBY - s.authors = ["PhoenixNAP"] + s.authors = ["{{gemAuthor}}{{^gemAuthor}}OpenAPI-Generator{{/gemAuthor}}"] s.email = ["{{gemAuthorEmail}}{{^gemAuthorEmail}}{{infoEmail}}{{/gemAuthorEmail}}"] - s.homepage = "https://phoenixnap.com/bare-metal-cloud" + s.homepage = "{{gemHomepage}}{{^gemHomepage}}https://openapi-generator.tech{{/gemHomepage}}" s.summary = "{{gemSummary}}{{^gemSummary}}{{{appName}}} Ruby Gem{{/gemSummary}}" - s.description = "{{gemSummary}}{{^gemSummary}}{{{appName}}} Ruby Gem{{/gemSummary}}" + s.description = "{{gemDescription}}{{^gemDescription}}{{{appDescription}}}{{^appDescription}}{{{appName}}} Ruby Gem{{/appDescription}}{{/gemDescription}}" s.license = "{{{gemLicense}}}{{^gemLicense}}Unlicense{{/gemLicense}}" s.required_ruby_version = "{{{gemRequiredRubyVersion}}}{{^gemRequiredRubyVersion}}>= 2.7{{/gemRequiredRubyVersion}}" - s.metadata = { "source_code_uri" => "https://github.com/phoenixnap/ruby-sdk-bmc" } + s.metadata = {{{gemMetadata}}}{{^gemMetadata}}{}{{/gemMetadata}} {{#isFaraday}} s.add_runtime_dependency 'faraday', '>= 1.0.1', '< 3.0' s.add_runtime_dependency 'faraday-multipart' + s.add_runtime_dependency 'marcel' {{/isFaraday}} {{#isTyphoeus}} s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' -{{/isTyphoeus}} + {{/isTyphoeus}} {{#isHttpx}} -s.add_runtime_dependency 'httpx', '~> 1.0', '>= 1.0.0' -{{/isHttpx}} + s.add_runtime_dependency 'httpx', '~> 1.0', '>= 1.0.0' + {{/isHttpx}} s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0' @@ -37,4 +39,4 @@ s.add_runtime_dependency 'httpx', '~> 1.0', '>= 1.0.0' s.test_files = `find spec/*`.split("\n") s.executables = [] s.require_paths = ["lib"] -end +end \ No newline at end of file diff --git a/template/partial_oneof_module.mustache b/template/partial_oneof_module.mustache index 2782e6ac..8016cab8 100644 --- a/template/partial_oneof_module.mustache +++ b/template/partial_oneof_module.mustache @@ -72,8 +72,7 @@ openapi_one_of.each do |klass| begin next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data + return find_and_cast_into_type(klass, data) rescue # rescue all errors so we keep iterating even if the current item lookup raises end end @@ -101,7 +100,7 @@ when 'Time' return Time.parse(data) when 'Date' - return Date.parse(data) + return Date.iso8601(data) when 'String' return data if data.instance_of?(String) when 'Object' # "type: object" @@ -124,9 +123,9 @@ return model if model else # raise if data contains keys that are not known to the model - raise unless (data.keys - const.acceptable_attributes).empty? + raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty? model = const.build_from_hash(data) - return model if model && model.valid? + return model if model end end end @@ -137,4 +136,4 @@ end {{/discriminator}} end - end + end \ No newline at end of file diff --git a/tests/README.md b/tests/README.md index b3432557..7739109a 100644 --- a/tests/README.md +++ b/tests/README.md @@ -27,4 +27,13 @@ Tests can be run per-module by running its respective `tc_` script, or all at on ```sh bundler exec ruby ./ts_sdk.rb -``` \ No newline at end of file +``` + +### NixOS +When using **NixOS** the above *will not work*, as it will not find the `libcurl.so.4` library. + +First, get `bundix` - then run `nix-setup.sh`. One thing to note is that this script will *temporarily* modify the `Gemfile` to use **absolute paths** instead of relative ones. +It will then open a *nix shell* for you, at which point you can just do `bundler exec ruby ./ts_sdk.rb` to run all tests. Once you're done, run `exit` and the shell will close, +with the old `Gemfile` being restored. + +If it *doesn't* get restored, just replace the `Gemfile` with `Gemfile.old`. Otherwise, the absolute paths can be manually changed into relative ones. \ No newline at end of file diff --git a/tests/default.nix b/tests/default.nix new file mode 100644 index 00000000..22000c16 --- /dev/null +++ b/tests/default.nix @@ -0,0 +1,14 @@ +with (import {}); +let + gems = bundlerEnv { + name = "your-package"; + inherit ruby; + gemdir = ./.; + }; +in +mkShell { + packages = [ + gems + gems.wrappedRuby + ]; +} \ No newline at end of file diff --git a/tests/gemset.nix b/tests/gemset.nix new file mode 100644 index 00000000..74f0ea7d --- /dev/null +++ b/tests/gemset.nix @@ -0,0 +1,312 @@ +{ + base64 = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0yx9yn47a8lkfcjmigk79fykxvr80r4m1i35q82sxzynpbm7lcr7"; + type = "gem"; + }; + version = "0.3.0"; + }; + bigdecimal = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "19y406nx17arzsbc515mjmr6k5p59afprspa1k423yd9cp8d61wb"; + type = "gem"; + }; + version = "4.0.1"; + }; + ethon = { + dependencies = ["ffi" "logger"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1cpwds6mpija1bwh8p89fqa993llssvi81w5ic3cnj04yg4sz65m"; + type = "gem"; + }; + version = "0.18.0"; + }; + faraday = { + dependencies = ["faraday-net_http" "json" "logger"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "077n5ss3z3ds4vj54w201kd12smai853dp9c9n7ii7g3q7nwwg54"; + type = "gem"; + }; + version = "2.14.1"; + }; + faraday-net_http = { + dependencies = ["net-http"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0v4hfmc7d4lrqqj2wl366rm9551gd08zkv2ppwwnjlnkc217aizi"; + type = "gem"; + }; + version = "3.4.2"; + }; + ffi = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1kqasqvy8d7r09ri4n6bkdwbk63j7afd9ilsw34nzlgh0qp69ldw"; + type = "gem"; + }; + version = "1.17.4"; + }; + json = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1z9grvjyfz16ag55hg522d3q4dh07hf391sf9s96npc0vfi85xkz"; + type = "gem"; + }; + version = "2.6.1"; + }; + jwt = { + dependencies = ["base64"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1x64l31nkqjwfv51s2vsm0yqq4cwzrlnji12wvaq761myx3fxq9i"; + type = "gem"; + }; + version = "2.10.2"; + }; + logger = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "00q2zznygpbls8asz5knjvvj2brr3ghmqxgr83xnrdj4rk3xwvhr"; + type = "gem"; + }; + version = "1.7.0"; + }; + multi_json = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1drisvysgvnjlz49a0qcbs294id6mvj3i8iik5rvym68ybwfzvvs"; + type = "gem"; + }; + version = "1.19.1"; + }; + multi_xml = { + dependencies = ["bigdecimal"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0nnzdswa9l6w8k5ndgbv5al9f0jkg14dqwzyic4fjd5c1cls1nxd"; + type = "gem"; + }; + version = "0.8.1"; + }; + net-http = { + dependencies = ["uri"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "15k96fj6qwbaiv6g52l538ass95ds1qwgynqdridz29yqrkhpfi5"; + type = "gem"; + }; + version = "0.9.1"; + }; + oauth2 = { + dependencies = ["faraday" "jwt" "multi_json" "multi_xml" "rack"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "16sk9h6a6vzqxf8v1fisa8jq5cj9sw4mwc7azy5gj2w1whkfa5dp"; + type = "gem"; + }; + version = "1.4.9"; + }; + pnap_audit_api = { + dependencies = ["typhoeus"]; + groups = ["default"]; + platforms = []; + source = { + path = /home/jenk/workspace/sdks/ruby-sdk-bmc/AuditApi; + type = "path"; + }; + version = "2.0.5"; + }; + pnap_billing_api = { + dependencies = ["typhoeus"]; + groups = ["default"]; + platforms = []; + source = { + path = /home/jenk/workspace/sdks/ruby-sdk-bmc/BillingApi; + type = "path"; + }; + version = "3.0.0"; + }; + pnap_bmc_api = { + dependencies = ["typhoeus"]; + groups = ["default"]; + platforms = []; + source = { + path = /home/jenk/workspace/sdks/ruby-sdk-bmc/BmcApi; + type = "path"; + }; + version = "2.3.0"; + }; + pnap_invoicing_api = { + dependencies = ["typhoeus"]; + groups = ["default"]; + platforms = []; + source = { + path = /home/jenk/workspace/sdks/ruby-sdk-bmc/InvoicingApi; + type = "path"; + }; + version = "1.0.5"; + }; + pnap_ip_api = { + dependencies = ["typhoeus"]; + groups = ["default"]; + platforms = []; + source = { + path = /home/jenk/workspace/sdks/ruby-sdk-bmc/IpApi; + type = "path"; + }; + version = "2.3.0"; + }; + pnap_location_api = { + dependencies = ["typhoeus"]; + groups = ["default"]; + platforms = []; + source = { + path = /home/jenk/workspace/sdks/ruby-sdk-bmc/LocationApi; + type = "path"; + }; + version = "3.0.0"; + }; + pnap_network_api = { + dependencies = ["typhoeus"]; + groups = ["default"]; + platforms = []; + source = { + path = /home/jenk/workspace/sdks/ruby-sdk-bmc/NetworkApi; + type = "path"; + }; + version = "2.2.0"; + }; + pnap_network_storage_api = { + dependencies = ["typhoeus"]; + groups = ["default"]; + platforms = []; + source = { + path = /home/jenk/workspace/sdks/ruby-sdk-bmc/NetworkStorageApi; + type = "path"; + }; + version = "2.0.5"; + }; + pnap_payments_api = { + dependencies = ["typhoeus"]; + groups = ["default"]; + platforms = []; + source = { + path = /home/jenk/workspace/sdks/ruby-sdk-bmc/PaymentsApi; + type = "path"; + }; + version = "1.0.5"; + }; + pnap_rancher_api = { + dependencies = ["typhoeus"]; + groups = ["default"]; + platforms = []; + source = { + path = /home/jenk/workspace/sdks/ruby-sdk-bmc/RancherApi; + type = "path"; + }; + version = "2.0.5"; + }; + pnap_tag_api = { + dependencies = ["typhoeus"]; + groups = ["default"]; + platforms = []; + source = { + path = /home/jenk/workspace/sdks/ruby-sdk-bmc/TagApi; + type = "path"; + }; + version = "2.0.5"; + }; + power_assert = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "00s1sfjak8w3f12g66ldb61xjavr5p2wvkflziiyhx6c2rkqgscc"; + type = "gem"; + }; + version = "3.0.1"; + }; + rack = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0hj5yq200wlq1clpdvh44pqwllbxll0k3gjajxnrcn95hxzhpky5"; + type = "gem"; + }; + version = "2.2.22"; + }; + test-unit = { + dependencies = ["power_assert"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0h0gpi3fggfa76sbm5kh48ma79z41yh6y7n3lxmaqrbf3zqyjlcw"; + type = "gem"; + }; + version = "3.5.3"; + }; + test-unit-runner-junitxml = { + dependencies = ["test-unit"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "047jih0v03db1pb4z7c46ky4x4w8hxli8z3fqr760s2mdagrpw1p"; + type = "gem"; + }; + version = "1.0.0"; + }; + typhoeus = { + dependencies = ["ethon"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "079k9j2alxxqn8r3vfm1anwp16v9s5f27p01k3i4g59p7v143k5s"; + type = "gem"; + }; + version = "1.6.0"; + }; + uri = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1ijpbj7mdrq7rhpq2kb51yykhrs2s54wfs6sm9z3icgz4y6sb7rp"; + type = "gem"; + }; + version = "1.1.1"; + }; +} diff --git a/tests/nix-setup.sh b/tests/nix-setup.sh new file mode 100755 index 00000000..4dcaef93 --- /dev/null +++ b/tests/nix-setup.sh @@ -0,0 +1,37 @@ +if command -v bundix >/dev/null 2>&1; then + echo "bundix is installed - continuing..." +else + echo "bundix is missing! please add it to your nix configuration first." + exit 1 +fi + +cp Gemfile Gemfile.old + +cd .. +pwd=$(pwd) +cd tests + +echo "getting parent directory: $pwd" + +escaped_pwd=${pwd//\//\\\/} + +echo "escaping directory: $escaped_pwd" + +echo "turning relative path in Gemfile to absolute..." +sed -i "s/'..\//'$escaped_pwd\//g" Gemfile + +echo "removing lockfile to refresh dependencies..." +rm -f Gemfile.lock + +echo "removing gemset.nix if present..." +rm -f gemset.nix + +echo "executing bundix..." +bundix -l + +echo "entering shell..." +nix-shell + +echo "exited shell..." +echo "undoing changes to Gemfile..." +mv Gemfile.old Gemfile \ No newline at end of file diff --git a/tests/payloads/billingapi/reservations/reservations_actions_convert.json b/tests/payloads/billingapi/reservations/reservations_actions_convert.json index 66f71c0a..34e4b011 100644 --- a/tests/payloads/billingapi/reservations/reservations_actions_convert.json +++ b/tests/payloads/billingapi/reservations/reservations_actions_convert.json @@ -10,7 +10,11 @@ "body": { "type": "JSON", "json": { - "sku": "XXX-XXX-XXX" + "sku": "XXX-XXX-XXX", + "quantity": { + "quantity": 30.0, + "unit": "TB" + } }, "matchType": "STRICT" } @@ -29,6 +33,11 @@ "lastRenewalDateTime": "2020-03-19T16:39:00Z", "nextRenewalDateTime": "2020-03-19T16:39:00Z", "nextBillingDate": "2020-04-19", + "reservationState": "ACTIVE", + "quantity": { + "unit": "TB", + "quantity": 30 + }, "autoRenew": true, "sku": "XXX-XXX-XXX", "price": 175, diff --git a/tests/payloads/billingapi/reservations/reservations_actions_disable_auto_renew.json b/tests/payloads/billingapi/reservations/reservations_actions_disable_auto_renew.json index ce2b6506..ba5ac42a 100644 --- a/tests/payloads/billingapi/reservations/reservations_actions_disable_auto_renew.json +++ b/tests/payloads/billingapi/reservations/reservations_actions_disable_auto_renew.json @@ -29,6 +29,11 @@ "lastRenewalDateTime": "2020-03-19T16:39:00Z", "nextRenewalDateTime": "2020-03-19T16:39:00Z", "nextBillingDate": "2020-04-19", + "reservationState": "ACTIVE", + "quantity": { + "unit": "TB", + "quantity": 30 + }, "autoRenew": true, "sku": "XXX-XXX-XXX", "price": 175, diff --git a/tests/payloads/billingapi/reservations/reservations_actions_enable_auto_renew.json b/tests/payloads/billingapi/reservations/reservations_actions_enable_auto_renew.json index 43964817..c909038f 100644 --- a/tests/payloads/billingapi/reservations/reservations_actions_enable_auto_renew.json +++ b/tests/payloads/billingapi/reservations/reservations_actions_enable_auto_renew.json @@ -22,6 +22,11 @@ "lastRenewalDateTime": "2020-03-19T16:39:00Z", "nextRenewalDateTime": "2020-03-19T16:39:00Z", "nextBillingDate": "2020-04-19", + "reservationState": "ACTIVE", + "quantity": { + "unit": "TB", + "quantity": 30 + }, "autoRenew": true, "sku": "XXX-XXX-XXX", "price": 175, diff --git a/tests/payloads/billingapi/reservations/reservations_get.json b/tests/payloads/billingapi/reservations/reservations_get.json index 43335283..992bf00f 100644 --- a/tests/payloads/billingapi/reservations/reservations_get.json +++ b/tests/payloads/billingapi/reservations/reservations_get.json @@ -26,6 +26,11 @@ "lastRenewalDateTime": "2020-03-19T16:39:00Z", "nextRenewalDateTime": "2020-03-19T16:39:00Z", "nextBillingDate": "2020-04-19", + "reservationState": "ACTIVE", + "quantity": { + "unit": "TB", + "quantity": 30 + }, "autoRenew": true, "sku": "XXX-XXX-XXX", "price": 175, diff --git a/tests/payloads/billingapi/reservations/reservations_get_by_id.json b/tests/payloads/billingapi/reservations/reservations_get_by_id.json index c7fe5da8..9bb3cb3d 100644 --- a/tests/payloads/billingapi/reservations/reservations_get_by_id.json +++ b/tests/payloads/billingapi/reservations/reservations_get_by_id.json @@ -22,6 +22,11 @@ "lastRenewalDateTime": "2020-03-19T16:39:00Z", "nextRenewalDateTime": "2020-03-19T16:39:00Z", "nextBillingDate": "2020-04-19", + "reservationState": "ACTIVE", + "quantity": { + "unit": "TB", + "quantity": 30 + }, "autoRenew": true, "sku": "XXX-XXX-XXX", "price": 175, diff --git a/tests/payloads/billingapi/reservations/reservations_post.json b/tests/payloads/billingapi/reservations/reservations_post.json index aaa1de7d..037bf9e8 100644 --- a/tests/payloads/billingapi/reservations/reservations_post.json +++ b/tests/payloads/billingapi/reservations/reservations_post.json @@ -5,7 +5,11 @@ "body": { "type": "JSON", "json": { - "sku": "XXX-XXX-XXX" + "sku": "XXX-XXX-XXX", + "quantity": { + "unit": "TB", + "quantity": 30.0 + } }, "matchType": "STRICT" } @@ -24,6 +28,11 @@ "lastRenewalDateTime": "2020-03-19T16:39:00Z", "nextRenewalDateTime": "2020-03-19T16:39:00Z", "nextBillingDate": "2020-04-19", + "reservationState": "ACTIVE", + "quantity": { + "unit": "TB", + "quantity": 30 + }, "autoRenew": true, "sku": "XXX-XXX-XXX", "price": 175, diff --git a/tests/payloads/bmcapi/servers/servers_action_provision.json b/tests/payloads/bmcapi/servers/servers_action_provision.json index cfc5ce69..74ce8af6 100644 --- a/tests/payloads/bmcapi/servers/servers_action_provision.json +++ b/tests/payloads/bmcapi/servers/servers_action_provision.json @@ -46,7 +46,8 @@ "172.217.22.14", "10.111.14.40/29", "10.111.14.66 - 10.111.14.71" - ] + ], + "bringYourOwnLicense": false }, "rootPassword": "MyP@ssw0rd_01", "managementUiUrl": "https://172.217.22.14", @@ -165,7 +166,8 @@ "172.217.22.14", "10.111.14.40/29", "10.111.14.66 - 10.111.14.71" - ] + ], + "bringYourOwnLicense": false }, "rootPassword": "MyP@ssw0rd_01", "managementUiUrl": "https://172.217.22.14", diff --git a/tests/payloads/bmcapi/servers/servers_action_reserve.json b/tests/payloads/bmcapi/servers/servers_action_reserve.json index 63abf91c..00e838a9 100644 --- a/tests/payloads/bmcapi/servers/servers_action_reserve.json +++ b/tests/payloads/bmcapi/servers/servers_action_reserve.json @@ -69,7 +69,8 @@ "172.217.22.14", "10.111.14.40/29", "10.111.14.66 - 10.111.14.71" - ] + ], + "bringYourOwnLicense": false }, "rootPassword": "MyP@ssw0rd_01", "managementUiUrl": "https://172.217.22.14", diff --git a/tests/payloads/bmcapi/servers/servers_action_reset.json b/tests/payloads/bmcapi/servers/servers_action_reset.json index 467932b0..a02e52e1 100644 --- a/tests/payloads/bmcapi/servers/servers_action_reset.json +++ b/tests/payloads/bmcapi/servers/servers_action_reset.json @@ -21,7 +21,8 @@ "windows": { "rdpAllowedIps": [ "172.217.22.14" - ] + ], + "bringYourOwnLicense": false }, "esxi": { "rootPassword": "MyP@ssw0rd_01", @@ -51,7 +52,8 @@ "windows": { "rdpAllowedIps": [ "172.217.22.14" - ] + ], + "bringYourOwnLicense": false }, "esxi": { "rootPassword": "MyP@ssw0rd_01", diff --git a/tests/payloads/bmcapi/servers/servers_get.json b/tests/payloads/bmcapi/servers/servers_get.json index 4f514951..709d9bf3 100644 --- a/tests/payloads/bmcapi/servers/servers_get.json +++ b/tests/payloads/bmcapi/servers/servers_get.json @@ -66,7 +66,8 @@ "172.217.22.14", "10.111.14.40/29", "10.111.14.66 - 10.111.14.71" - ] + ], + "bringYourOwnLicense": false }, "rootPassword": "MyP@ssw0rd_01", "managementUiUrl": "https://172.217.22.14", diff --git a/tests/payloads/bmcapi/servers/servers_get_by_id.json b/tests/payloads/bmcapi/servers/servers_get_by_id.json index ad468d8b..8b595a17 100644 --- a/tests/payloads/bmcapi/servers/servers_get_by_id.json +++ b/tests/payloads/bmcapi/servers/servers_get_by_id.json @@ -62,7 +62,8 @@ "172.217.22.14", "10.111.14.40/29", "10.111.14.66 - 10.111.14.71" - ] + ], + "bringYourOwnLicense": false }, "rootPassword": "MyP@ssw0rd_01", "managementUiUrl": "https://172.217.22.14", diff --git a/tests/payloads/bmcapi/servers/servers_patch_by_id.json b/tests/payloads/bmcapi/servers/servers_patch_by_id.json index 1c9aca9d..d04ef9bb 100644 --- a/tests/payloads/bmcapi/servers/servers_patch_by_id.json +++ b/tests/payloads/bmcapi/servers/servers_patch_by_id.json @@ -70,7 +70,8 @@ "172.217.22.14", "10.111.14.40/29", "10.111.14.66 - 10.111.14.71" - ] + ], + "bringYourOwnLicense": false }, "rootPassword": "MyP@ssw0rd_01", "managementUiUrl": "https://172.217.22.14", diff --git a/tests/payloads/bmcapi/servers/servers_post.json b/tests/payloads/bmcapi/servers/servers_post.json index 5d8651bf..8dfb3962 100644 --- a/tests/payloads/bmcapi/servers/servers_post.json +++ b/tests/payloads/bmcapi/servers/servers_post.json @@ -51,7 +51,8 @@ "172.217.22.14", "10.111.14.40/29", "10.111.14.66 - 10.111.14.71" - ] + ], + "bringYourOwnLicense": false }, "rootPassword": "MyP@ssw0rd_01", "managementUiUrl": "https://172.217.22.14", @@ -188,7 +189,8 @@ "172.217.22.14", "10.111.14.40/29", "10.111.14.66 - 10.111.14.71" - ] + ], + "bringYourOwnLicense": false }, "rootPassword": "MyP@ssw0rd_01", "managementUiUrl": "https://172.217.22.14", @@ -261,6 +263,12 @@ ] } }, + "storageConfiguration": { + "rootPartition": { + "raid": "NO_RAID", + "size": -1 + } + }, "supersededBy": "64a539b8d9c2c9ba8424ca31", "supersedes": "64a539b8d9c2c9ba8424ca31" } diff --git a/tests/payloads/bmcapi/servers/servers_put_tags_by_id.json b/tests/payloads/bmcapi/servers/servers_put_tags_by_id.json index 12e8f2a2..3fc3186b 100644 --- a/tests/payloads/bmcapi/servers/servers_put_tags_by_id.json +++ b/tests/payloads/bmcapi/servers/servers_put_tags_by_id.json @@ -72,7 +72,8 @@ "172.217.22.14", "10.111.14.40/29", "10.111.14.66 - 10.111.14.71" - ] + ], + "bringYourOwnLicense": false }, "rootPassword": "MyP@ssw0rd_01", "managementUiUrl": "https://172.217.22.14", diff --git a/tests/payloads/networkapi/bgp_peer_groups_delete_by_id.json b/tests/payloads/networkapi/bgp_peer_groups_delete_by_id.json index 46baf859..a433c81e 100644 --- a/tests/payloads/networkapi/bgp_peer_groups_delete_by_id.json +++ b/tests/payloads/networkapi/bgp_peer_groups_delete_by_id.json @@ -23,6 +23,14 @@ "inUse": false } ], + "ipPrefixes": [ + { + "ipAllocationId": "6047127fed34ecc3ba8402d2", + "cidr": "10.111.14.40/29", + "status": "READY", + "ipVersion": "v6" + } + ], "targetAsnDetails": { "asn": 9131072, "isBringYourOwn": true, @@ -42,6 +50,10 @@ "peeringLoopbacksV4": [ "test" ], + "peeringLoopbacksV6": [ + "1000::", + "1000::" + ], "keepAliveTimerSeconds": 3600, "holdTimerSeconds": 7200, "createdOn": "2022-04-07T13:20:30.491Z", diff --git a/tests/payloads/networkapi/bgp_peer_groups_get.json b/tests/payloads/networkapi/bgp_peer_groups_get.json index de9166ef..5a1596f4 100644 --- a/tests/payloads/networkapi/bgp_peer_groups_get.json +++ b/tests/payloads/networkapi/bgp_peer_groups_get.json @@ -27,6 +27,14 @@ "inUse": false } ], + "ipPrefixes": [ + { + "ipAllocationId": "6047127fed34ecc3ba8402d2", + "cidr": "10.111.14.40/29", + "status": "READY", + "ipVersion": "v6" + } + ], "targetAsnDetails": { "asn": 9131072, "isBringYourOwn": true, @@ -46,6 +54,10 @@ "peeringLoopbacksV4": [ "test" ], + "peeringLoopbacksV6": [ + "1000::", + "1000::" + ], "keepAliveTimerSeconds": 3600, "holdTimerSeconds": 7200, "createdOn": "2022-04-07T13:20:30.491Z", diff --git a/tests/payloads/networkapi/bgp_peer_groups_get_by_id.json b/tests/payloads/networkapi/bgp_peer_groups_get_by_id.json index d481ba0c..9ea0f22f 100644 --- a/tests/payloads/networkapi/bgp_peer_groups_get_by_id.json +++ b/tests/payloads/networkapi/bgp_peer_groups_get_by_id.json @@ -23,6 +23,14 @@ "inUse": false } ], + "ipPrefixes": [ + { + "ipAllocationId": "6047127fed34ecc3ba8402d2", + "cidr": "10.111.14.40/29", + "status": "READY", + "ipVersion": "v6" + } + ], "targetAsnDetails": { "asn": 9131072, "isBringYourOwn": true, @@ -42,6 +50,10 @@ "peeringLoopbacksV4": [ "test" ], + "peeringLoopbacksV6": [ + "1000::", + "1000::" + ], "keepAliveTimerSeconds": 3600, "holdTimerSeconds": 7200, "createdOn": "2022-04-07T13:20:30.491Z", diff --git a/tests/payloads/networkapi/bgp_peer_groups_patch_by_id.json b/tests/payloads/networkapi/bgp_peer_groups_patch_by_id.json index f24b5c6d..94ade9e3 100644 --- a/tests/payloads/networkapi/bgp_peer_groups_patch_by_id.json +++ b/tests/payloads/networkapi/bgp_peer_groups_patch_by_id.json @@ -32,6 +32,14 @@ "inUse": false } ], + "ipPrefixes": [ + { + "ipAllocationId": "6047127fed34ecc3ba8402d2", + "cidr": "10.111.14.40/29", + "status": "READY", + "ipVersion": "v6" + } + ], "targetAsnDetails": { "asn": 9131072, "isBringYourOwn": true, @@ -51,6 +59,10 @@ "peeringLoopbacksV4": [ "test" ], + "peeringLoopbacksV6": [ + "1000::", + "1000::" + ], "keepAliveTimerSeconds": 3600, "holdTimerSeconds": 7200, "createdOn": "2022-04-07T13:20:30.491Z", diff --git a/tests/payloads/networkapi/bgp_peer_groups_post.json b/tests/payloads/networkapi/bgp_peer_groups_post.json index f30af5a1..9e5ead60 100644 --- a/tests/payloads/networkapi/bgp_peer_groups_post.json +++ b/tests/payloads/networkapi/bgp_peer_groups_post.json @@ -28,6 +28,14 @@ "inUse": false } ], + "ipPrefixes": [ + { + "ipAllocationId": "6047127fed34ecc3ba8402d2", + "cidr": "10.111.14.40/29", + "status": "READY", + "ipVersion": "v6" + } + ], "targetAsnDetails": { "asn": 9131072, "isBringYourOwn": true, @@ -47,6 +55,10 @@ "peeringLoopbacksV4": [ "test" ], + "peeringLoopbacksV6": [ + "1000::", + "1000::" + ], "keepAliveTimerSeconds": 3600, "holdTimerSeconds": 7200, "createdOn": "2022-04-07T13:20:30.491Z", diff --git a/tests/payloads/networkapi/public_networks_get.json b/tests/payloads/networkapi/public_networks_get.json index de5b5102..fa7df10a 100644 --- a/tests/payloads/networkapi/public_networks_get.json +++ b/tests/payloads/networkapi/public_networks_get.json @@ -21,10 +21,14 @@ "description": "My first public network #1", "ipBlocks": [ { - "id": "60473a6115e34466c9f8f083" + "id": "60473a6115e34466c9f8f083", + "cidr": "10.0.0.0/24", + "usedIpsCount": "99" }, { - "id": "616e6ec6d66b406a45ab8797" + "id": "616e6ec6d66b406a45ab8797", + "cidr": "10.0.0.0/24", + "usedIpsCount": "99" } ], "status": "BUSY", diff --git a/tests/payloads/networkapi/public_networks_get_by_id.json b/tests/payloads/networkapi/public_networks_get_by_id.json index 9ef18ae4..188c602f 100644 --- a/tests/payloads/networkapi/public_networks_get_by_id.json +++ b/tests/payloads/networkapi/public_networks_get_by_id.json @@ -17,10 +17,14 @@ "description": "My first public network #1", "ipBlocks": [ { - "id": "60473a6115e34466c9f8f083" + "id": "60473a6115e34466c9f8f083", + "cidr": "10.0.0.0/24", + "usedIpsCount": "99" }, { - "id": "616e6ec6d66b406a45ab8797" + "id": "616e6ec6d66b406a45ab8797", + "cidr": "10.0.0.0/24", + "usedIpsCount": "99" } ], "status": "BUSY", diff --git a/tests/payloads/networkapi/public_networks_patch_by_id.json b/tests/payloads/networkapi/public_networks_patch_by_id.json index cdcc6142..d4d69343 100644 --- a/tests/payloads/networkapi/public_networks_patch_by_id.json +++ b/tests/payloads/networkapi/public_networks_patch_by_id.json @@ -25,10 +25,14 @@ "description": "My first public network #1", "ipBlocks": [ { - "id": "60473a6115e34466c9f8f083" + "id": "60473a6115e34466c9f8f083", + "cidr": "10.0.0.0/24", + "usedIpsCount": "99" }, { - "id": "616e6ec6d66b406a45ab8797" + "id": "616e6ec6d66b406a45ab8797", + "cidr": "10.0.0.0/24", + "usedIpsCount": "99" } ], "status": "BUSY", diff --git a/tests/payloads/networkapi/public_networks_post.json b/tests/payloads/networkapi/public_networks_post.json index dcf653ee..4dc1a148 100644 --- a/tests/payloads/networkapi/public_networks_post.json +++ b/tests/payloads/networkapi/public_networks_post.json @@ -27,7 +27,9 @@ "description": "My first public network #1", "ipBlocks": [ { - "id": "60473a6115e34466c9f8f083" + "id": "60473a6115e34466c9f8f083", + "cidr": "10.0.0.0/24", + "usedIpsCount": "99" } ], "status": "BUSY", diff --git a/tests/payloads/networkapi/public_networks_post_ip_block.json b/tests/payloads/networkapi/public_networks_post_ip_block.json index d1dd9b9a..fd65feb1 100644 --- a/tests/payloads/networkapi/public_networks_post_ip_block.json +++ b/tests/payloads/networkapi/public_networks_post_ip_block.json @@ -10,7 +10,9 @@ "body": { "type": "JSON", "json": { - "id": "60473a6115e34466c9f8f083" + "id": "60473a6115e34466c9f8f083", + "cidr": "10.0.0.0/24", + "usedIpsCount": "99" }, "matchType": "STRICT" } @@ -18,7 +20,9 @@ "response": { "statusCode": 202, "body": { - "id": "60473a6115e34466c9f8f083" + "id": "60473a6115e34466c9f8f083", + "cidr": "10.0.0.0/24", + "usedIpsCount": "99" } } }