protected override void BeginProcessing()
        {
            base.BeginProcessing();

            var commitCommandFactory =
                new CommitApiCommandFactory(
                    new ApiUriFactory(Connection.Host),
                    new CommitApiPostKeyValuePairFactory(this.Connection.AccessToken));

            commitCommand = commitCommandFactory.CreateCommit(true);

            activeDirectoryRepository = new ActiveDirectoryRepository(ForestName, Credential);

            addressGroupSearchableRepository = new SearchableRepository <AddressGroupObject>(
                new ConfigCommandFactory(
                    new ApiUriFactory(Connection.Host),
                    new ConfigPostKeyValuePairFactory(Connection.AccessToken, Connection.Vsys)),
                Schema.AddressGroupSchemaName);

            addressSearchableRepository = new SearchableRepository <AddressObject>(
                new ConfigCommandFactory(
                    new ApiUriFactory(Connection.Host),
                    new ConfigPostKeyValuePairFactory(Connection.AccessToken, Connection.Vsys)),
                Schema.AddressSchemaName);

            addableRepository = new AddableRepository(
                new ConfigCommandFactory(
                    new ApiUriFactory(Connection.Host),
                    new ConfigPostKeyValuePairFactory(Connection.AccessToken, Connection.Vsys)));

            membershipRepository = new MembershipRepository(
                new ConfigMembershipCommandFactory(
                    new ApiUriFactory(Connection.Host),
                    new ConfigMembershipPostKeyValuePairFactory(Connection.AccessToken, Connection.Vsys)));
        }
Beispiel #2
0
        protected override void ProcessRecord()
        {
            ICommitCommandFactory commitCommandFactory =
                new CommitApiCommandFactory(new ApiUriFactory(this.Connection.Host), new CommitApiPostKeyValuePairFactory(this.Connection.AccessToken));
            var command = commitCommandFactory.CreateCommit(true);

            try
            {
                var commitResponse = command.Execute();
                WriteObject(commitResponse);
            }
            catch (ResponseFailure ex)
            {
                ThrowTerminatingError(new ErrorRecord(ex, ex.Data[ResponseFailure.MessageFiled].ToString(), ErrorCategory.InvalidArgument, null));
            }
        }