Exemple #1
0
        protected override async Task ProcessRecordAsync(CancellationToken cancellationToken)
        {
            await base.ProcessRecordAsync(cancellationToken);

            if (Path == null)
            {
                // Object given
                await updateResource(Resource, cancellationToken);
            }
            else
            {
                // File path given
                var          deserializer = new KubeYamlDeserializer(Logger, ModelTypes);
                ProviderInfo provider;
                // Resolve wildcards
                var paths = GetResolvedProviderPathFromPSPath(Path, out provider);
                foreach (var path in paths)
                {
                    WriteVerbose($"Reading object from YAML file {path}");
                    string yaml;
                    using (var streamReader = File.OpenText(path)) {
                        yaml = await streamReader.ReadToEndAsync();
                    }
                    var modified = deserializer.Deserialize(yaml);
                    await updateResource(modified, cancellationToken);
                }
            }
        }
Exemple #2
0
        protected override async Task ProcessRecordAsync(CancellationToken cancellationToken)
        {
            await base.ProcessRecordAsync(cancellationToken);

            var deserializer = new KubeYamlDeserializer(Logger, ModelTypes);
            var resource     = deserializer.Deserialize(InputObject);

            WriteObject(resource);
        }