oci 2.4.7 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +18 -1
- data/lib/oci.rb +1 -0
- data/lib/oci/announcements_service/announcement_client.rb +47 -36
- data/lib/oci/announcements_service/announcements_service.rb +0 -1
- data/lib/oci/announcements_service/models/affected_resource.rb +4 -4
- data/lib/oci/announcements_service/models/announcement.rb +10 -14
- data/lib/oci/announcements_service/models/announcement_summary.rb +1 -1
- data/lib/oci/announcements_service/models/announcement_user_status_details.rb +5 -5
- data/lib/oci/announcements_service/models/announcements_collection.rb +3 -3
- data/lib/oci/announcements_service/models/base_announcement.rb +28 -18
- data/lib/oci/audit/audit_client.rb +17 -10
- data/lib/oci/container_engine/container_engine_client.rb +17 -10
- data/lib/oci/core/blockstorage_client.rb +17 -10
- data/lib/oci/core/compute_client.rb +17 -10
- data/lib/oci/core/compute_management_client.rb +17 -10
- data/lib/oci/core/models/create_subnet_details.rb +1 -1
- data/lib/oci/core/models/subnet.rb +1 -1
- data/lib/oci/core/virtual_network_client.rb +17 -10
- data/lib/oci/database/database_client.rb +17 -10
- data/lib/oci/dns/dns_client.rb +17 -10
- data/lib/oci/email/email_client.rb +17 -10
- data/lib/oci/file_storage/file_storage_client.rb +17 -10
- data/lib/oci/healthchecks/health_checks_client.rb +17 -10
- data/lib/oci/identity/identity_client.rb +17 -10
- data/lib/oci/key_management/kms_crypto_client.rb +4 -5
- data/lib/oci/key_management/kms_management_client.rb +7 -8
- data/lib/oci/key_management/kms_vault_client.rb +20 -13
- data/lib/oci/key_management/models/create_key_details.rb +34 -1
- data/lib/oci/key_management/models/create_vault_details.rb +34 -1
- data/lib/oci/key_management/models/key_version.rb +1 -1
- data/lib/oci/key_management/models/update_key_details.rb +37 -4
- data/lib/oci/key_management/models/update_vault_details.rb +37 -4
- data/lib/oci/load_balancer/load_balancer_client.rb +17 -10
- data/lib/oci/object_storage/object_storage_client.rb +17 -10
- data/lib/oci/regions.rb +20 -4
- data/lib/oci/resource_search/resource_search_client.rb +17 -10
- data/lib/oci/streaming/models/create_cursor_details.rb +205 -0
- data/lib/oci/streaming/models/create_group_cursor_details.rb +237 -0
- data/lib/oci/streaming/models/create_stream_details.rb +227 -0
- data/lib/oci/streaming/models/cursor.rb +150 -0
- data/lib/oci/streaming/models/group.rb +179 -0
- data/lib/oci/streaming/models/message.rb +199 -0
- data/lib/oci/streaming/models/partition_reservation.rb +192 -0
- data/lib/oci/streaming/models/put_messages_details.rb +149 -0
- data/lib/oci/{announcements_service/models/notification_followup_details.rb → streaming/models/put_messages_details_entry.rb} +19 -22
- data/lib/oci/streaming/models/put_messages_result.rb +165 -0
- data/lib/oci/streaming/models/put_messages_result_entry.rb +196 -0
- data/lib/oci/streaming/models/stream.rb +319 -0
- data/lib/oci/streaming/models/stream_summary.rb +291 -0
- data/lib/oci/streaming/models/update_group_details.rb +176 -0
- data/lib/oci/streaming/models/update_stream_details.rb +174 -0
- data/lib/oci/streaming/stream_admin_client.rb +432 -0
- data/lib/oci/streaming/stream_admin_client_composite_operations.rb +143 -0
- data/lib/oci/streaming/stream_client.rb +602 -0
- data/lib/oci/streaming/stream_client_composite_operations.rb +24 -0
- data/lib/oci/streaming/streaming.rb +35 -0
- data/lib/oci/streaming/util.rb +2 -0
- data/lib/oci/version.rb +1 -1
- data/lib/oci/waas/waas_client.rb +17 -10
- metadata +51 -3
@@ -25,20 +25,22 @@ module OCI
|
|
25
25
|
# @return [String]
|
26
26
|
attr_reader :region
|
27
27
|
|
28
|
-
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Layout/EmptyLines
|
28
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Layout/EmptyLines, Metrics/PerceivedComplexity
|
29
29
|
|
30
30
|
|
31
31
|
# Creates a new ObjectStorageClient.
|
32
32
|
# Notes:
|
33
33
|
# If a config is not specified, then the global OCI.config will be used.
|
34
|
-
# This client is not thread-safe
|
35
34
|
#
|
36
|
-
#
|
37
|
-
# then the region parameter will be used.
|
35
|
+
# This client is not thread-safe
|
38
36
|
#
|
37
|
+
# Either a region or an endpoint must be specified. If an endpoint is specified, it will be used instead of the
|
38
|
+
# region. A region may be specified in the config or via or the region parameter. If specified in both, then the
|
39
|
+
# region parameter will be used.
|
39
40
|
# @param [Config] config A Config object.
|
40
41
|
# @param [String] region A region used to determine the service endpoint. This will usually
|
41
42
|
# correspond to a value in {OCI::Regions::REGION_ENUM}, but may be an arbitrary string.
|
43
|
+
# @param [String] endpoint The fully qualified endpoint URL
|
42
44
|
# @param [OCI::BaseSigner] signer A signer implementation which can be used by this client. If this is not provided then
|
43
45
|
# a signer will be constructed via the provided config. One use case of this parameter is instance principals authentication,
|
44
46
|
# so that the instance principals signer can be provided to the client
|
@@ -47,7 +49,7 @@ module OCI
|
|
47
49
|
# @param [OCI::Retry::RetryConfig] retry_config The retry configuration for this service client. This represents the default retry configuration to
|
48
50
|
# apply across all operations. This can be overridden on a per-operation basis. The default retry configuration value is `nil`, which means that an operation
|
49
51
|
# will not perform any retries
|
50
|
-
def initialize(config: nil, region: nil, signer: nil, proxy_settings: nil, retry_config: nil)
|
52
|
+
def initialize(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil)
|
51
53
|
# If the signer is an InstancePrincipalsSecurityTokenSigner and no config was supplied (which is valid for instance principals)
|
52
54
|
# then create a dummy config to pass to the ApiClient constructor. If customers wish to create a client which uses instance principals
|
53
55
|
# and has config (either populated programmatically or loaded from a file), they must construct that config themselves and then
|
@@ -73,11 +75,16 @@ module OCI
|
|
73
75
|
@api_client = OCI::ApiClient.new(config, signer, proxy_settings: proxy_settings)
|
74
76
|
@retry_config = retry_config
|
75
77
|
|
76
|
-
|
77
|
-
|
78
|
-
|
78
|
+
if endpoint
|
79
|
+
@endpoint = endpoint + '/'
|
80
|
+
else
|
81
|
+
region ||= config.region
|
82
|
+
region ||= signer.region if signer.respond_to?(:region)
|
83
|
+
self.region = region
|
84
|
+
end
|
85
|
+
logger.info "ObjectStorageClient endpoint set to '#{@endpoint}'." if logger
|
79
86
|
end
|
80
|
-
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Layout/EmptyLines
|
87
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Layout/EmptyLines, Metrics/PerceivedComplexity
|
81
88
|
|
82
89
|
# Set the region that will be used to determine the service endpoint.
|
83
90
|
# This will usually correspond to a value in {OCI::Regions::REGION_ENUM},
|
@@ -88,7 +95,7 @@ module OCI
|
|
88
95
|
raise 'A region must be specified.' unless @region
|
89
96
|
|
90
97
|
@endpoint = OCI::Regions.get_service_endpoint(@region, :ObjectStorageClient) + '/'
|
91
|
-
logger.info "ObjectStorageClient endpoint set to '#{endpoint}'." if logger
|
98
|
+
logger.info "ObjectStorageClient endpoint set to '#{@endpoint} from region #{@region}'." if logger
|
92
99
|
end
|
93
100
|
|
94
101
|
# @return [Logger] The logger for this client. May be nil.
|
data/lib/oci/regions.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
2
2
|
|
3
|
+
require 'pp'
|
4
|
+
|
3
5
|
module OCI
|
4
6
|
# Module defining available regions and helper methods to get value service endpoints
|
5
7
|
module Regions
|
@@ -8,7 +10,12 @@ module OCI
|
|
8
10
|
REGION_US_PHOENIX_1 = 'us-phoenix-1'.freeze,
|
9
11
|
REGION_US_ASHBURN_1 = 'us-ashburn-1'.freeze,
|
10
12
|
REGION_EU_FRANKFURT_1 = 'eu-frankfurt-1'.freeze,
|
11
|
-
REGION_UK_LONDON_1 = 'uk-london-1'.freeze
|
13
|
+
REGION_UK_LONDON_1 = 'uk-london-1'.freeze,
|
14
|
+
REGION_US_LANGLEY_1 = 'us-langley-1'.freeze,
|
15
|
+
REGION_US_LUKE_1 = 'us-luke-1'.freeze,
|
16
|
+
REGION_US_GOV_ASHBURN_1 = 'us-gov-ashburn-1'.freeze,
|
17
|
+
REGION_US_GOV_PHOENIX_1 = 'us-gov-phoenix-1'.freeze,
|
18
|
+
REGION_US_GOV_CHICAGO_1 = 'us-gov-chicago-1'.freeze
|
12
19
|
].freeze
|
13
20
|
|
14
21
|
REGION_SHORT_NAMES_TO_LONG_NAMES = {
|
@@ -25,13 +32,20 @@ module OCI
|
|
25
32
|
'us-phoenix-1': 'oc1'.freeze,
|
26
33
|
'us-ashburn-1': 'oc1'.freeze,
|
27
34
|
'eu-frankfurt-1': 'oc1'.freeze,
|
28
|
-
'uk-london-1': 'oc1'.freeze
|
35
|
+
'uk-london-1': 'oc1'.freeze,
|
36
|
+
'us-langley-1': 'oc2'.freeze,
|
37
|
+
'us-luke-1': 'oc2'.freeze,
|
38
|
+
'us-gov-ashburn-1': 'oc3'.freeze,
|
39
|
+
'us-gov-phoenix-1': 'oc3'.freeze,
|
40
|
+
'us-gov-chicago-1': 'oc3'.freeze
|
29
41
|
}.freeze
|
30
42
|
# --- end of region realm mapping ---
|
31
43
|
|
32
44
|
# --- Start of realm domain mapping ---
|
33
45
|
REALM_DOMAIN_MAPPING = {
|
34
|
-
'oc1': 'oraclecloud.com'.freeze
|
46
|
+
'oc1': 'oraclecloud.com'.freeze,
|
47
|
+
'oc2': 'oraclegovcloud.com'.freeze,
|
48
|
+
'oc3': 'oraclegovcloud.com'.freeze
|
35
49
|
}.freeze
|
36
50
|
# --- end of realm domain mapping ---
|
37
51
|
|
@@ -54,6 +68,8 @@ module OCI
|
|
54
68
|
LoadBalancerClient: 'iaas',
|
55
69
|
ObjectStorageClient: 'objectstorage',
|
56
70
|
ResourceSearchClient: 'query',
|
71
|
+
StreamAdminClient: 'streams',
|
72
|
+
StreamClient: 'streams',
|
57
73
|
VirtualNetworkClient: 'iaas',
|
58
74
|
WaasClient: 'waas'
|
59
75
|
}.freeze
|
@@ -120,9 +136,9 @@ module OCI
|
|
120
136
|
|
121
137
|
# return second level domain if exists
|
122
138
|
symbolised_realm = realm.to_sym
|
139
|
+
|
123
140
|
return REALM_DOMAIN_MAPPING[symbolised_realm] if REALM_DOMAIN_MAPPING.key?(symbolised_realm)
|
124
141
|
|
125
|
-
# otherwise return oc1 domain by default
|
126
142
|
REALM_DOMAIN_MAPPING[:oc1]
|
127
143
|
end
|
128
144
|
end
|
@@ -25,20 +25,22 @@ module OCI
|
|
25
25
|
# @return [String]
|
26
26
|
attr_reader :region
|
27
27
|
|
28
|
-
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Layout/EmptyLines
|
28
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Layout/EmptyLines, Metrics/PerceivedComplexity
|
29
29
|
|
30
30
|
|
31
31
|
# Creates a new ResourceSearchClient.
|
32
32
|
# Notes:
|
33
33
|
# If a config is not specified, then the global OCI.config will be used.
|
34
|
-
# This client is not thread-safe
|
35
34
|
#
|
36
|
-
#
|
37
|
-
# then the region parameter will be used.
|
35
|
+
# This client is not thread-safe
|
38
36
|
#
|
37
|
+
# Either a region or an endpoint must be specified. If an endpoint is specified, it will be used instead of the
|
38
|
+
# region. A region may be specified in the config or via or the region parameter. If specified in both, then the
|
39
|
+
# region parameter will be used.
|
39
40
|
# @param [Config] config A Config object.
|
40
41
|
# @param [String] region A region used to determine the service endpoint. This will usually
|
41
42
|
# correspond to a value in {OCI::Regions::REGION_ENUM}, but may be an arbitrary string.
|
43
|
+
# @param [String] endpoint The fully qualified endpoint URL
|
42
44
|
# @param [OCI::BaseSigner] signer A signer implementation which can be used by this client. If this is not provided then
|
43
45
|
# a signer will be constructed via the provided config. One use case of this parameter is instance principals authentication,
|
44
46
|
# so that the instance principals signer can be provided to the client
|
@@ -47,7 +49,7 @@ module OCI
|
|
47
49
|
# @param [OCI::Retry::RetryConfig] retry_config The retry configuration for this service client. This represents the default retry configuration to
|
48
50
|
# apply across all operations. This can be overridden on a per-operation basis. The default retry configuration value is `nil`, which means that an operation
|
49
51
|
# will not perform any retries
|
50
|
-
def initialize(config: nil, region: nil, signer: nil, proxy_settings: nil, retry_config: nil)
|
52
|
+
def initialize(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil)
|
51
53
|
# If the signer is an InstancePrincipalsSecurityTokenSigner and no config was supplied (which is valid for instance principals)
|
52
54
|
# then create a dummy config to pass to the ApiClient constructor. If customers wish to create a client which uses instance principals
|
53
55
|
# and has config (either populated programmatically or loaded from a file), they must construct that config themselves and then
|
@@ -73,11 +75,16 @@ module OCI
|
|
73
75
|
@api_client = OCI::ApiClient.new(config, signer, proxy_settings: proxy_settings)
|
74
76
|
@retry_config = retry_config
|
75
77
|
|
76
|
-
|
77
|
-
|
78
|
-
|
78
|
+
if endpoint
|
79
|
+
@endpoint = endpoint + '/20180409'
|
80
|
+
else
|
81
|
+
region ||= config.region
|
82
|
+
region ||= signer.region if signer.respond_to?(:region)
|
83
|
+
self.region = region
|
84
|
+
end
|
85
|
+
logger.info "ResourceSearchClient endpoint set to '#{@endpoint}'." if logger
|
79
86
|
end
|
80
|
-
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Layout/EmptyLines
|
87
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Layout/EmptyLines, Metrics/PerceivedComplexity
|
81
88
|
|
82
89
|
# Set the region that will be used to determine the service endpoint.
|
83
90
|
# This will usually correspond to a value in {OCI::Regions::REGION_ENUM},
|
@@ -88,7 +95,7 @@ module OCI
|
|
88
95
|
raise 'A region must be specified.' unless @region
|
89
96
|
|
90
97
|
@endpoint = OCI::Regions.get_service_endpoint(@region, :ResourceSearchClient) + '/20180409'
|
91
|
-
logger.info "ResourceSearchClient endpoint set to '#{endpoint}'." if logger
|
98
|
+
logger.info "ResourceSearchClient endpoint set to '#{@endpoint} from region #{@region}'." if logger
|
92
99
|
end
|
93
100
|
|
94
101
|
# @return [Logger] The logger for this client. May be nil.
|
@@ -0,0 +1,205 @@
|
|
1
|
+
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
# rubocop:disable Lint/UnneededCopDisableDirective
|
6
|
+
module OCI
|
7
|
+
# Object used to create a cursor to consume messages in a stream.
|
8
|
+
class Streaming::Models::CreateCursorDetails # rubocop:disable Metrics/LineLength
|
9
|
+
TYPE_ENUM = [
|
10
|
+
TYPE_AFTER_OFFSET = 'AFTER_OFFSET'.freeze,
|
11
|
+
TYPE_AT_OFFSET = 'AT_OFFSET'.freeze,
|
12
|
+
TYPE_AT_TIME = 'AT_TIME'.freeze,
|
13
|
+
TYPE_LATEST = 'LATEST'.freeze,
|
14
|
+
TYPE_TRIM_HORIZON = 'TRIM_HORIZON'.freeze
|
15
|
+
].freeze
|
16
|
+
|
17
|
+
# **[Required]** The partition to get messages from.
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :partition
|
20
|
+
|
21
|
+
# **[Required]** The type of cursor, which determines the starting point from which the stream will be consumed:
|
22
|
+
#
|
23
|
+
# - `AFTER_OFFSET:` The partition position immediately following the offset you specify. (Offsets are assigned when you successfully append a message to a partition in a stream.)
|
24
|
+
# - `AT_OFFSET:` The exact partition position indicated by the offset you specify.
|
25
|
+
# - `AT_TIME:` A specific point in time.
|
26
|
+
# - `LATEST:` The most recent message in the partition that was added after the cursor was created.
|
27
|
+
# - `TRIM_HORIZON:` The oldest message in the partition that is within the retention period window.
|
28
|
+
#
|
29
|
+
# @return [String]
|
30
|
+
attr_reader :type
|
31
|
+
|
32
|
+
# The offset to consume from if the cursor type is `AT_OFFSET` or `AFTER_OFFSET`.
|
33
|
+
# @return [Integer]
|
34
|
+
attr_accessor :offset
|
35
|
+
|
36
|
+
# The time to consume from if the cursor type is `AT_TIME`, expressed in [RFC 3339](https://tools.ietf.org/rfc/rfc3339) timestamp format.
|
37
|
+
#
|
38
|
+
# @return [DateTime]
|
39
|
+
attr_accessor :time
|
40
|
+
|
41
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
42
|
+
def self.attribute_map
|
43
|
+
{
|
44
|
+
# rubocop:disable Style/SymbolLiteral
|
45
|
+
'partition': :'partition',
|
46
|
+
'type': :'type',
|
47
|
+
'offset': :'offset',
|
48
|
+
'time': :'time'
|
49
|
+
# rubocop:enable Style/SymbolLiteral
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# Attribute type mapping.
|
54
|
+
def self.swagger_types
|
55
|
+
{
|
56
|
+
# rubocop:disable Style/SymbolLiteral
|
57
|
+
'partition': :'String',
|
58
|
+
'type': :'String',
|
59
|
+
'offset': :'Integer',
|
60
|
+
'time': :'DateTime'
|
61
|
+
# rubocop:enable Style/SymbolLiteral
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
66
|
+
# rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
67
|
+
|
68
|
+
|
69
|
+
# Initializes the object
|
70
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
71
|
+
# @option attributes [String] :partition The value to assign to the {#partition} property
|
72
|
+
# @option attributes [String] :type The value to assign to the {#type} property
|
73
|
+
# @option attributes [Integer] :offset The value to assign to the {#offset} property
|
74
|
+
# @option attributes [DateTime] :time The value to assign to the {#time} property
|
75
|
+
def initialize(attributes = {})
|
76
|
+
return unless attributes.is_a?(Hash)
|
77
|
+
|
78
|
+
# convert string to symbol for hash key
|
79
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
80
|
+
|
81
|
+
self.partition = attributes[:'partition'] if attributes[:'partition']
|
82
|
+
|
83
|
+
self.type = attributes[:'type'] if attributes[:'type']
|
84
|
+
|
85
|
+
self.offset = attributes[:'offset'] if attributes[:'offset']
|
86
|
+
|
87
|
+
self.time = attributes[:'time'] if attributes[:'time']
|
88
|
+
end
|
89
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
90
|
+
# rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
91
|
+
|
92
|
+
# Custom attribute writer method checking allowed values (enum).
|
93
|
+
# @param [Object] type Object to be assigned
|
94
|
+
def type=(type)
|
95
|
+
# rubocop: disable Metrics/LineLength
|
96
|
+
raise "Invalid value for 'type': this must be one of the values in TYPE_ENUM." if type && !TYPE_ENUM.include?(type)
|
97
|
+
|
98
|
+
# rubocop: enable Metrics/LineLength
|
99
|
+
@type = type
|
100
|
+
end
|
101
|
+
|
102
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
|
103
|
+
|
104
|
+
|
105
|
+
# Checks equality by comparing each attribute.
|
106
|
+
# @param [Object] other the other object to be compared
|
107
|
+
def ==(other)
|
108
|
+
return true if equal?(other)
|
109
|
+
|
110
|
+
self.class == other.class &&
|
111
|
+
partition == other.partition &&
|
112
|
+
type == other.type &&
|
113
|
+
offset == other.offset &&
|
114
|
+
time == other.time
|
115
|
+
end
|
116
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
|
117
|
+
|
118
|
+
# @see the `==` method
|
119
|
+
# @param [Object] other the other object to be compared
|
120
|
+
def eql?(other)
|
121
|
+
self == other
|
122
|
+
end
|
123
|
+
|
124
|
+
# rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
|
125
|
+
|
126
|
+
|
127
|
+
# Calculates hash code according to all attributes.
|
128
|
+
# @return [Fixnum] Hash code
|
129
|
+
def hash
|
130
|
+
[partition, type, offset, time].hash
|
131
|
+
end
|
132
|
+
# rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
|
133
|
+
|
134
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
135
|
+
|
136
|
+
|
137
|
+
# Builds the object from hash
|
138
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
139
|
+
# @return [Object] Returns the model itself
|
140
|
+
def build_from_hash(attributes)
|
141
|
+
return nil unless attributes.is_a?(Hash)
|
142
|
+
|
143
|
+
self.class.swagger_types.each_pair do |key, type|
|
144
|
+
if type =~ /^Array<(.*)>/i
|
145
|
+
# check to ensure the input is an array given that the the attribute
|
146
|
+
# is documented as an array but the input is not
|
147
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
148
|
+
public_method("#{key}=").call(
|
149
|
+
attributes[self.class.attribute_map[key]]
|
150
|
+
.map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
|
151
|
+
)
|
152
|
+
end
|
153
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
154
|
+
public_method("#{key}=").call(
|
155
|
+
OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
|
156
|
+
)
|
157
|
+
end
|
158
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
159
|
+
end
|
160
|
+
|
161
|
+
self
|
162
|
+
end
|
163
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
164
|
+
|
165
|
+
# Returns the string representation of the object
|
166
|
+
# @return [String] String presentation of the object
|
167
|
+
def to_s
|
168
|
+
to_hash.to_s
|
169
|
+
end
|
170
|
+
|
171
|
+
# Returns the object in the form of hash
|
172
|
+
# @return [Hash] Returns the object in the form of hash
|
173
|
+
def to_hash
|
174
|
+
hash = {}
|
175
|
+
self.class.attribute_map.each_pair do |attr, param|
|
176
|
+
value = public_method(attr).call
|
177
|
+
next if value.nil? && !instance_variable_defined?("@#{attr}")
|
178
|
+
|
179
|
+
hash[param] = _to_hash(value)
|
180
|
+
end
|
181
|
+
hash
|
182
|
+
end
|
183
|
+
|
184
|
+
private
|
185
|
+
|
186
|
+
# Outputs non-array value in the form of hash
|
187
|
+
# For object, use to_hash. Otherwise, just return the value
|
188
|
+
# @param [Object] value Any valid value
|
189
|
+
# @return [Hash] Returns the value in the form of hash
|
190
|
+
def _to_hash(value)
|
191
|
+
if value.is_a?(Array)
|
192
|
+
value.compact.map { |v| _to_hash(v) }
|
193
|
+
elsif value.is_a?(Hash)
|
194
|
+
{}.tap do |hash|
|
195
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
196
|
+
end
|
197
|
+
elsif value.respond_to? :to_hash
|
198
|
+
value.to_hash
|
199
|
+
else
|
200
|
+
value
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
# rubocop:enable Lint/UnneededCopDisableDirective
|
@@ -0,0 +1,237 @@
|
|
1
|
+
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
# rubocop:disable Lint/UnneededCopDisableDirective
|
6
|
+
module OCI
|
7
|
+
# Object used to create a group cursor.
|
8
|
+
class Streaming::Models::CreateGroupCursorDetails # rubocop:disable Metrics/LineLength
|
9
|
+
TYPE_ENUM = [
|
10
|
+
TYPE_AT_TIME = 'AT_TIME'.freeze,
|
11
|
+
TYPE_LATEST = 'LATEST'.freeze,
|
12
|
+
TYPE_TRIM_HORIZON = 'TRIM_HORIZON'.freeze
|
13
|
+
].freeze
|
14
|
+
|
15
|
+
# **[Required]** The type of the cursor. This value is only used when the group is created.
|
16
|
+
# @return [String]
|
17
|
+
attr_reader :type
|
18
|
+
|
19
|
+
# The time to consume from if type is AT_TIME.
|
20
|
+
# @return [DateTime]
|
21
|
+
attr_accessor :time
|
22
|
+
|
23
|
+
# **[Required]** Name of the consumer group.
|
24
|
+
# @return [String]
|
25
|
+
attr_accessor :group_name
|
26
|
+
|
27
|
+
# A unique identifier for the instance joining the consumer group. If an instanceName is not provided, a UUID will be generated and used.
|
28
|
+
# @return [String]
|
29
|
+
attr_accessor :instance_name
|
30
|
+
|
31
|
+
# The amount of a consumer instance inactivity time, before partition reservations are released.
|
32
|
+
# @return [Integer]
|
33
|
+
attr_accessor :timeout_in_ms
|
34
|
+
|
35
|
+
# When using consumer-groups, the default commit-on-get behaviour can be overriden by setting this value to false.
|
36
|
+
# If disabled, a consumer must manually commit their cursors.
|
37
|
+
#
|
38
|
+
# @return [BOOLEAN]
|
39
|
+
attr_accessor :commit_on_get
|
40
|
+
|
41
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
42
|
+
def self.attribute_map
|
43
|
+
{
|
44
|
+
# rubocop:disable Style/SymbolLiteral
|
45
|
+
'type': :'type',
|
46
|
+
'time': :'time',
|
47
|
+
'group_name': :'groupName',
|
48
|
+
'instance_name': :'instanceName',
|
49
|
+
'timeout_in_ms': :'timeoutInMs',
|
50
|
+
'commit_on_get': :'commitOnGet'
|
51
|
+
# rubocop:enable Style/SymbolLiteral
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
# Attribute type mapping.
|
56
|
+
def self.swagger_types
|
57
|
+
{
|
58
|
+
# rubocop:disable Style/SymbolLiteral
|
59
|
+
'type': :'String',
|
60
|
+
'time': :'DateTime',
|
61
|
+
'group_name': :'String',
|
62
|
+
'instance_name': :'String',
|
63
|
+
'timeout_in_ms': :'Integer',
|
64
|
+
'commit_on_get': :'BOOLEAN'
|
65
|
+
# rubocop:enable Style/SymbolLiteral
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
70
|
+
# rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
71
|
+
|
72
|
+
|
73
|
+
# Initializes the object
|
74
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
75
|
+
# @option attributes [String] :type The value to assign to the {#type} property
|
76
|
+
# @option attributes [DateTime] :time The value to assign to the {#time} property
|
77
|
+
# @option attributes [String] :group_name The value to assign to the {#group_name} property
|
78
|
+
# @option attributes [String] :instance_name The value to assign to the {#instance_name} property
|
79
|
+
# @option attributes [Integer] :timeout_in_ms The value to assign to the {#timeout_in_ms} property
|
80
|
+
# @option attributes [BOOLEAN] :commit_on_get The value to assign to the {#commit_on_get} property
|
81
|
+
def initialize(attributes = {})
|
82
|
+
return unless attributes.is_a?(Hash)
|
83
|
+
|
84
|
+
# convert string to symbol for hash key
|
85
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
86
|
+
|
87
|
+
self.type = attributes[:'type'] if attributes[:'type']
|
88
|
+
|
89
|
+
self.time = attributes[:'time'] if attributes[:'time']
|
90
|
+
|
91
|
+
self.group_name = attributes[:'groupName'] if attributes[:'groupName']
|
92
|
+
|
93
|
+
raise 'You cannot provide both :groupName and :group_name' if attributes.key?(:'groupName') && attributes.key?(:'group_name')
|
94
|
+
|
95
|
+
self.group_name = attributes[:'group_name'] if attributes[:'group_name']
|
96
|
+
|
97
|
+
self.instance_name = attributes[:'instanceName'] if attributes[:'instanceName']
|
98
|
+
|
99
|
+
raise 'You cannot provide both :instanceName and :instance_name' if attributes.key?(:'instanceName') && attributes.key?(:'instance_name')
|
100
|
+
|
101
|
+
self.instance_name = attributes[:'instance_name'] if attributes[:'instance_name']
|
102
|
+
|
103
|
+
self.timeout_in_ms = attributes[:'timeoutInMs'] if attributes[:'timeoutInMs']
|
104
|
+
self.timeout_in_ms = 30000 if timeout_in_ms.nil? && !attributes.key?(:'timeoutInMs') # rubocop:disable Style/StringLiterals
|
105
|
+
|
106
|
+
raise 'You cannot provide both :timeoutInMs and :timeout_in_ms' if attributes.key?(:'timeoutInMs') && attributes.key?(:'timeout_in_ms')
|
107
|
+
|
108
|
+
self.timeout_in_ms = attributes[:'timeout_in_ms'] if attributes[:'timeout_in_ms']
|
109
|
+
self.timeout_in_ms = 30000 if timeout_in_ms.nil? && !attributes.key?(:'timeoutInMs') && !attributes.key?(:'timeout_in_ms') # rubocop:disable Style/StringLiterals
|
110
|
+
|
111
|
+
self.commit_on_get = attributes[:'commitOnGet'] unless attributes[:'commitOnGet'].nil?
|
112
|
+
self.commit_on_get = true if commit_on_get.nil? && !attributes.key?(:'commitOnGet') # rubocop:disable Style/StringLiterals
|
113
|
+
|
114
|
+
raise 'You cannot provide both :commitOnGet and :commit_on_get' if attributes.key?(:'commitOnGet') && attributes.key?(:'commit_on_get')
|
115
|
+
|
116
|
+
self.commit_on_get = attributes[:'commit_on_get'] unless attributes[:'commit_on_get'].nil?
|
117
|
+
self.commit_on_get = true if commit_on_get.nil? && !attributes.key?(:'commitOnGet') && !attributes.key?(:'commit_on_get') # rubocop:disable Style/StringLiterals
|
118
|
+
end
|
119
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
120
|
+
# rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
121
|
+
|
122
|
+
# Custom attribute writer method checking allowed values (enum).
|
123
|
+
# @param [Object] type Object to be assigned
|
124
|
+
def type=(type)
|
125
|
+
# rubocop: disable Metrics/LineLength
|
126
|
+
raise "Invalid value for 'type': this must be one of the values in TYPE_ENUM." if type && !TYPE_ENUM.include?(type)
|
127
|
+
|
128
|
+
# rubocop: enable Metrics/LineLength
|
129
|
+
@type = type
|
130
|
+
end
|
131
|
+
|
132
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
|
133
|
+
|
134
|
+
|
135
|
+
# Checks equality by comparing each attribute.
|
136
|
+
# @param [Object] other the other object to be compared
|
137
|
+
def ==(other)
|
138
|
+
return true if equal?(other)
|
139
|
+
|
140
|
+
self.class == other.class &&
|
141
|
+
type == other.type &&
|
142
|
+
time == other.time &&
|
143
|
+
group_name == other.group_name &&
|
144
|
+
instance_name == other.instance_name &&
|
145
|
+
timeout_in_ms == other.timeout_in_ms &&
|
146
|
+
commit_on_get == other.commit_on_get
|
147
|
+
end
|
148
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
|
149
|
+
|
150
|
+
# @see the `==` method
|
151
|
+
# @param [Object] other the other object to be compared
|
152
|
+
def eql?(other)
|
153
|
+
self == other
|
154
|
+
end
|
155
|
+
|
156
|
+
# rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
|
157
|
+
|
158
|
+
|
159
|
+
# Calculates hash code according to all attributes.
|
160
|
+
# @return [Fixnum] Hash code
|
161
|
+
def hash
|
162
|
+
[type, time, group_name, instance_name, timeout_in_ms, commit_on_get].hash
|
163
|
+
end
|
164
|
+
# rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
|
165
|
+
|
166
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
167
|
+
|
168
|
+
|
169
|
+
# Builds the object from hash
|
170
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
171
|
+
# @return [Object] Returns the model itself
|
172
|
+
def build_from_hash(attributes)
|
173
|
+
return nil unless attributes.is_a?(Hash)
|
174
|
+
|
175
|
+
self.class.swagger_types.each_pair do |key, type|
|
176
|
+
if type =~ /^Array<(.*)>/i
|
177
|
+
# check to ensure the input is an array given that the the attribute
|
178
|
+
# is documented as an array but the input is not
|
179
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
180
|
+
public_method("#{key}=").call(
|
181
|
+
attributes[self.class.attribute_map[key]]
|
182
|
+
.map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
|
183
|
+
)
|
184
|
+
end
|
185
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
186
|
+
public_method("#{key}=").call(
|
187
|
+
OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
|
188
|
+
)
|
189
|
+
end
|
190
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
191
|
+
end
|
192
|
+
|
193
|
+
self
|
194
|
+
end
|
195
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
196
|
+
|
197
|
+
# Returns the string representation of the object
|
198
|
+
# @return [String] String presentation of the object
|
199
|
+
def to_s
|
200
|
+
to_hash.to_s
|
201
|
+
end
|
202
|
+
|
203
|
+
# Returns the object in the form of hash
|
204
|
+
# @return [Hash] Returns the object in the form of hash
|
205
|
+
def to_hash
|
206
|
+
hash = {}
|
207
|
+
self.class.attribute_map.each_pair do |attr, param|
|
208
|
+
value = public_method(attr).call
|
209
|
+
next if value.nil? && !instance_variable_defined?("@#{attr}")
|
210
|
+
|
211
|
+
hash[param] = _to_hash(value)
|
212
|
+
end
|
213
|
+
hash
|
214
|
+
end
|
215
|
+
|
216
|
+
private
|
217
|
+
|
218
|
+
# Outputs non-array value in the form of hash
|
219
|
+
# For object, use to_hash. Otherwise, just return the value
|
220
|
+
# @param [Object] value Any valid value
|
221
|
+
# @return [Hash] Returns the value in the form of hash
|
222
|
+
def _to_hash(value)
|
223
|
+
if value.is_a?(Array)
|
224
|
+
value.compact.map { |v| _to_hash(v) }
|
225
|
+
elsif value.is_a?(Hash)
|
226
|
+
{}.tap do |hash|
|
227
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
228
|
+
end
|
229
|
+
elsif value.respond_to? :to_hash
|
230
|
+
value.to_hash
|
231
|
+
else
|
232
|
+
value
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
237
|
+
# rubocop:enable Lint/UnneededCopDisableDirective
|