コード例 #1
0
        public override void ExecuteCmdlet()
        {
            var parameters = new CreatePSDataFactoryParameters()
            {
                ResourceGroupName = ResourceGroupName,
                DataFactoryName   = Name,
                Location          = Location,
                Tags          = Tag,
                Force         = Force.IsPresent,
                ConfirmAction = ConfirmAction
            };

            WriteObject(DataFactoryClient.CreatePSDataFactory(parameters));
        }
コード例 #2
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);
        }
コード例 #3
0
        public override void ExecuteCmdlet()
        {
            this.ValidateParameters();

            FactoryRepoConfiguration repoConfiguration = null;

            if (!string.IsNullOrWhiteSpace(this.ProjectName) || !string.IsNullOrWhiteSpace(this.TenantId))
            {
                var factoryVSTSConfiguration = new FactoryVSTSConfiguration();
                factoryVSTSConfiguration.ProjectName = this.ProjectName;
                factoryVSTSConfiguration.TenantId    = this.TenantId;

                repoConfiguration = factoryVSTSConfiguration;
            }
            else if (!string.IsNullOrWhiteSpace(this.HostName))
            {
                var factoryGitHubConfiguration = new FactoryGitHubConfiguration();
                factoryGitHubConfiguration.HostName = this.HostName;

                repoConfiguration = factoryGitHubConfiguration;
            }

            if (repoConfiguration != null)
            {
                repoConfiguration.CollaborationBranch = this.CollaborationBranch;
                repoConfiguration.AccountName         = this.AccountName;
                repoConfiguration.LastCommitId        = this.LastCommitId;
                repoConfiguration.RootFolder          = this.RootFolder;
                repoConfiguration.RepositoryName      = this.RepositoryName;
            }

            var parameters = new CreatePSDataFactoryParameters()
            {
                ResourceGroupName = ResourceGroupName,
                DataFactoryName   = Name,
                Location          = Location,
                Tags              = Tag,
                Force             = Force.IsPresent,
                RepoConfiguration = repoConfiguration,
                ConfirmAction     = ConfirmAction,
                GlobalParameters  = GlobalParameterDefinition
            };

            WriteObject(DataFactoryClient.CreatePSDataFactory(parameters));
        }
コード例 #4
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);
        }
コード例 #5
0
        public override void ExecuteCmdlet()
        {
            this.ValidateParameters();

            FactoryRepoConfiguration repoConfiguration = null;

            if (!string.IsNullOrWhiteSpace(this.ProjectName) || !string.IsNullOrWhiteSpace(this.TenantId))
            {
                var factoryVSTSConfiguration = new FactoryVSTSConfiguration();
                factoryVSTSConfiguration.ProjectName = this.ProjectName;
                factoryVSTSConfiguration.TenantId    = this.TenantId;

                repoConfiguration = factoryVSTSConfiguration;
            }
            else if (!string.IsNullOrWhiteSpace(this.HostName))
            {
                var factoryGitHubConfiguration = new FactoryGitHubConfiguration();
                factoryGitHubConfiguration.HostName = this.HostName;

                repoConfiguration = factoryGitHubConfiguration;
            }

            if (repoConfiguration != null)
            {
                repoConfiguration.CollaborationBranch = this.CollaborationBranch;
                repoConfiguration.AccountName         = this.AccountName;
                repoConfiguration.LastCommitId        = this.LastCommitId;
                repoConfiguration.RootFolder          = this.RootFolder;
                repoConfiguration.RepositoryName      = this.RepositoryName;
            }

            string factoryIdentityType = FactoryIdentityType.SystemAssigned;

            if (!string.IsNullOrWhiteSpace(this.IdentityType))
            {
                factoryIdentityType = this.IdentityType;
            }

            if (this.UserAssignedIdentity != null && this.UserAssignedIdentity.Count > 0)
            {
                if (!factoryIdentityType.ToLower().Contains(FactoryIdentityType.UserAssigned.ToLower()))
                {
                    factoryIdentityType = FactoryIdentityType.SystemAssignedUserAssigned;
                }
            }
            FactoryIdentity factoryIdentity = new FactoryIdentity(factoryIdentityType, userAssignedIdentities: this.UserAssignedIdentity);

            EncryptionConfiguration encryption = null;

            if (!string.IsNullOrWhiteSpace(this.EncryptionVaultBaseUrl) && !string.IsNullOrWhiteSpace(this.EncryptionKeyName))
            {
                CMKIdentityDefinition cmkIdentity = null;
                if (!string.IsNullOrWhiteSpace(this.EncryptionUserAssignedIdentity))
                {
                    cmkIdentity = new CMKIdentityDefinition(this.EncryptionUserAssignedIdentity);
                }
                encryption = new EncryptionConfiguration(this.EncryptionKeyName, this.EncryptionVaultBaseUrl, this.EncryptionKeyVersion, cmkIdentity);
            }

            string publicNetworkAccess = Management.DataFactory.Models.PublicNetworkAccess.Enabled;

            if (!string.IsNullOrWhiteSpace(this.PublicNetworkAccess))
            {
                publicNetworkAccess = this.PublicNetworkAccess;
            }

            var parameters = new CreatePSDataFactoryParameters()
            {
                ResourceGroupName       = ResourceGroupName,
                DataFactoryName         = Name,
                Location                = Location,
                PublicNetworkAccess     = publicNetworkAccess,
                EncryptionConfiguration = encryption,
                FactoryIdentity         = factoryIdentity,
                Tags              = Tag,
                Force             = Force.IsPresent,
                RepoConfiguration = repoConfiguration,
                ConfirmAction     = ConfirmAction,
                GlobalParameters  = GlobalParameterDefinition
            };

            WriteObject(DataFactoryClient.CreatePSDataFactory(parameters));
        }