コード例 #1
0
        public CustomResourceWatcher(
            ILogger logger,
            IKubernetesWrapper client,
            CustomResourceDefinition crd,
            CancellationToken cancellationToken,
            Action <WatchEventType, T> handle)
        {
            Guard.Against.Null(logger, "iLogger");
            Guard.Against.Null(client, "client");
            Guard.Against.Null(crd, "crd");
            Guard.Against.OutOfRange(crd.ApiVersion.Split('/').Count(), "crd.ApiVersion", 2, 2);

            _logger            = logger ?? throw new ArgumentNullException(nameof(logger));
            _client            = client ?? throw new ArgumentNullException(nameof(client));
            _crd               = crd ?? throw new ArgumentNullException(nameof(crd));
            _cancellationToken = cancellationToken;
            _handle            = handle ?? throw new ArgumentNullException(nameof(handle));
            _cache             = new Dictionary <string, T>();
        }
コード例 #2
0
        public async Task <HttpOperationResponse <object> > DeleteNamespacedCustomObjectWithHttpMessagesAsync(CustomResourceDefinition crd, string name)
        {
            Guard.Against.Null(crd, "crd");
            Guard.Against.NullOrWhiteSpace(crd.ApiVersion, "crd.ApiVersion");
            Guard.Against.NullOrWhiteSpace(crd.Namespace, "crd.Namespace");
            Guard.Against.NullOrWhiteSpace(crd.PluralName, "crd.PluralName");
            Guard.Against.NullOrWhiteSpace(name, "name");

            return(await _client.DeleteNamespacedCustomObjectWithHttpMessagesAsync(
                       group : crd.ApiVersion.Split('/')[0],
                       version : crd.ApiVersion.Split('/')[1],
                       namespaceParameter : crd.Namespace,
                       plural : crd.PluralName,
                       name : name)
                   .ConfigureAwait(false));
        }