public override void ExecuteCmdlet() { ByFactoryObject(); // ValidationNotNullOrEmpty doesn't handle whitespaces well if (IntegrationRuntimeName.IsEmptyOrWhiteSpace()) { throw new PSArgumentNullException("IntegrationRuntimeName"); } string rawJsonContent = DataFactoryClient.ReadJsonFileContent(this.TryResolvePath(DefinitionFile)); string encrypted = null; ConfirmAction( Force.IsPresent, string.Format( CultureInfo.InvariantCulture, Resources.EncryptConfirm), string.Format( CultureInfo.InvariantCulture, Resources.Encrypting), DefinitionFile, () => { encrypted = DataFactoryClient.IntegrationRuntimeEncryptCredential(ResourceGroupName, DataFactoryName, IntegrationRuntimeName, rawJsonContent); }); WriteObject(encrypted); }
public override void ExecuteCmdlet() { if (Host.Version < supportedPSVersion) { throw new PSNotSupportedException($"PowerShell {supportedPSVersion} or higher is required"); } if (this.IsParameterBound(c => c.WorkspaceObject)) { this.ResourceGroupName = new ResourceIdentifier(this.WorkspaceObject.Id).ResourceGroupName; this.WorkspaceName = this.WorkspaceObject.Name; } // ValidationNotNullOrEmpty doesn't handle whitespaces well if (IntegrationRuntimeName.IsEmptyOrWhiteSpace()) { throw new PSArgumentNullException("IntegrationRuntimeName"); } string rawJsonContent = SynapseAnalyticsClient.ReadJsonFileContent(this.TryResolvePath(DefinitionFile)); string encrypted = null; ConfirmAction( Force.IsPresent, string.Format( CultureInfo.InvariantCulture, Resources.EncryptConfirm), string.Format( CultureInfo.InvariantCulture, Resources.Encrypting), DefinitionFile, () => { encrypted = SynapseAnalyticsClient.IntegrationRuntimeEncryptCredential(ResourceGroupName, WorkspaceName, IntegrationRuntimeName, rawJsonContent); }); WriteObject(encrypted); }