debian-mirror-gitlab/lib/gitlab/kubernetes/kubeconfig/entry/context.rb
2021-10-27 15:23:28 +05:30

39 lines
747 B
Ruby

# frozen_string_literal: true
module Gitlab
module Kubernetes
module Kubeconfig
module Entry
class Context
attr_reader :name
def initialize(name:, cluster:, user:, namespace: nil)
@name = name
@cluster = cluster
@user = user
@namespace = namespace
end
def to_h
{
name: name,
context: context
}
end
private
attr_reader :cluster, :user, :namespace
def context
{
cluster: cluster,
namespace: namespace,
user: user
}.compact
end
end
end
end
end
end