Esempio n. 1
0
        /// <summary>
        /// Creates api client if not exists.
        /// </summary>
        /// <returns></returns>
        private static void CreateClientIfNotExists()
        {
            if (_client != null)
            {
                return;
            }
            if (!IsKubernetes)
            {
                return;
            }

            ApiClient client = new ApiClient($"https://{Host}:{Port}/");

            Configuration.DefaultApiClient = client;
            try
            {
                KubernetesConfiguration.ConfigureWithPodEnvironment();
            }
            catch (NotKubernetesPodException)
            {
                return;
            }
            _client = client;
            client.AddDefaultHeader("Authorization", "Bearer " + Configuration.Password);

            // Initialize APIs
            APIApi        = new ApiApi(client);
            APIsApi       = new ApisApi(client);
            ExtensionsApi = new ExtensionsApi(client);
            V1Api         = new VApi(client);
            VBetaApi      = new VbetaApi(client);
            VersionApi    = new VersionApi(client);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates api client if not exists.
        /// </summary>
        /// <returns></returns>
        private static void CreateClientIfNotExists()
        {
            if (_client != null) return;
            if (!IsKubernetes) return;

            ApiClient client = new ApiClient($"https://{Host}:{Port}/");
            Configuration.DefaultApiClient = client;
            try
            {
                KubernetesConfiguration.ConfigureWithPodEnvironment();
            }
            catch (NotKubernetesPodException)
            {
                return;
            }
            _client = client;
            client.AddDefaultHeader("Authorization", "Bearer " + Configuration.Password);

            // Initialize APIs
            APIApi = new ApiApi(client);
            APIsApi = new ApisApi(client);
            ExtensionsApi = new ExtensionsApi(client);
            V1Api = new VApi(client);
            VBetaApi = new VbetaApi(client);
            VersionApi = new VersionApi(client);
        }