Class: SDM::AccountsGroups
- Inherits:
-
Object
- Object
- SDM::AccountsGroups
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/svc.rb
Overview
An AccountGroup links an account and a group.
See AccountGroup.
Instance Method Summary collapse
-
#create(account_group, deadline: nil) ⇒ Object
Create create a new AccountGroup.
-
#delete(id, deadline: nil) ⇒ Object
Delete removes an AccountGroup by ID.
-
#get(id, deadline: nil) ⇒ Object
Get reads one AccountGroup by ID.
-
#initialize(channel, parent) ⇒ AccountsGroups
constructor
A new instance of AccountsGroups.
-
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of AccountGroups matching a given set of criteria.
Constructor Details
#initialize(channel, parent) ⇒ AccountsGroups
1180 1181 1182 1183 1184 1185 1186 1187 |
# File 'lib/svc.rb', line 1180 def initialize(channel, parent) begin @stub = V1::AccountsGroups::Stub.new(nil, nil, channel_override: channel) rescue => exception raise Plumbing::convert_error_to_porcelain(exception) end @parent = parent end |
Instance Method Details
#create(account_group, deadline: nil) ⇒ Object
Create create a new AccountGroup.
1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 |
# File 'lib/svc.rb', line 1190 def create( account_group, deadline: nil ) req = V1::AccountGroupCreateRequest.new() req.account_group = Plumbing::convert_account_group_to_plumbing(account_group) # Execute before interceptor hooks req = @parent.interceptor.execute_before("AccountsGroups.Create", self, req) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("AccountsGroups.Create", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception, deadline)) tries + +sleep(@parent.exponentialBackoff(tries, deadline)) next end raise Plumbing::convert_error_to_porcelain(exception) end break end # Execute after interceptor hooks plumbing_response = @parent.interceptor.execute_after("AccountsGroups.Create", self, req, plumbing_response) resp = AccountGroupCreateResponse.new() resp.account_group = Plumbing::convert_account_group_to_porcelain(plumbing_response.account_group) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete removes an AccountGroup by ID.
1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 |
# File 'lib/svc.rb', line 1263 def delete( id, deadline: nil ) req = V1::AccountGroupDeleteRequest.new() req.id = (id) # Execute before interceptor hooks req = @parent.interceptor.execute_before("AccountsGroups.Delete", self, req) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("AccountsGroups.Delete", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception, deadline)) tries + +sleep(@parent.exponentialBackoff(tries, deadline)) next end raise Plumbing::convert_error_to_porcelain(exception) end break end # Execute after interceptor hooks plumbing_response = @parent.interceptor.execute_after("AccountsGroups.Delete", self, req, plumbing_response) resp = AccountGroupDeleteResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get(id, deadline: nil) ⇒ Object
Get reads one AccountGroup by ID.
1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 |
# File 'lib/svc.rb', line 1224 def get( id, deadline: nil ) req = V1::AccountGroupGetRequest.new() if not @parent.snapshot_time.nil? req. = V1::GetRequestMetadata.new() req..snapshot_at = @parent.snapshot_time end req.id = (id) # Execute before interceptor hooks req = @parent.interceptor.execute_before("AccountsGroups.Get", self, req) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.get(req, metadata: @parent.("AccountsGroups.Get", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception, deadline)) tries + +sleep(@parent.exponentialBackoff(tries, deadline)) next end raise Plumbing::convert_error_to_porcelain(exception) end break end # Execute after interceptor hooks plumbing_response = @parent.interceptor.execute_after("AccountsGroups.Get", self, req, plumbing_response) resp = AccountGroupGetResponse.new() resp.account_group = Plumbing::convert_account_group_to_porcelain(plumbing_response.account_group) resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of AccountGroups matching a given set of criteria.
1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 |
# File 'lib/svc.rb', line 1297 def list( filter, *args, deadline: nil ) req = V1::AccountGroupListRequest.new() req. = V1::ListRequestMetadata.new() if not @parent.page_limit.nil? req..limit = @parent.page_limit end if not @parent.snapshot_time.nil? req..snapshot_at = @parent.snapshot_time end req.filter = Plumbing::quote_filter_args(filter, *args) resp = Enumerator::Generator.new { |g| tries = 0 loop do begin plumbing_response = @stub.list(req, metadata: @parent.("AccountsGroups.List", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception, deadline)) tries + +sleep(@parent.exponentialBackoff(tries, deadline)) next end raise Plumbing::convert_error_to_porcelain(exception) end tries = 0 plumbing_response.account_groups.each do |plumbing_item| g.yield Plumbing::convert_account_group_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |