コード例 #1
0
        public PSDataFactory CreatePSDataFactory(CreatePSDataFactoryParameters parameters)
        {
            PSDataFactory dataFactory       = null;
            Action        createDataFactory = () =>
            {
                dataFactory =
                    new PSDataFactory(
                        this.DataFactoryManagementClient.Factories.CreateOrUpdate(
                            parameters.ResourceGroupName,
                            parameters.DataFactoryName,
                            new Factory
                {
                    Location            = parameters.Location,
                    PublicNetworkAccess = parameters.PublicNetworkAccess,
                    Tags = parameters.Tags?.ToDictionary(),
                    RepoConfiguration = parameters.RepoConfiguration,
                    Identity          = parameters.FactoryIdentity,
                    Encryption        = parameters.EncryptionConfiguration,
                    GlobalParameters  = parameters.GlobalParameters
                }),
                        parameters.ResourceGroupName);
            };

            parameters.ConfirmAction(
                parameters.Force,    // prompt only if the data factory exists
                string.Format(
                    CultureInfo.InvariantCulture,
                    Resources.DataFactoryExists,
                    parameters.DataFactoryName,
                    parameters.ResourceGroupName),
                string.Format(
                    CultureInfo.InvariantCulture,
                    Resources.DataFactoryCreating,
                    parameters.DataFactoryName,
                    parameters.ResourceGroupName),
                parameters.DataFactoryName,
                createDataFactory,
                () => CheckDataFactoryExists(parameters.ResourceGroupName, parameters.DataFactoryName, out dataFactory));

            if (!DataFactoryCommonUtilities.IsSucceededProvisioningState(dataFactory.ProvisioningState))
            {
                throw new ProvisioningFailedException(Resources.DataFactoryProvisioningError);
            }

            return(dataFactory);
        }
コード例 #2
0
        public virtual PSDataFactory CreatePSDataFactory(CreatePSDataFactoryParameters parameters)
        {
            PSDataFactory dataFactory       = null;
            Action        createDataFactory = () =>
            {
                var tags = new Dictionary <string, string>();
                if (parameters.Tags != null)
                {
                    tags = parameters.Tags.ToDictionary();
                }

                dataFactory =
                    new PSDataFactory(
                        CreateOrUpdateDataFactory(parameters.ResourceGroupName, parameters.DataFactoryName,
                                                  parameters.LoggingStorageAccountName, parameters.LoggingStorageAccountKey,
                                                  parameters.Location, tags), parameters.ResourceGroupName);
            };

            parameters.ConfirmAction(
                parameters.Force,    // prompt only if the data factory exists
                string.Format(
                    CultureInfo.InvariantCulture,
                    Resources.DataFactoryExists,
                    parameters.DataFactoryName,
                    parameters.ResourceGroupName),
                string.Format(
                    CultureInfo.InvariantCulture,
                    Resources.DataFactoryCreating,
                    parameters.DataFactoryName,
                    parameters.ResourceGroupName),
                parameters.DataFactoryName,
                createDataFactory,
                () => CheckDataFactoryExists(parameters.ResourceGroupName, parameters.DataFactoryName, out dataFactory));

            if (!DataFactoryCommonUtilities.IsSucceededProvisioningState(dataFactory.ProvisioningState))
            {
                throw new ProvisioningFailedException(Resources.DataFactoryProvisioningError);
            }

            return(dataFactory);
        }