f62b3e90b1
BREAKING: operation failures are now non-terminating errors, so -ErrorAction (and $ErrorActionPreference) decides the outcome. try/catch around these cmdlets now requires -ErrorAction Stop or $ErrorActionPreference = 'Stop'. A failing pipeline item no longer aborts the batch. Cmdlets no longer report "The pipeline has been stopped." as an error. Select-Object -First, and Where-Object feeding it, stop the upstream cmdlet by design; the shared error path in InfisicalCmdletBase now lets pipeline-control exceptions propagate untouched instead of logging them and raising an error. Error-level diagnostics moved off the warning stream to verbose. Every Logger.Error call site logs and then throws, so the failure already reaches the caller as an ErrorRecord; emitting it again as eight warning lines put failures under -WarningAction instead of -ErrorAction. One error per failure now. Request-InfisicalCertificate: - -CommonName accepts the RDN form (CN=WEB01) and reduces it to the bare value, which previously produced a CN=CN=WEB01 subject plus a bogus DNS SAN. - -DnsName routes IP literals to iPAddress SAN entries, so the mixed output of Get-InfisicalSANList can be splatted in as documented. - The CA path sends the normalized common name to the signing endpoint. - The issuance path is resolved and reported before a keypair is generated, and a CA with direct issuance disabled fails fast with guidance naming -PkiSubscriberSlug and -CertificateProfileId. Infisical exposes no template-based issuance route, so no -CertificateTemplateId is added. Get-InfisicalCertificateAuthority table output gains a DirectIssue column (EnableDirectIssuance) so CAs eligible for -CertificateAuthorityId are visible. README, about_PSInfisicalAPI, and cmdlet help document the stream/-ErrorAction contract, subscriber discovery, and direct-issuance setup. Adds regression tests for pipeline-stop propagation, logger stream routing, SAN splitting, common-name normalization, and the non-terminating convention across all cmdlets. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
46 lines
1.6 KiB
C#
46 lines
1.6 KiB
C#
using System;
|
|
using System.Management.Automation;
|
|
using PSInfisicalAPI.Connections;
|
|
using PSInfisicalAPI.Environments;
|
|
using PSInfisicalAPI.Models;
|
|
|
|
namespace PSInfisicalAPI.Cmdlets
|
|
{
|
|
[Cmdlet(VerbsData.Update, "InfisicalEnvironment", SupportsShouldProcess = true)]
|
|
[OutputType(typeof(InfisicalEnvironment))]
|
|
public sealed class UpdateInfisicalEnvironmentCmdlet : InfisicalCmdletBase
|
|
{
|
|
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 0)]
|
|
[Alias("Id")]
|
|
public string EnvironmentId { get; set; }
|
|
|
|
[Parameter(Mandatory = true)] public string ProjectId { get; set; }
|
|
[Parameter] public string Name { get; set; }
|
|
[Parameter] public string Slug { get; set; }
|
|
[Parameter] public int? Position { get; set; }
|
|
|
|
protected override void ProcessRecord()
|
|
{
|
|
try
|
|
{
|
|
if (!ShouldProcess(EnvironmentId, "Update Infisical environment"))
|
|
{
|
|
return;
|
|
}
|
|
|
|
InfisicalConnection connection = InfisicalSessionManager.RequireCurrent();
|
|
InfisicalEnvironmentClient client = new InfisicalEnvironmentClient(HttpClient, Logger);
|
|
InfisicalEnvironment env = client.Update(connection, ProjectId, EnvironmentId, Name, Slug, Position);
|
|
if (env != null)
|
|
{
|
|
WriteObject(env);
|
|
}
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
WriteErrorForException("UpdateInfisicalEnvironmentCmdlet", "UpdateEnvironment", exception);
|
|
}
|
|
}
|
|
}
|
|
}
|