diff options
Diffstat (limited to 'python-cloudcomponents-cdk-codecommit-backup.spec')
-rw-r--r-- | python-cloudcomponents-cdk-codecommit-backup.spec | 361 |
1 files changed, 361 insertions, 0 deletions
diff --git a/python-cloudcomponents-cdk-codecommit-backup.spec b/python-cloudcomponents-cdk-codecommit-backup.spec new file mode 100644 index 0000000..3a9f100 --- /dev/null +++ b/python-cloudcomponents-cdk-codecommit-backup.spec @@ -0,0 +1,361 @@ +%global _empty_manifest_terminate_build 0 +Name: python-cloudcomponents.cdk-codecommit-backup +Version: 2.0.0 +Release: 1 +Summary: Backup CodeCommit repositories to S3 +License: MIT +URL: https://github.com/cloudcomponents/cdk-constructs +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/c7/a7/4082a694deb5fb2e4e95426a7d0a36709c45992270cf4a9901a1260ee058/cloudcomponents.cdk-codecommit-backup-2.0.0.tar.gz +BuildArch: noarch + +Requires: python3-aws-cdk-lib +Requires: python3-constructs +Requires: python3-jsii +Requires: python3-publication + +%description +[](https://github.com/cloudcomponents/cdk-constructs) + +# @cloudcomponents/cdk-codecommit-backup + +[](https://github.com/cloudcomponents/cdk-constructs/actions?query=workflow=Build) +[](https://github.com/hupe1980/cdkdx) +[](https://www.npmjs.com/package/@cloudcomponents/cdk-codecommit-backup) +[](https://pypi.org/project/cloudcomponents.cdk-codecommit-backup/) +[](https://github.com/kolomied/awesome-cdk) + +> Backup CodeCommit repositories to S3 + +## Install + +TypeScript/JavaScript: + +```bash +npm i @cloudcomponents/cdk-codecommit-backup +``` + +Python: + +```bash +pip install cloudcomponents.cdk-codecommit-backup +``` + +## How to use + +```python +import { BackupBucket, S3CodeCommitBackup } from '@cloudcomponents/cdk-codecommit-backup'; +import { Duration, Stack, StackProps } from 'aws-cdk-lib'; +import { Repository } from 'aws-cdk-lib/aws-codecommit'; +import { Schedule } from 'aws-cdk-lib/aws-events'; +import { SnsTopic } from 'aws-cdk-lib/aws-events-targets'; +import { Topic } from 'aws-cdk-lib/aws-sns'; +import { EmailSubscription } from 'aws-cdk-lib/aws-sns-subscriptions'; +import { Construct } from 'constructs'; + +export class CodeCommitBackupStack extends Stack { + constructor(scope: Construct, id: string, props?: StackProps) { + super(scope, id, props); + + if (typeof process.env.REPOSITORY_NAME === 'undefined') { + throw new Error('environment variable REPOSITORY_NAME undefined'); + } + const repository = Repository.fromRepositoryName(this, 'Repository', process.env.REPOSITORY_NAME); + + const backupBucket = new BackupBucket(this, 'BackupBuckt', { + retentionPeriod: Duration.days(90), + }); + + // The following example runs a task every day at 4am + const backup = new S3CodeCommitBackup(this, 'S3CodeCommitBackup', { + backupBucket, + repository, + schedule: Schedule.cron({ + minute: '0', + hour: '4', + }), + }); + + const backupTopic = new Topic(this, 'BackupTopic'); + + if (process.env.DEVSECOPS_TEAM_EMAIL) { + backupTopic.addSubscription(new EmailSubscription(process.env.DEVSECOPS_TEAM_EMAIL)); + } + + backup.onBackupStarted('started', { + target: new SnsTopic(backupTopic), + }); + + backup.onBackupSucceeded('succeeded', { + target: new SnsTopic(backupTopic), + }); + + backup.onBackupFailed('failed', { + target: new SnsTopic(backupTopic), + }); + } +} +``` + +## API Reference + +See [API.md](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-codecommit-backup/API.md). + +## Example + +See more complete [examples](https://github.com/cloudcomponents/cdk-constructs/tree/master/examples). + +## License + +[MIT](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-codecommit-backup/LICENSE) + + + + +%package -n python3-cloudcomponents.cdk-codecommit-backup +Summary: Backup CodeCommit repositories to S3 +Provides: python-cloudcomponents.cdk-codecommit-backup +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-cloudcomponents.cdk-codecommit-backup +[](https://github.com/cloudcomponents/cdk-constructs) + +# @cloudcomponents/cdk-codecommit-backup + +[](https://github.com/cloudcomponents/cdk-constructs/actions?query=workflow=Build) +[](https://github.com/hupe1980/cdkdx) +[](https://www.npmjs.com/package/@cloudcomponents/cdk-codecommit-backup) +[](https://pypi.org/project/cloudcomponents.cdk-codecommit-backup/) +[](https://github.com/kolomied/awesome-cdk) + +> Backup CodeCommit repositories to S3 + +## Install + +TypeScript/JavaScript: + +```bash +npm i @cloudcomponents/cdk-codecommit-backup +``` + +Python: + +```bash +pip install cloudcomponents.cdk-codecommit-backup +``` + +## How to use + +```python +import { BackupBucket, S3CodeCommitBackup } from '@cloudcomponents/cdk-codecommit-backup'; +import { Duration, Stack, StackProps } from 'aws-cdk-lib'; +import { Repository } from 'aws-cdk-lib/aws-codecommit'; +import { Schedule } from 'aws-cdk-lib/aws-events'; +import { SnsTopic } from 'aws-cdk-lib/aws-events-targets'; +import { Topic } from 'aws-cdk-lib/aws-sns'; +import { EmailSubscription } from 'aws-cdk-lib/aws-sns-subscriptions'; +import { Construct } from 'constructs'; + +export class CodeCommitBackupStack extends Stack { + constructor(scope: Construct, id: string, props?: StackProps) { + super(scope, id, props); + + if (typeof process.env.REPOSITORY_NAME === 'undefined') { + throw new Error('environment variable REPOSITORY_NAME undefined'); + } + const repository = Repository.fromRepositoryName(this, 'Repository', process.env.REPOSITORY_NAME); + + const backupBucket = new BackupBucket(this, 'BackupBuckt', { + retentionPeriod: Duration.days(90), + }); + + // The following example runs a task every day at 4am + const backup = new S3CodeCommitBackup(this, 'S3CodeCommitBackup', { + backupBucket, + repository, + schedule: Schedule.cron({ + minute: '0', + hour: '4', + }), + }); + + const backupTopic = new Topic(this, 'BackupTopic'); + + if (process.env.DEVSECOPS_TEAM_EMAIL) { + backupTopic.addSubscription(new EmailSubscription(process.env.DEVSECOPS_TEAM_EMAIL)); + } + + backup.onBackupStarted('started', { + target: new SnsTopic(backupTopic), + }); + + backup.onBackupSucceeded('succeeded', { + target: new SnsTopic(backupTopic), + }); + + backup.onBackupFailed('failed', { + target: new SnsTopic(backupTopic), + }); + } +} +``` + +## API Reference + +See [API.md](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-codecommit-backup/API.md). + +## Example + +See more complete [examples](https://github.com/cloudcomponents/cdk-constructs/tree/master/examples). + +## License + +[MIT](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-codecommit-backup/LICENSE) + + + + +%package help +Summary: Development documents and examples for cloudcomponents.cdk-codecommit-backup +Provides: python3-cloudcomponents.cdk-codecommit-backup-doc +%description help +[](https://github.com/cloudcomponents/cdk-constructs) + +# @cloudcomponents/cdk-codecommit-backup + +[](https://github.com/cloudcomponents/cdk-constructs/actions?query=workflow=Build) +[](https://github.com/hupe1980/cdkdx) +[](https://www.npmjs.com/package/@cloudcomponents/cdk-codecommit-backup) +[](https://pypi.org/project/cloudcomponents.cdk-codecommit-backup/) +[](https://github.com/kolomied/awesome-cdk) + +> Backup CodeCommit repositories to S3 + +## Install + +TypeScript/JavaScript: + +```bash +npm i @cloudcomponents/cdk-codecommit-backup +``` + +Python: + +```bash +pip install cloudcomponents.cdk-codecommit-backup +``` + +## How to use + +```python +import { BackupBucket, S3CodeCommitBackup } from '@cloudcomponents/cdk-codecommit-backup'; +import { Duration, Stack, StackProps } from 'aws-cdk-lib'; +import { Repository } from 'aws-cdk-lib/aws-codecommit'; +import { Schedule } from 'aws-cdk-lib/aws-events'; +import { SnsTopic } from 'aws-cdk-lib/aws-events-targets'; +import { Topic } from 'aws-cdk-lib/aws-sns'; +import { EmailSubscription } from 'aws-cdk-lib/aws-sns-subscriptions'; +import { Construct } from 'constructs'; + +export class CodeCommitBackupStack extends Stack { + constructor(scope: Construct, id: string, props?: StackProps) { + super(scope, id, props); + + if (typeof process.env.REPOSITORY_NAME === 'undefined') { + throw new Error('environment variable REPOSITORY_NAME undefined'); + } + const repository = Repository.fromRepositoryName(this, 'Repository', process.env.REPOSITORY_NAME); + + const backupBucket = new BackupBucket(this, 'BackupBuckt', { + retentionPeriod: Duration.days(90), + }); + + // The following example runs a task every day at 4am + const backup = new S3CodeCommitBackup(this, 'S3CodeCommitBackup', { + backupBucket, + repository, + schedule: Schedule.cron({ + minute: '0', + hour: '4', + }), + }); + + const backupTopic = new Topic(this, 'BackupTopic'); + + if (process.env.DEVSECOPS_TEAM_EMAIL) { + backupTopic.addSubscription(new EmailSubscription(process.env.DEVSECOPS_TEAM_EMAIL)); + } + + backup.onBackupStarted('started', { + target: new SnsTopic(backupTopic), + }); + + backup.onBackupSucceeded('succeeded', { + target: new SnsTopic(backupTopic), + }); + + backup.onBackupFailed('failed', { + target: new SnsTopic(backupTopic), + }); + } +} +``` + +## API Reference + +See [API.md](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-codecommit-backup/API.md). + +## Example + +See more complete [examples](https://github.com/cloudcomponents/cdk-constructs/tree/master/examples). + +## License + +[MIT](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-codecommit-backup/LICENSE) + + + + +%prep +%autosetup -n cloudcomponents.cdk-codecommit-backup-2.0.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-cloudcomponents.cdk-codecommit-backup -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 2.0.0-1 +- Package Spec generated |