Sha256: 251cf769122efd2725215e0f4293c31cb7a525a093fa1fb9ed33e6e7ce7836b4
Contents?: true
Size: 1.67 KB
Versions: 3
Compression:
Stored size: 1.67 KB
Contents
# frozen_string_literal: true class ControlplaneApi def gvc_list(org:) api_json("/org/#{org}/gvc", method: :get) end def gvc_get(org:, gvc:) api_json("/org/#{org}/gvc/#{gvc}", method: :get) end def gvc_delete(org:, gvc:) api_json("/org/#{org}/gvc/#{gvc}", method: :delete) end def image_delete(org:, image:) api_json("/org/#{org}/image/#{image}", method: :delete) end def log_get(org:, gvc:, workload: nil, from: nil, to: nil) query = { gvc: gvc } query[:workload] = workload if workload query = query.map { |k, v| %(#{k}="#{v}") }.join(",").then { "{#{_1}}" } params = { query: query } params[:from] = "#{from}000000000" if from params[:to] = "#{to}000000000" if to # params << "delay_for=0" # params << "limit=30" # params << "direction=forward" params = params.map { |k, v| %(#{k}=#{CGI.escape(v)}) }.join("&") api_json_direct("/logs/org/#{org}/loki/api/v1/query_range?#{params}", method: :get, host: :logs) end def workload_list(org:, gvc:) api_json("/org/#{org}/gvc/#{gvc}/workload", method: :get) end def workload_list_by_org(org:) api_json("/org/#{org}/workload", method: :get) end def workload_get(org:, gvc:, workload:) api_json("/org/#{org}/gvc/#{gvc}/workload/#{workload}", method: :get) end def workload_deployments(org:, gvc:, workload:) api_json("/org/#{org}/gvc/#{gvc}/workload/#{workload}/deployment", method: :get) end private # switch between cpln rest and api def api_json(...) ControlplaneApiDirect.new.call(...) end # only for api (where not impelemented in cpln rest) def api_json_direct(...) ControlplaneApiDirect.new.call(...) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cpl-0.6.0 | lib/core/controlplane_api.rb |
cpl-0.5.1 | lib/core/controlplane_api.rb |
cpl-0.5.0 | lib/core/controlplane_api.rb |