Class: SDM::RoleAttachments

Inherits:
Object
  • Object
show all
Extended by:
Gem::Deprecate
Defined in:
lib/svc.rb

Overview

RoleAttachments represent relationships between composite roles and the roles that make up those composite roles. When a composite role is attached to another role, the permissions granted to members of the composite role are augmented to include the permissions granted to members of the attached role.

Deprecated: use multi-role via AccountAttachments instead.

See RoleAttachment.

Instance Method Summary collapse

Constructor Details

#initialize(host, insecure, parent) ⇒ RoleAttachments

Returns a new instance of RoleAttachments.



1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
# File 'lib/svc.rb', line 1058

def initialize(host, insecure, parent)
  begin
    if insecure
      @stub = V1::RoleAttachments::Stub.new(host, :this_channel_is_insecure)
    else
      cred = GRPC::Core::ChannelCredentials.new()
      @stub = V1::RoleAttachments::Stub.new(host, cred)
    end
  rescue => exception
    raise Plumbing::convert_error_to_porcelain(exception)
  end
  @parent = parent
end

Instance Method Details

#create(role_attachment, deadline: nil) ⇒ Object

Create registers a new RoleAttachment.

Deprecated: use multi-role via AccountAttachments instead.



1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
# File 'lib/svc.rb', line 1075

def create(
  role_attachment,
  deadline: nil
)
  req = V1::RoleAttachmentCreateRequest.new()

  req.role_attachment = Plumbing::convert_role_attachment_to_plumbing(role_attachment)
  tries = 0
  plumbing_response = nil
  loop do
    begin
      plumbing_response = @stub.create(req, metadata: @parent.("RoleAttachments.Create", req), deadline: deadline)
    rescue => exception
      if (@parent.shouldRetry(tries, exception))
        tries + +@parent.jitterSleep(tries)
        next
      end
      raise Plumbing::convert_error_to_porcelain(exception)
    end
    break
  end

  resp = RoleAttachmentCreateResponse.new()
  resp.meta = Plumbing::(plumbing_response.meta)
  resp.rate_limit = Plumbing::(plumbing_response.rate_limit)
  resp.role_attachment = Plumbing::convert_role_attachment_to_porcelain(plumbing_response.role_attachment)
  resp
end

#delete(id, deadline: nil) ⇒ Object

Delete removes a RoleAttachment by ID.

Deprecated: use multi-role via AccountAttachments instead.



1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
# File 'lib/svc.rb', line 1141

def delete(
  id,
  deadline: nil
)
  req = V1::RoleAttachmentDeleteRequest.new()

  req.id = (id)
  tries = 0
  plumbing_response = nil
  loop do
    begin
      plumbing_response = @stub.delete(req, metadata: @parent.("RoleAttachments.Delete", req), deadline: deadline)
    rescue => exception
      if (@parent.shouldRetry(tries, exception))
        tries + +@parent.jitterSleep(tries)
        next
      end
      raise Plumbing::convert_error_to_porcelain(exception)
    end
    break
  end

  resp = RoleAttachmentDeleteResponse.new()
  resp.meta = Plumbing::(plumbing_response.meta)
  resp.rate_limit = Plumbing::(plumbing_response.rate_limit)
  resp
end

#get(id, deadline: nil) ⇒ Object

Get reads one RoleAttachment by ID.

Deprecated: use multi-role via AccountAttachments instead.



1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
# File 'lib/svc.rb', line 1108

def get(
  id,
  deadline: nil
)
  req = V1::RoleAttachmentGetRequest.new()

  req.id = (id)
  tries = 0
  plumbing_response = nil
  loop do
    begin
      plumbing_response = @stub.get(req, metadata: @parent.("RoleAttachments.Get", req), deadline: deadline)
    rescue => exception
      if (@parent.shouldRetry(tries, exception))
        tries + +@parent.jitterSleep(tries)
        next
      end
      raise Plumbing::convert_error_to_porcelain(exception)
    end
    break
  end

  resp = RoleAttachmentGetResponse.new()
  resp.meta = Plumbing::(plumbing_response.meta)
  resp.rate_limit = Plumbing::(plumbing_response.rate_limit)
  resp.role_attachment = Plumbing::convert_role_attachment_to_porcelain(plumbing_response.role_attachment)
  resp
end

#list(filter, *args, deadline: nil) ⇒ Object

List gets a list of RoleAttachments matching a given set of criteria.

Deprecated: use multi-role via AccountAttachments instead.



1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
# File 'lib/svc.rb', line 1173

def list(
  filter,
  *args,
  deadline: nil
)
  req = V1::RoleAttachmentListRequest.new()
  req.meta = V1::ListRequestMetadata.new()
  page_size_option = @parent._test_options["PageSize"]
  if page_size_option.is_a? Integer
    req.meta.limit = page_size_option
  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.("RoleAttachments.List", req), deadline: deadline)
      rescue => exception
        if (@parent.shouldRetry(tries, exception))
          tries + +@parent.jitterSleep(tries)
          next
        end
        raise Plumbing::convert_error_to_porcelain(exception)
      end
      tries = 0
      plumbing_response.role_attachments.each do |plumbing_item|
        g.yield Plumbing::convert_role_attachment_to_porcelain(plumbing_item)
      end
      break if plumbing_response.meta.next_cursor == ""
      req.meta.cursor = plumbing_response.meta.next_cursor
    end
  }
  resp
end