protected async Task ShowDomainAccountInformation(string helpUrl, RotationContext context, SecretReference domainAccountSecret, string domainAccountName) { var passwordReference = new SecretReference { Name = domainAccountSecret.Name, Location = domainAccountSecret.Location }; var password = await context.GetSecretValue(passwordReference); Console.WriteLine($"Please login to {helpUrl} using account {domainAccountName} and password: {password}"); }
protected override void ProcessRecord() { SecretReference[] secretReferences; switch (this.ParameterSetName) { case ParameterSetNames.SingleSecretReference: secretReferences = new SecretReference[] { new SecretReference() { Name = this.Name, Version = this.Version == null ? string.Empty : this.Version } }; break; case ParameterSetNames.SecretReferenceObjects: secretReferences = this.SecretReference; break; default: throw new InvalidPowerShellStateException(string.Format("Invalid parameter set name '{0}'.", this.ParameterSetName)); } var clusterConnection = this.GetClusterConnection(); try { var result = clusterConnection.GetSecretsAsync( secretReferences, this.IncludeValue, this.GetTimeout(), this.GetCancellationToken()).Result; this.WriteObject(result); } catch (AggregateException aggregateException) { aggregateException.Handle((ae) => { this.ThrowTerminatingError( ae, "GetSecretsErrorId", clusterConnection); return(true); }); } catch (Exception ex) { this.ThrowTerminatingError( ex, "GetSecretsErrorId", clusterConnection); } }
private NativeCommon.IFabricAsyncOperationContext RemoveSecretsAsyncBegin( SecretReference[] secretReferences, TimeSpan timeout, NativeCommon.IFabricAsyncOperationCallback callback) { using (var pin = new PinCollection()) { return(this.nativeClient.BeginRemoveSecrets( SecretReference.ToNativeArray(pin, secretReferences), Utility.ToMilliseconds(timeout, "timeout"), callback)); } }
protected async Task ShowGitHubLoginInformation(RotationContext context, SecretReference gitHubSecret, string helpUrl, string gitHubAccountName) { var passwordReference = new SecretReference { Name = gitHubSecret.Name + GitHubPasswordSuffix, Location = gitHubSecret.Location }; var secretReference = new SecretReference { Name = gitHubSecret.Name + GitHubSecretSuffix, Location = gitHubSecret.Location }; var password = await context.GetSecretValue(passwordReference); var secret = await context.GetSecretValue(secretReference); await ShowGitHubLoginInformation(helpUrl, gitHubAccountName, password, secret); }
private NativeCommon.IFabricAsyncOperationContext GetSecretsAsyncBegin( SecretReference[] secretReferences, bool includeValue, TimeSpan timeout, NativeCommon.IFabricAsyncOperationCallback callback) { using (var pin = new PinCollection()) { return(this.nativeClient.BeginGetSecrets( SecretReference.ToNativeArray(pin, secretReferences), NativeTypes.ToBOOLEAN(includeValue), Utility.ToMilliseconds(timeout, "timeout"), callback)); } }
private SecretReference[] RemoveSecretsAsyncEnd(NativeCommon.IFabricAsyncOperationContext context) { var result = this.nativeClient.EndRemoveSecrets(context); return(SecretReference.FromNativeArray(result.get_SecretReferences())); }