protected override async Task ProcessRecordAsync(CancellationToken cancellationToken)
        {
            await base.ProcessRecordAsync(cancellationToken);

            if (Path == null)
            {
                // Object given
                var yaml = Resource is KubeResourceV1 ? null : serializer.Serialize(Resource);
                await updateResource(Resource, yaml, cancellationToken);
            }
            else
            {
                // File path given
                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 resource = deserializer.Deserialize(yaml);
                    await updateResource(resource, yaml, cancellationToken);
                }
            }
        }
Example #2
0
        protected override async Task ProcessRecordAsync(CancellationToken cancellationToken)
        {
            await base.ProcessRecordAsync(cancellationToken);

            var serializer = new KubeYamlSerializer(Logger);
            var yaml       = serializer.Serialize(InputObject);

            WriteObject(yaml);
        }