zm-ruby-client 3.1.1 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +126 -0
- data/README.md +42 -0
- data/VERSION +1 -1
- data/lib/zm/client/account/account.rb +214 -8
- data/lib/zm/client/account/account_jsns_builder.rb +6 -18
- data/lib/zm/client/account/account_jsns_initializer.rb +1 -1
- data/lib/zm/client/account/accounts_collection.rb +1 -0
- data/lib/zm/client/account/accounts_response.rb +21 -0
- data/lib/zm/client/backup/backups_collection.rb +1 -1
- data/lib/zm/client/backup/backups_response.rb +16 -0
- data/lib/zm/client/base/admin_objects_collection.rb +18 -8
- data/lib/zm/client/base/admin_objects_response.rb +23 -0
- data/lib/zm/client/base/base_jsns_initializer.rb +34 -3
- data/lib/zm/client/base/has_cos.rb +75 -0
- data/lib/zm/client/base/has_zimbra_attributes.rb +133 -0
- data/lib/zm/client/base/object.rb +2 -0
- data/lib/zm/client/base/objects_builder.rb +1 -1
- data/lib/zm/client/base/zimbra_attributes_collection.rb +43 -166
- data/lib/zm/client/base/zimbra_attrs_jsns.rb +44 -0
- data/lib/zm/client/cluster/cluster.rb +16 -9
- data/lib/zm/client/cluster/cluster_config.rb +50 -18
- data/lib/zm/client/contact/contact_jsns_initializer.rb +16 -16
- data/lib/zm/client/contact/contact_members_collection.rb +19 -1
- data/lib/zm/client/cos/cos.rb +183 -11
- data/lib/zm/client/cos/cos_jsns_builder.rb +4 -16
- data/lib/zm/client/cos/cos_jsns_initializer.rb +2 -2
- data/lib/zm/client/cos/coses_collection.rb +1 -0
- data/lib/zm/client/cos/coses_response.rb +27 -0
- data/lib/zm/client/deprecation.rb +24 -0
- data/lib/zm/client/distributionlist/distributionlist.rb +11 -4
- data/lib/zm/client/distributionlist/distributionlist_jsns_builder.rb +4 -16
- data/lib/zm/client/distributionlist/distributionlist_jsns_initializer.rb +1 -2
- data/lib/zm/client/distributionlist/distributionlists_collection.rb +1 -0
- data/lib/zm/client/distributionlist/distributionlists_response.rb +16 -0
- data/lib/zm/client/distributionlist/dls_membership_collection.rb +5 -5
- data/lib/zm/client/domain/domain.rb +51 -10
- data/lib/zm/client/domain/domain_jsns_builder.rb +4 -16
- data/lib/zm/client/domain/domain_jsns_initializer.rb +9 -2
- data/lib/zm/client/domain/domains_collection.rb +1 -0
- data/lib/zm/client/domain/domains_response.rb +23 -0
- data/lib/zm/client/folder/folder.rb +1 -0
- data/lib/zm/client/folder/folder_default.rb +3 -1
- data/lib/zm/client/folder/folder_grants_collection.rb +24 -0
- data/lib/zm/client/folder/folder_jsns_initializer.rb +4 -3
- data/lib/zm/client/folder/folder_retention_policies_collection.rb +8 -0
- data/lib/zm/client/folder/folder_retention_policy.rb +2 -2
- data/lib/zm/client/folder/folder_view_filters.rb +32 -0
- data/lib/zm/client/folder/folders_builder.rb +31 -16
- data/lib/zm/client/folder/folders_collection.rb +21 -13
- data/lib/zm/client/folder/folders_response.rb +14 -0
- data/lib/zm/client/mailbox/mailbox_item_concern.rb +1 -3
- data/lib/zm/client/mailbox/mailbox_item_id.rb +7 -1
- data/lib/zm/client/mountpoint/mount_point.rb +1 -1
- data/lib/zm/client/mountpoint/mount_points_builder.rb +3 -3
- data/lib/zm/client/mountpoint/mount_points_collection.rb +0 -4
- data/lib/zm/client/mountpoint/mount_points_response.rb +10 -0
- data/lib/zm/client/resource/resource.rb +215 -4
- data/lib/zm/client/resource/resource_jsns_builder.rb +4 -16
- data/lib/zm/client/resource/resource_jsns_initializer.rb +1 -1
- data/lib/zm/client/resource/resources_collection.rb +1 -0
- data/lib/zm/client/resource/resources_response.rb +16 -0
- data/lib/zm/client/server/server.rb +28 -2
- data/lib/zm/client/server/servers_collection.rb +1 -0
- data/lib/zm/client/server/servers_response.rb +43 -0
- data/lib/zm/client/upload.rb +2 -0
- data/lib/zm/client/zm_logger.rb +32 -2
- data/lib/zm/client.rb +15 -0
- data/lib/zm/connector/network_error_handler.rb +2 -0
- data/lib/zm/connector/rest_connector.rb +2 -0
- data/lib/zm/connector/soap_account_connector.rb +2 -0
- data/lib/zm/connector/soap_base_connector.rb +11 -7
- data/lib/zm/connector/ssl.rb +10 -0
- data/lib/zm/connector.rb +2 -1
- data/lib/zm/soap_request/request_methods_admin.rb +10 -6
- data/lib/zm/soap_request/soap_context.rb +2 -2
- data/lib/zm/support/cache/file_store.rb +2 -11
- data/lib/zm/support/cache/store.rb +4 -2
- data/lib/zm/utils/log_filter.rb +13 -5
- data/lib/zm-ruby-client.rb +0 -2
- data/sig/zm/client/admin_objects.rbs +119 -11
- data/sig/zm/client/base.rbs +81 -4
- data/sig/zm/client/cluster.rbs +13 -6
- data/sig/zm/client/mailbox.rbs +91 -2
- metadata +18 -17
- data/lib/zm/modules/common/zimbra-attrs.csv +0 -737
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'faraday'
|
|
4
|
+
|
|
3
5
|
module Zm
|
|
4
6
|
module Connector
|
|
5
7
|
class SoapBaseConnector
|
|
@@ -37,14 +39,11 @@ module Zm
|
|
|
37
39
|
end
|
|
38
40
|
|
|
39
41
|
def invoke(soap_element, error_handler = Zm::Error::SoapError)
|
|
40
|
-
|
|
42
|
+
request(soap_element, error_handler)
|
|
41
43
|
end
|
|
42
44
|
|
|
43
45
|
def target_invoke(soap_element, target_id, error_handler = Zm::Error::SoapError)
|
|
44
|
-
|
|
45
|
-
invoke(soap_element, error_handler)
|
|
46
|
-
ensure
|
|
47
|
-
@context.target_server(nil)
|
|
46
|
+
request(soap_element, error_handler, target_id)
|
|
48
47
|
end
|
|
49
48
|
|
|
50
49
|
def http_client!
|
|
@@ -67,6 +66,11 @@ module Zm
|
|
|
67
66
|
|
|
68
67
|
private
|
|
69
68
|
|
|
69
|
+
def request(soap_element, error_handler, target_server = nil)
|
|
70
|
+
body = envelope(soap_element, target_server)
|
|
71
|
+
do_request(body, error_handler, cacheable: cacheable?(soap_element))[:Body]
|
|
72
|
+
end
|
|
73
|
+
|
|
70
74
|
def cacheable?(soap_element)
|
|
71
75
|
CACHEABLE_REQUEST_REGEX.match?(soap_element.name)
|
|
72
76
|
end
|
|
@@ -104,10 +108,10 @@ module Zm
|
|
|
104
108
|
{ Body: { Fault: { Reason: { Text: "HTTP #{response.status}" }, Detail: { Error: { Code: 'HTTP_ERROR' } } } } }
|
|
105
109
|
end
|
|
106
110
|
|
|
107
|
-
def envelope(soap_element)
|
|
111
|
+
def envelope(soap_element, target_server = nil)
|
|
108
112
|
{
|
|
109
113
|
Body: soap_element.to_hash,
|
|
110
|
-
Header: { context: context.to_hash, _jsns: BASESPACE }
|
|
114
|
+
Header: { context: context.to_hash(target_server), _jsns: BASESPACE }
|
|
111
115
|
}
|
|
112
116
|
end
|
|
113
117
|
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'openssl'
|
|
4
|
+
|
|
5
|
+
module Zm
|
|
6
|
+
module Connector
|
|
7
|
+
SSL_VERIFY_NONE = { verify: false, verify_hostname: false, verify_mode: OpenSSL::SSL::VERIFY_NONE }.freeze
|
|
8
|
+
SSL_VERIFY_PEER = { verify: true, verify_hostname: true, verify_mode: OpenSSL::SSL::VERIFY_PEER }.freeze
|
|
9
|
+
end
|
|
10
|
+
end
|
data/lib/zm/connector.rb
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
module Zm
|
|
4
4
|
module Connector
|
|
5
|
-
|
|
5
|
+
autoload :SSL_VERIFY_NONE, 'zm/connector/ssl'
|
|
6
|
+
autoload :SSL_VERIFY_PEER, 'zm/connector/ssl'
|
|
6
7
|
|
|
7
8
|
autoload :SoapBaseConnector, 'zm/connector/soap_base_connector'
|
|
8
9
|
autoload :SoapAdminConnector, 'zm/connector/soap_admin_connector'
|
|
@@ -12,22 +12,25 @@ module Zm
|
|
|
12
12
|
jsns_builder.to_delete
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def modify!
|
|
16
|
-
|
|
15
|
+
def modify!(force: false)
|
|
16
|
+
return false unless force || zimbra_attrs_changed?
|
|
17
|
+
|
|
18
|
+
sac.invoke(build_modify(force:))
|
|
19
|
+
clear_zimbra_attrs_changes
|
|
17
20
|
@updated = true
|
|
18
21
|
end
|
|
19
22
|
|
|
20
|
-
def build_modify
|
|
21
|
-
jsns_builder.to_update
|
|
23
|
+
def build_modify(force: false)
|
|
24
|
+
jsns_builder.to_update(force:)
|
|
22
25
|
end
|
|
23
26
|
|
|
24
27
|
def build_create
|
|
25
28
|
jsns_builder.to_create
|
|
26
29
|
end
|
|
27
30
|
|
|
28
|
-
def update!(hash = nil, update_attributes: true, **attrs)
|
|
31
|
+
def update!(hash = nil, update_attributes: true, force: false, **attrs)
|
|
29
32
|
hash = hash.nil? ? attrs : hash.merge(attrs)
|
|
30
|
-
return false if hash
|
|
33
|
+
return false if zimbra_attrs_to_update(hash, force).empty?
|
|
31
34
|
|
|
32
35
|
do_update!(hash)
|
|
33
36
|
|
|
@@ -39,6 +42,7 @@ module Zm
|
|
|
39
42
|
def do_update_attributes(hash)
|
|
40
43
|
hash.each do |key, value|
|
|
41
44
|
update_attribute(key, value)
|
|
45
|
+
forget_zimbra_attr_change(key)
|
|
42
46
|
end
|
|
43
47
|
end
|
|
44
48
|
|
|
@@ -40,12 +40,12 @@ module Zm
|
|
|
40
40
|
self
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
def to_hash
|
|
43
|
+
def to_hash(target_server = nil)
|
|
44
44
|
h = {
|
|
45
45
|
authToken: auth_token,
|
|
46
46
|
userAgent: { name: @user_agent },
|
|
47
47
|
account: @account,
|
|
48
|
-
targetServer: @target_server
|
|
48
|
+
targetServer: target_server || @target_server
|
|
49
49
|
}
|
|
50
50
|
h.compact!
|
|
51
51
|
h
|
|
@@ -15,6 +15,7 @@ module Zm
|
|
|
15
15
|
attr_reader :cache_path
|
|
16
16
|
|
|
17
17
|
GITKEEP_FILES = %w[.gitkeep .keep].freeze
|
|
18
|
+
KEY_PART_REGEX = /.{1,8}/
|
|
18
19
|
|
|
19
20
|
def initialize(**options)
|
|
20
21
|
@cache_path = options.delete(:cache_path).to_s
|
|
@@ -85,17 +86,7 @@ module Zm
|
|
|
85
86
|
|
|
86
87
|
# Translate a key into a file path.
|
|
87
88
|
def normalize_key(key, options)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
fpaths = []
|
|
91
|
-
|
|
92
|
-
while key.length > 8
|
|
93
|
-
chars = key.chars
|
|
94
|
-
fpaths << chars.shift(8).join
|
|
95
|
-
key = chars.join
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
File.join(cache_path, *fpaths, key)
|
|
89
|
+
File.join(cache_path, *super.scan(KEY_PART_REGEX))
|
|
99
90
|
end
|
|
100
91
|
|
|
101
92
|
# Translate a file path into a key.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'digest'
|
|
4
|
+
|
|
3
5
|
module Zm
|
|
4
6
|
module Support
|
|
5
7
|
module Cache
|
|
@@ -118,9 +120,9 @@ module Zm
|
|
|
118
120
|
end
|
|
119
121
|
|
|
120
122
|
if namespace
|
|
121
|
-
|
|
123
|
+
Digest::SHA256.hexdigest("#{namespace}:#{key}")
|
|
122
124
|
else
|
|
123
|
-
|
|
125
|
+
Digest::SHA256.hexdigest(key)
|
|
124
126
|
end
|
|
125
127
|
end
|
|
126
128
|
|
data/lib/zm/utils/log_filter.rb
CHANGED
|
@@ -7,19 +7,27 @@ module Zm
|
|
|
7
7
|
FILTERED = '[FILTERED]'
|
|
8
8
|
JSON_STRING = '"(?:[^"\\\\]|\\\\.)*"'
|
|
9
9
|
|
|
10
|
+
JSON_SECRET_KEYS = [
|
|
11
|
+
'"(?:password|newPassword|authToken)":',
|
|
12
|
+
'"(?:authToken|preauth)":\\[?\\{[^}]*?"_content":',
|
|
13
|
+
'"n":"(?:userPassword|zimbraPreAuthKey)","_content":'
|
|
14
|
+
].freeze
|
|
15
|
+
COOKIE_SECRET = 'ZM_(?:ADMIN_)?AUTH_TOKEN='
|
|
16
|
+
|
|
10
17
|
PATTERNS = [
|
|
11
|
-
[/(
|
|
12
|
-
[/(
|
|
13
|
-
[/("n":"(?:userPassword|zimbraPreAuthKey)","_content":)#{JSON_STRING}/o, "\\1\"#{FILTERED}\""],
|
|
14
|
-
[/(ZM_(?:ADMIN_)?AUTH_TOKEN=)[^;\s"]+/, "\\1#{FILTERED}"]
|
|
18
|
+
*JSON_SECRET_KEYS.map { |key| [/(#{key})#{JSON_STRING}/, "\\1\"#{FILTERED}\""] },
|
|
19
|
+
[/(#{COOKIE_SECRET})[^;\s"]+/o, "\\1#{FILTERED}"]
|
|
15
20
|
].freeze
|
|
16
21
|
|
|
22
|
+
FILTER_REGEX = /((?:#{JSON_SECRET_KEYS.join('|')})")(?:[^"\\]|\\.)*(")|(#{COOKIE_SECRET})[^;\s"]+/o
|
|
23
|
+
FILTER_REPLACEMENT = "\\1\\3#{FILTERED}\\2".freeze
|
|
24
|
+
|
|
17
25
|
module_function
|
|
18
26
|
|
|
19
27
|
def filter(str)
|
|
20
28
|
return str if str.nil?
|
|
21
29
|
|
|
22
|
-
|
|
30
|
+
str.gsub(FILTER_REGEX, FILTER_REPLACEMENT)
|
|
23
31
|
end
|
|
24
32
|
|
|
25
33
|
def apply(formatter)
|
data/lib/zm-ruby-client.rb
CHANGED
|
@@ -5,12 +5,12 @@ module Zm
|
|
|
5
5
|
|
|
6
6
|
module RequestMethodsAdmin
|
|
7
7
|
def delete!: () -> nil
|
|
8
|
-
def modify!: () ->
|
|
9
|
-
def update!: (?Hash[Symbol, untyped]? hash, ?update_attributes: bool, **untyped attrs) -> bool
|
|
8
|
+
def modify!: (?force: bool) -> bool
|
|
9
|
+
def update!: (?Hash[Symbol, untyped]? hash, ?update_attributes: bool, ?force: bool, **untyped attrs) -> bool
|
|
10
10
|
def rename!: (String new_name) -> String
|
|
11
11
|
|
|
12
12
|
def build_create: () -> SoapElement
|
|
13
|
-
def build_modify: () -> SoapElement
|
|
13
|
+
def build_modify: (?force: bool) -> SoapElement
|
|
14
14
|
def build_delete: () -> SoapElement
|
|
15
15
|
def build_rename: (String new_name) -> SoapElement
|
|
16
16
|
end
|
|
@@ -18,21 +18,38 @@ module Zm
|
|
|
18
18
|
|
|
19
19
|
module Client
|
|
20
20
|
class Account < Base::MailboxObject
|
|
21
|
+
extend Base::HasZimbraAttributes
|
|
22
|
+
include Base::HasZimbraAttributes::InstanceMethods
|
|
23
|
+
|
|
21
24
|
include SoapRequest::RequestMethodsAdmin
|
|
22
25
|
|
|
26
|
+
extend Base::HasCos
|
|
27
|
+
include Base::HasCos::EffectiveCos
|
|
28
|
+
|
|
23
29
|
def cos: () -> Cos?
|
|
30
|
+
def cos=: (Cos? value) -> Cos?
|
|
24
31
|
def create!: () -> String
|
|
25
32
|
def created_at: () -> Time?
|
|
26
33
|
def flush_cache!: () -> true
|
|
27
|
-
def attrs_write: () -> Array[String]
|
|
28
34
|
def batch: () -> BatchRequest
|
|
29
35
|
def empty_dumpster!: () -> untyped
|
|
30
36
|
end
|
|
31
37
|
|
|
32
38
|
class AccountsCollection < Base::AdminObjectsCollection[Account]
|
|
39
|
+
def all: () -> AccountsResponse
|
|
40
|
+
alias all! all
|
|
41
|
+
def find_in_batches: (?offset: Integer, ?limit: Integer) { (AccountsResponse) -> void } -> nil
|
|
33
42
|
def quotas: (?domain_name: String?, ?target_server_id: String?) -> Array[untyped]?
|
|
34
43
|
end
|
|
35
44
|
|
|
45
|
+
# Accounts returned by AccountsCollection#all and find_in_batches.
|
|
46
|
+
# by_server and statuses read zimbraMailHost and zimbraAccountStatus: an account searched without them
|
|
47
|
+
# (attrs) is counted under nil.
|
|
48
|
+
class AccountsResponse < Base::AdminObjectsResponse[Account]
|
|
49
|
+
def by_server: () -> Hash[String?, AccountsResponse]
|
|
50
|
+
def statuses: () -> Hash[String?, Integer]
|
|
51
|
+
end
|
|
52
|
+
|
|
36
53
|
class AccountAliasesCollection
|
|
37
54
|
def initialize: (Account parent) -> void
|
|
38
55
|
|
|
@@ -42,27 +59,52 @@ module Zm
|
|
|
42
59
|
end
|
|
43
60
|
|
|
44
61
|
class Resource < Base::MailboxObject
|
|
62
|
+
extend Base::HasZimbraAttributes
|
|
63
|
+
include Base::HasZimbraAttributes::InstanceMethods
|
|
64
|
+
|
|
45
65
|
include SoapRequest::RequestMethodsAdmin
|
|
46
66
|
|
|
47
67
|
LOCATION: String
|
|
48
68
|
EQUIPMENT: String
|
|
49
69
|
TYPES: Array[String]
|
|
50
70
|
|
|
71
|
+
extend Base::HasCos
|
|
72
|
+
include Base::HasCos::EffectiveCos
|
|
73
|
+
|
|
74
|
+
def cos: () -> Cos?
|
|
75
|
+
def cos=: (Cos? value) -> Cos?
|
|
51
76
|
def create!: () -> String
|
|
52
|
-
def attrs_write: () -> Array[String]
|
|
53
77
|
def location?: () -> bool
|
|
54
78
|
def equipment?: () -> bool
|
|
55
79
|
end
|
|
56
80
|
|
|
57
81
|
class ResourcesCollection < Base::AdminObjectsCollection[Resource]
|
|
82
|
+
def all: () -> ResourcesResponse
|
|
83
|
+
alias all! all
|
|
84
|
+
def find_in_batches: (?offset: Integer, ?limit: Integer) { (ResourcesResponse) -> void } -> nil
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Resources returned by ResourcesCollection#all and find_in_batches.
|
|
88
|
+
# locations and equipments read zimbraCalResType: a resource searched without it (attrs) is in neither.
|
|
89
|
+
class ResourcesResponse < Base::AdminObjectsResponse[Resource]
|
|
90
|
+
def locations: () -> ResourcesResponse
|
|
91
|
+
def equipments: () -> ResourcesResponse
|
|
58
92
|
end
|
|
59
93
|
|
|
60
94
|
class Domain < Base::Object
|
|
95
|
+
extend Base::HasZimbraAttributes
|
|
96
|
+
include Base::HasZimbraAttributes::InstanceMethods
|
|
97
|
+
|
|
61
98
|
include SoapRequest::RequestMethodsAdmin
|
|
62
99
|
|
|
100
|
+
LOCAL: String
|
|
101
|
+
ALIAS: String
|
|
102
|
+
|
|
103
|
+
extend Base::HasCos
|
|
104
|
+
|
|
63
105
|
def create!: () -> String
|
|
64
106
|
def cos: () -> Cos?
|
|
65
|
-
def
|
|
107
|
+
def cos=: (Cos? value) -> Cos?
|
|
66
108
|
def DKIMPublicTxt: () -> String?
|
|
67
109
|
|
|
68
110
|
def accounts: () -> DomainAccountsCollection
|
|
@@ -72,6 +114,18 @@ module Zm
|
|
|
72
114
|
end
|
|
73
115
|
|
|
74
116
|
class DomainsCollection < Base::AdminObjectsCollection[Domain]
|
|
117
|
+
def all: () -> DomainsResponse
|
|
118
|
+
alias all! all
|
|
119
|
+
def find_in_batches: (?offset: Integer, ?limit: Integer) { (DomainsResponse) -> void } -> nil
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Domains returned by DomainsCollection#all and find_in_batches.
|
|
123
|
+
# locals and aliases read zimbraDomainType, statuses zimbraDomainStatus: a domain searched without them (attrs)
|
|
124
|
+
# is in neither group and counted under nil.
|
|
125
|
+
class DomainsResponse < Base::AdminObjectsResponse[Domain]
|
|
126
|
+
def locals: () -> DomainsResponse
|
|
127
|
+
def aliases: () -> DomainsResponse
|
|
128
|
+
def statuses: () -> Hash[String?, Integer]
|
|
75
129
|
end
|
|
76
130
|
|
|
77
131
|
class DomainAccountsCollection < AccountsCollection
|
|
@@ -84,12 +138,14 @@ module Zm
|
|
|
84
138
|
end
|
|
85
139
|
|
|
86
140
|
class Cos < Base::Object
|
|
141
|
+
extend Base::HasZimbraAttributes
|
|
142
|
+
include Base::HasZimbraAttributes::InstanceMethods
|
|
143
|
+
|
|
87
144
|
def create!: () -> String
|
|
88
|
-
def modify!: () ->
|
|
89
|
-
def update!: (?Hash[Symbol, untyped]? hash, ?update_attributes: bool, **untyped attrs) -> bool
|
|
145
|
+
def modify!: (?force: bool) -> bool
|
|
146
|
+
def update!: (?Hash[Symbol, untyped]? hash, ?update_attributes: bool, ?force: bool, **untyped attrs) -> bool
|
|
90
147
|
def delete!: () -> nil
|
|
91
148
|
def clone!: (String new_name) -> String
|
|
92
|
-
def attrs_write: () -> Array[String]
|
|
93
149
|
|
|
94
150
|
def servers: () -> CosServersCollection
|
|
95
151
|
def domains: () -> CosDomainsCollection
|
|
@@ -113,10 +169,28 @@ module Zm
|
|
|
113
169
|
|
|
114
170
|
class CosesCollection < Base::AdminObjectsCollection[Cos]
|
|
115
171
|
def clone!: (String new_name) ?{ (Cos) -> void } -> String
|
|
172
|
+
def all: () -> CosesResponse
|
|
173
|
+
alias all! all
|
|
174
|
+
def find_in_batches: (?offset: Integer, ?limit: Integer) { (CosesResponse) -> void } -> nil
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Classes of service returned by CosesCollection#all and find_in_batches.
|
|
178
|
+
# with_server and by_server read zimbraMailHostPool (server ids), unlimited_quotas zimbraMailQuota (0):
|
|
179
|
+
# a COS searched without them (attrs) is in none of them.
|
|
180
|
+
class CosesResponse < Base::AdminObjectsResponse[Cos]
|
|
181
|
+
UNLIMITED_QUOTA: Integer
|
|
182
|
+
|
|
183
|
+
def with_server: (Server | String server) -> CosesResponse
|
|
184
|
+
# A COS is in the group of each server of its pool, the keys are the server ids.
|
|
185
|
+
def by_server: () -> Hash[String, CosesResponse]
|
|
186
|
+
def unlimited_quotas: () -> CosesResponse
|
|
116
187
|
end
|
|
117
188
|
|
|
118
189
|
class Server < Base::Object
|
|
119
|
-
|
|
190
|
+
extend Base::HasZimbraAttributes
|
|
191
|
+
include Base::HasZimbraAttributes::InstanceMethods
|
|
192
|
+
|
|
193
|
+
def update!: (?Hash[Symbol, untyped]? hash, ?update_attributes: bool, ?force: bool, **untyped attrs) -> bool
|
|
120
194
|
def mailboxes: () -> Array[Hash[Symbol, untyped]]?
|
|
121
195
|
|
|
122
196
|
def mta_queues: () -> MtaQueuesCollection
|
|
@@ -163,6 +237,14 @@ module Zm
|
|
|
163
237
|
end
|
|
164
238
|
|
|
165
239
|
class BackupsCollection < Base::ObjectsCollection[Backup]
|
|
240
|
+
def all: () -> BackupsResponse
|
|
241
|
+
alias all! all
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# Backups returned by BackupsCollection#all, the filters return a BackupsResponse.
|
|
245
|
+
class BackupsResponse < Array[Backup]
|
|
246
|
+
def fulls: () -> BackupsResponse
|
|
247
|
+
def incrementals: () -> BackupsResponse
|
|
166
248
|
end
|
|
167
249
|
|
|
168
250
|
class ServerAccountsCollection < AccountsCollection
|
|
@@ -171,9 +253,25 @@ module Zm
|
|
|
171
253
|
class ServersCollection < Base::AdminObjectsCollection[Server]
|
|
172
254
|
# Filters servers by enabled service (mailbox, mta, proxy...).
|
|
173
255
|
def where: (String service) -> self
|
|
256
|
+
def all: () -> ServersResponse
|
|
257
|
+
alias all! all
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# Servers returned by ServersCollection#all, selected by zimbraServiceEnabled (ServerServices).
|
|
261
|
+
class ServersResponse < Base::AdminObjectsResponse[Server]
|
|
262
|
+
def with_service: (String service) -> ServersResponse
|
|
263
|
+
def mailbox_servers: () -> ServersResponse
|
|
264
|
+
def mta_servers: () -> ServersResponse
|
|
265
|
+
def proxy_servers: () -> ServersResponse
|
|
266
|
+
def ldap_servers: () -> ServersResponse
|
|
267
|
+
# A server is in the group of each of its enabled services.
|
|
268
|
+
def by_service: () -> Hash[String, ServersResponse]
|
|
174
269
|
end
|
|
175
270
|
|
|
176
271
|
class DistributionList < Base::Object
|
|
272
|
+
extend Base::HasZimbraAttributes
|
|
273
|
+
include Base::HasZimbraAttributes::InstanceMethods
|
|
274
|
+
|
|
177
275
|
include SoapRequest::RequestMethodsAdmin
|
|
178
276
|
|
|
179
277
|
def create!: () -> String
|
|
@@ -184,7 +282,6 @@ module Zm
|
|
|
184
282
|
def hide_in_gal?: () -> bool
|
|
185
283
|
def group?: () -> bool
|
|
186
284
|
def mailing_list?: () -> bool
|
|
187
|
-
def attrs_write: () -> Array[String]
|
|
188
285
|
|
|
189
286
|
def aliases: () -> DistributionListAliasesCollection
|
|
190
287
|
def members: () -> DistributionListMembersCollection
|
|
@@ -194,6 +291,17 @@ module Zm
|
|
|
194
291
|
end
|
|
195
292
|
|
|
196
293
|
class DistributionListsCollection < Base::AdminObjectsCollection[DistributionList]
|
|
294
|
+
def all: () -> DistributionListsResponse
|
|
295
|
+
alias all! all
|
|
296
|
+
def find_in_batches: (?offset: Integer, ?limit: Integer) { (DistributionListsResponse) -> void } -> nil
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
# Distribution lists returned by DistributionListsCollection#all and find_in_batches.
|
|
300
|
+
# groups (zimbraMailStatus disabled) and mailing_lists (enabled): a list searched without zimbraMailStatus
|
|
301
|
+
# (attrs) is in neither.
|
|
302
|
+
class DistributionListsResponse < Base::AdminObjectsResponse[DistributionList]
|
|
303
|
+
def groups: () -> DistributionListsResponse
|
|
304
|
+
def mailing_lists: () -> DistributionListsResponse
|
|
197
305
|
end
|
|
198
306
|
|
|
199
307
|
class DistributionListAliasesCollection
|
data/sig/zm/client/base.rbs
CHANGED
|
@@ -60,8 +60,12 @@ module Zm
|
|
|
60
60
|
def attrs: (*(String | Symbol | Array[String | Symbol]) attributes) -> self
|
|
61
61
|
def count: () -> Integer
|
|
62
62
|
def clear: () -> self
|
|
63
|
+
def all: () -> AdminObjectsResponse[T]
|
|
64
|
+
alias all! all
|
|
63
65
|
|
|
64
|
-
|
|
66
|
+
# Yields each page of the search (limit objects at most).
|
|
67
|
+
def find_in_batches: (?offset: Integer, ?limit: Integer) { (AdminObjectsResponse[T]) -> void } -> nil
|
|
68
|
+
def find_each: (?offset: Integer, ?limit: Integer) { (T) -> void } -> nil
|
|
65
69
|
|
|
66
70
|
def update_all!: (?Hash[Symbol, untyped]? hash, ?onerror: onerror, ?update_attributes: bool, **untyped attrs)
|
|
67
71
|
-> Array[T]
|
|
@@ -71,6 +75,16 @@ module Zm
|
|
|
71
75
|
def mass_delete!: (Array[T | String] items, ?onerror: onerror) -> Array[T]
|
|
72
76
|
end
|
|
73
77
|
|
|
78
|
+
# Array of the objects returned by AdminObjectsCollection#all and find_in_batches.
|
|
79
|
+
# update_all! and delete_all! send one request per object, select, map or dup return a plain Array.
|
|
80
|
+
class AdminObjectsResponse[T] < Array[T]
|
|
81
|
+
def initialize: (AdminObjectsCollection[T] collection, ?Array[T] items) -> void
|
|
82
|
+
|
|
83
|
+
def update_all!: (?Hash[Symbol, untyped]? hash, ?onerror: AdminObjectsCollection::onerror,
|
|
84
|
+
?update_attributes: bool, **untyped attrs) -> Array[T]
|
|
85
|
+
def delete_all!: (?onerror: AdminObjectsCollection::onerror) -> Array[T]
|
|
86
|
+
end
|
|
87
|
+
|
|
74
88
|
class AccountObjectsCollection[T] < ObjectsCollection[T]
|
|
75
89
|
def initialize: (untyped parent) -> void
|
|
76
90
|
end
|
|
@@ -98,13 +112,76 @@ module Zm
|
|
|
98
112
|
def immutable?: () -> bool
|
|
99
113
|
end
|
|
100
114
|
|
|
115
|
+
module HasZimbraAttributes
|
|
116
|
+
def zimbra_attr: (*(Symbol | String | Array[Symbol | String]) names, ?readonly: bool) -> Array[Symbol]
|
|
117
|
+
def zimbra_attrs: () -> Array[Symbol]
|
|
118
|
+
def zimbra_attrs_writable: () -> Array[Symbol]
|
|
119
|
+
def zimbra_attrs_readonly: () -> Array[Symbol]
|
|
120
|
+
def attrs_write: () -> Array[String]
|
|
121
|
+
def attrs_write_ivars: () -> Array[Symbol]
|
|
122
|
+
def zimbra_attrs_ivars: () -> Hash[String, Symbol]
|
|
123
|
+
|
|
124
|
+
module InstanceMethods
|
|
125
|
+
EMPTY_CHANGES: Array[Symbol]
|
|
126
|
+
|
|
127
|
+
def attrs_write: () -> Array[String]
|
|
128
|
+
def zimbra_attrs_changed: () -> Array[Symbol]
|
|
129
|
+
def zimbra_attrs_changed?: () -> bool
|
|
130
|
+
def zimbra_attr_changed?: (Symbol | String name) -> bool
|
|
131
|
+
def zimbra_attr_will_change!: (Symbol | String name) -> self
|
|
132
|
+
def clear_zimbra_attrs_changes: () -> self
|
|
133
|
+
|
|
134
|
+
private
|
|
135
|
+
|
|
136
|
+
def zimbra_attrs_to_update: (Hash[Symbol | String, untyped] hash, bool force) -> Hash[Symbol | String, untyped]
|
|
137
|
+
def zimbra_attr_unchanged?: (Symbol | String key, untyped value) -> bool
|
|
138
|
+
def same_zimbra_values?: (untyped current, untyped value) -> bool
|
|
139
|
+
def forget_zimbra_attr_change: (Symbol | String key) -> void
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
module HasCos
|
|
144
|
+
DEFAULT_COS_NAME: String
|
|
145
|
+
NOT_INHERITED_FROM_COS: Array[Symbol]
|
|
146
|
+
|
|
147
|
+
def has_cos: (Symbol attribute, ?effective: bool) -> void
|
|
148
|
+
|
|
149
|
+
private
|
|
150
|
+
|
|
151
|
+
def define_cos_reader: (Symbol ivar) -> Symbol
|
|
152
|
+
def define_cos_writer: (Symbol setter) -> Symbol
|
|
153
|
+
|
|
154
|
+
public
|
|
155
|
+
|
|
156
|
+
module EffectiveCos
|
|
157
|
+
def effective_cos: () -> Cos
|
|
158
|
+
def reset_to_cos!: (?cos: Cos) -> Array[Symbol]
|
|
159
|
+
|
|
160
|
+
private
|
|
161
|
+
|
|
162
|
+
def attrs_equal_to_cos: (Cos cos) -> Array[Symbol]
|
|
163
|
+
def cos_inheritable_attrs: () -> Array[Symbol]
|
|
164
|
+
def same_as_cos_value?: (untyped value, untyped cos_value) -> bool
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
module ZimbraAttrsJsns
|
|
169
|
+
CLEARED_VALUES: Array[String]
|
|
170
|
+
|
|
171
|
+
def attrs_only_set_h: () -> Hash[String, Array[untyped]]
|
|
172
|
+
def attrs_changed_h: () -> Hash[String, Array[untyped]]
|
|
173
|
+
def attrs_to_update_h: (bool force) -> Hash[String, Array[untyped]]
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# deprecated, removed in 4.0
|
|
101
177
|
class ZimbraAttributesCollection
|
|
102
|
-
attr_reader path: String
|
|
103
178
|
attr_reader all: Array[ZimbraAttribute]
|
|
104
179
|
|
|
105
|
-
def self.shared: (Cluster parent) -> ZimbraAttributesCollection
|
|
180
|
+
def self.shared: (?Cluster? parent) -> ZimbraAttributesCollection
|
|
181
|
+
|
|
182
|
+
def initialize: (?Cluster? parent) -> void
|
|
106
183
|
|
|
107
|
-
def
|
|
184
|
+
def path: () -> nil
|
|
108
185
|
|
|
109
186
|
def all_account_attrs: () -> Array[ZimbraAttribute]
|
|
110
187
|
def all_account_attrs_writable_names: () -> Array[String]
|
data/sig/zm/client/cluster.rbs
CHANGED
|
@@ -12,16 +12,17 @@ module Zm
|
|
|
12
12
|
|
|
13
13
|
class ClusterConfig
|
|
14
14
|
BASE_URL_REGEX: Regexp
|
|
15
|
+
ZIMBRA_VERSION_ADVICE: String
|
|
15
16
|
|
|
16
17
|
attr_reader zimbra_admin_url: String?
|
|
17
18
|
attr_reader zimbra_public_url: String?
|
|
18
19
|
attr_writer logger: ::Logger
|
|
19
|
-
|
|
20
|
+
def colorize_logging=: (bool value) -> void
|
|
20
21
|
attr_accessor zimbra_admin_login: String?
|
|
21
22
|
attr_accessor zimbra_admin_password: String?
|
|
22
23
|
attr_accessor domains: Array[ClusterConfigDomain]
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
attr_reader log_path: String | _LogDevice | nil
|
|
25
|
+
def log_path=: (String | _LogDevice | nil path) -> void
|
|
25
26
|
attr_accessor timeout: Integer
|
|
26
27
|
attr_accessor ssl_verify: bool
|
|
27
28
|
attr_accessor ssl_ca_file: String?
|
|
@@ -41,11 +42,14 @@ module Zm
|
|
|
41
42
|
def domain_key: (String domain_name) -> String?
|
|
42
43
|
def has_admin_credentials?: () -> bool
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
# deprecated, removed in 4.0
|
|
46
|
+
def zimbra_attributes_path: () -> nil
|
|
45
47
|
def zimbra_attributes_path=: (String path) -> void
|
|
48
|
+
def zimbra_version: () -> String
|
|
49
|
+
def zimbra_version=: (String version) -> void
|
|
46
50
|
|
|
47
51
|
def logger: () -> ::Logger
|
|
48
|
-
def log_level=: (Integer level) -> void
|
|
52
|
+
def log_level=: (Integer | String | Symbol level) -> void
|
|
49
53
|
end
|
|
50
54
|
|
|
51
55
|
class ClusterConfigDomain < Data
|
|
@@ -62,7 +66,6 @@ module Zm
|
|
|
62
66
|
class Cluster
|
|
63
67
|
attr_reader soap_admin_connector: Connector::SoapAdminConnector
|
|
64
68
|
attr_reader config: ClusterConfig
|
|
65
|
-
attr_reader zimbra_attributes: Base::ZimbraAttributesCollection
|
|
66
69
|
attr_reader type: String?
|
|
67
70
|
attr_reader version: String?
|
|
68
71
|
attr_reader release: String?
|
|
@@ -80,6 +83,9 @@ module Zm
|
|
|
80
83
|
|
|
81
84
|
# Raises ClusterConfigError without admin credentials, Zm::Error::AuthError on bad credentials.
|
|
82
85
|
def login: () -> void
|
|
86
|
+
# deprecated, removed in 4.0
|
|
87
|
+
def zimbra_attributes: () -> Base::ZimbraAttributesCollection
|
|
88
|
+
|
|
83
89
|
def logged?: () -> bool
|
|
84
90
|
def alive?: () -> bool
|
|
85
91
|
def logged_and_alive?: () -> bool
|
|
@@ -95,6 +101,7 @@ module Zm
|
|
|
95
101
|
alias distributionlists distribution_lists
|
|
96
102
|
|
|
97
103
|
def domain_key: (String domain_name) -> String?
|
|
104
|
+
def clear_domain_keys: () -> self
|
|
98
105
|
def count_object: (count_object_type | String type) -> Integer
|
|
99
106
|
def email_exist?: (String email) -> bool
|
|
100
107
|
def infos!: () -> void
|