Method: SDM::PeeringGroups#create

Defined in:
lib/svc.rb

#create(peering_group, deadline: nil) ⇒ Object

Create registers a new PeeringGroup.



2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
# File 'lib/svc.rb', line 2155

def create(
  peering_group,
  deadline: nil
)
  req = V1::PeeringGroupCreateRequest.new()

  req.peering_group = Plumbing::convert_peering_group_to_plumbing(peering_group)
  tries = 0
  plumbing_response = nil
  loop do
    begin
      plumbing_response = @stub.create(req, metadata: @parent.("PeeringGroups.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 = PeeringGroupCreateResponse.new()
  resp.meta = Plumbing::(plumbing_response.meta)
  resp.peering_group = Plumbing::convert_peering_group_to_porcelain(plumbing_response.peering_group)
  resp.rate_limit = Plumbing::(plumbing_response.rate_limit)
  resp
end