Exemplo n.º 1
0
        public override void ExecuteCmdlet()
        {
            if (ParameterSetName == ByFactoryObject)
            {
                if (DataFactory == null)
                {
                    throw new PSArgumentNullException(string.Format(CultureInfo.InvariantCulture,
                                                                    Resources.DataFactoryArgumentInvalid));
                }

                DataFactoryName   = DataFactory.DataFactoryName;
                ResourceGroupName = DataFactory.ResourceGroupName;
            }

            string encryptedValue = String.Empty;

            if (String.IsNullOrWhiteSpace(GatewayName))
            {
                // Cloud encryption without Gateway
                encryptedValue = DataFactoryClient.CloudEncryptString(Value, ResourceGroupName, DataFactoryName);
            }
            else
            {
                // On-premises encryption with Gateway
                encryptedValue = DataFactoryClient.OnPremisesEncryptString(Value, ResourceGroupName, DataFactoryName, GatewayName);
            }

            WriteObject(encryptedValue);
        }