Class: SDM::PeeringGroups
- Inherits:
-
Object
- Object
- SDM::PeeringGroups
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/svc.rb
Overview
PeeringGroups provides the building blocks necessary to obtain explicit network topology and routing.
See PeeringGroup.
Instance Method Summary collapse
-
#create(peering_group, deadline: nil) ⇒ Object
Create registers a new PeeringGroup.
-
#delete(id, deadline: nil) ⇒ Object
Delete removes a PeeringGroup by ID.
-
#get(id, deadline: nil) ⇒ Object
Get reads one PeeringGroup by ID.
-
#initialize(channel, parent) ⇒ PeeringGroups
constructor
A new instance of PeeringGroups.
-
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Peering Groups.
Constructor Details
#initialize(channel, parent) ⇒ PeeringGroups
Returns a new instance of PeeringGroups.
2887 2888 2889 2890 2891 2892 2893 2894 |
# File 'lib/svc.rb', line 2887 def initialize(channel, parent) begin @stub = V1::PeeringGroups::Stub.new(nil, nil, channel_override: channel) rescue => exception raise Plumbing::convert_error_to_porcelain(exception) end @parent = parent end |
Instance Method Details
#create(peering_group, deadline: nil) ⇒ Object
Create registers a new PeeringGroup.
2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 |
# File 'lib/svc.rb', line 2897 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. = Plumbing::(plumbing_response.) resp.peering_group = Plumbing::convert_peering_group_to_porcelain(plumbing_response.peering_group) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete removes a PeeringGroup by ID.
2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 |
# File 'lib/svc.rb', line 2927 def delete( id, deadline: nil ) req = V1::PeeringGroupDeleteRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("PeeringGroups.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 = PeeringGroupDeleteResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get(id, deadline: nil) ⇒ Object
Get reads one PeeringGroup by ID. It will load all its dependencies.
2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 |
# File 'lib/svc.rb', line 2956 def get( id, deadline: nil ) req = V1::PeeringGroupGetRequest.new() if not @parent.snapshot_time.nil? req. = V1::GetRequestMetadata.new() req..snapshot_at = @parent.snapshot_time end req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.get(req, metadata: @parent.("PeeringGroups.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 = PeeringGroupGetResponse.new() resp. = Plumbing::(plumbing_response.) resp.peering_group = Plumbing::convert_peering_group_to_porcelain(plumbing_response.peering_group) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
List gets a list of Peering Groups.
2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 |
# File 'lib/svc.rb', line 2990 def list( filter, *args, deadline: nil ) req = V1::PeeringGroupListRequest.new() req. = V1::ListRequestMetadata.new() if @parent.page_limit > 0 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.("PeeringGroups.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.peering_groups.each do |plumbing_item| g.yield Plumbing::convert_peering_group_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |