%global _empty_manifest_terminate_build 0
Name:		python-pylertalertmanager
Version:	0.1.1
Release:	1
Summary:	Library to ease interaction with Alert Manager API.
License:	MIT
URL:		https://github.com/ABORGT/PylertAlertManager.git
Source0:	https://mirrors.nju.edu.cn/pypi/web/packages/a5/7e/6d6ebc7d42764cc27c30bc5701738fa511fe7bcbc078b2d82e45b1463cac/pylertalertmanager-0.1.1.tar.gz
BuildArch:	noarch

Requires:	python3-maya
Requires:	python3-box
Requires:	python3-requests

%description

# PylertAlertManager

PylertAlertManager aims to be an easy-to-use interface for interacting with the Alert Manager API.


### Getting Started

The latest stable release is available from PyPI:

```
pip install pylertalertmanager
```

Otherwise you can install from git:

```
pip install git+https://github.com/ABORGT/PylertAlertManager.git
```

### Usage
Here we cover some basic usage examples to get folks off and running. We are importing json here just to pretty print our objects. Additionally, we have an Alert Manager instance running in docker to target.
```python
>>> import json
>>> from alertmanager import AlertManager
>>> from alertmanager import Alert
>>>
>>> # Provide some test data to be converted into an Alert object.
>>> test_data = {
...     "labels": {
...         "alertname": "TestAlert",
...         "instance": "TestInstance",
...         "severity": "critical"
...     },
...     "annotations": {
...         "description": "This is a test alert",
...         "info": "Test Alert",
...         "summary": "A simple Test alert"
...     }
... }
>>># Run the from_dict method on our test_data.
>>> test_alert = Alert.from_dict(test_data)
>>> type(test_alert)
<class 'alertmanager.alertmanager.Alert'>
>>>
>>> # Add an annotation with the add_annotation method.
>>> test_alert.add_annotation('test_annotation', 'this is a test annotation')
>>> print(json.dumps(test_alert, indent=4))
{
    "labels": {
        "alertname": "TestAlert",
        "instance": "TestInstance",
        "severity": "critical"
    },
    "annotations": {
        "description": "This is a test alert",
        "info": "Test Alert",
        "summary": "A simple Test alert",
        "test_annotation": "this is a test annotation"
    }
}
>>> # Add a label with the add_label method.
>>> test_alert.add_label('test_label', 'this is a test label')
>>> print(json.dumps(test_alert, indent=4))
{
    "labels": {
        "alertname": "TestAlert",
        "instance": "TestInstance",
        "severity": "critical",
        "test_label": "this is a test label"
    },
    "annotations": {
        "description": "This is a test alert",
        "info": "Test Alert",
        "summary": "A simple Test alert",
        "test_annotation": "this is a test annotation"
    }
}
>>> # Specify an Alert Manager host to connect to.
>>> host = 'http://127.0.0.1'
>>> a_manager = AlertManager(host=host)
>>>
>>> # Post an alert to our Alert Manager.
>>> a_manager.post_alerts(test_alert)
<Box: {'status': 'success'}>
>>> # Return a list of alerts from our Alert Manager.
>>> alerts = a_manager.get_alerts()
>>> print(json.dumps(alerts, indent=4))
[
    {
        "labels": {
            "alertname": "TestAlert",
            "instance": "TestInstance",
            "severity": "critical",
            "test_label": "this is a test label"
        },
        "annotations": {
            "description": "This is a test alert",
            "info": "Test Alert",
            "summary": "A simple Test alert",
            "test_annotation": "this is a test annotation"
        },
        "startsAt": "2018-11-08T16:25:02.327027475Z",
        "endsAt": "2018-11-08T16:30:02.327027475Z",
        "generatorURL": "",
        "status": {
            "state": "unprocessed",
            "silencedBy": [],
            "inhibitedBy": []
        },
        "receivers": [
            "team-X-mails"
        ],
        "fingerprint": "e6b119b9ce57e0c4"
    }
]
```
## Running the tests

TODO: Add tests

## Contributing
1. Fork it.
2. Create a branch describing either the issue or feature you're working.
3. Making changes, committing along the way.
4. Follow PEP8, except where ridiculous.
5. Include tests for any functionality changes.
6. Push the changes and create a pull request :D.

## Built With

* [Python3](https://www.python.org/downloads/) - Beautiful language.

## Authors

* **Tyler Coil** - [Other Projects](https://github.com/kamori)
* **Justin Palmer** - [Other Projects](https://github.com/jpavlav)

## Acknowledgments

* Kenneth Reitz -> [setup](https://github.com/kennethreitz/setup.py) - Thanks!




%package -n python3-pylertalertmanager
Summary:	Library to ease interaction with Alert Manager API.
Provides:	python-pylertalertmanager
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-pylertalertmanager

# PylertAlertManager

PylertAlertManager aims to be an easy-to-use interface for interacting with the Alert Manager API.


### Getting Started

The latest stable release is available from PyPI:

```
pip install pylertalertmanager
```

Otherwise you can install from git:

```
pip install git+https://github.com/ABORGT/PylertAlertManager.git
```

### Usage
Here we cover some basic usage examples to get folks off and running. We are importing json here just to pretty print our objects. Additionally, we have an Alert Manager instance running in docker to target.
```python
>>> import json
>>> from alertmanager import AlertManager
>>> from alertmanager import Alert
>>>
>>> # Provide some test data to be converted into an Alert object.
>>> test_data = {
...     "labels": {
...         "alertname": "TestAlert",
...         "instance": "TestInstance",
...         "severity": "critical"
...     },
...     "annotations": {
...         "description": "This is a test alert",
...         "info": "Test Alert",
...         "summary": "A simple Test alert"
...     }
... }
>>># Run the from_dict method on our test_data.
>>> test_alert = Alert.from_dict(test_data)
>>> type(test_alert)
<class 'alertmanager.alertmanager.Alert'>
>>>
>>> # Add an annotation with the add_annotation method.
>>> test_alert.add_annotation('test_annotation', 'this is a test annotation')
>>> print(json.dumps(test_alert, indent=4))
{
    "labels": {
        "alertname": "TestAlert",
        "instance": "TestInstance",
        "severity": "critical"
    },
    "annotations": {
        "description": "This is a test alert",
        "info": "Test Alert",
        "summary": "A simple Test alert",
        "test_annotation": "this is a test annotation"
    }
}
>>> # Add a label with the add_label method.
>>> test_alert.add_label('test_label', 'this is a test label')
>>> print(json.dumps(test_alert, indent=4))
{
    "labels": {
        "alertname": "TestAlert",
        "instance": "TestInstance",
        "severity": "critical",
        "test_label": "this is a test label"
    },
    "annotations": {
        "description": "This is a test alert",
        "info": "Test Alert",
        "summary": "A simple Test alert",
        "test_annotation": "this is a test annotation"
    }
}
>>> # Specify an Alert Manager host to connect to.
>>> host = 'http://127.0.0.1'
>>> a_manager = AlertManager(host=host)
>>>
>>> # Post an alert to our Alert Manager.
>>> a_manager.post_alerts(test_alert)
<Box: {'status': 'success'}>
>>> # Return a list of alerts from our Alert Manager.
>>> alerts = a_manager.get_alerts()
>>> print(json.dumps(alerts, indent=4))
[
    {
        "labels": {
            "alertname": "TestAlert",
            "instance": "TestInstance",
            "severity": "critical",
            "test_label": "this is a test label"
        },
        "annotations": {
            "description": "This is a test alert",
            "info": "Test Alert",
            "summary": "A simple Test alert",
            "test_annotation": "this is a test annotation"
        },
        "startsAt": "2018-11-08T16:25:02.327027475Z",
        "endsAt": "2018-11-08T16:30:02.327027475Z",
        "generatorURL": "",
        "status": {
            "state": "unprocessed",
            "silencedBy": [],
            "inhibitedBy": []
        },
        "receivers": [
            "team-X-mails"
        ],
        "fingerprint": "e6b119b9ce57e0c4"
    }
]
```
## Running the tests

TODO: Add tests

## Contributing
1. Fork it.
2. Create a branch describing either the issue or feature you're working.
3. Making changes, committing along the way.
4. Follow PEP8, except where ridiculous.
5. Include tests for any functionality changes.
6. Push the changes and create a pull request :D.

## Built With

* [Python3](https://www.python.org/downloads/) - Beautiful language.

## Authors

* **Tyler Coil** - [Other Projects](https://github.com/kamori)
* **Justin Palmer** - [Other Projects](https://github.com/jpavlav)

## Acknowledgments

* Kenneth Reitz -> [setup](https://github.com/kennethreitz/setup.py) - Thanks!




%package help
Summary:	Development documents and examples for pylertalertmanager
Provides:	python3-pylertalertmanager-doc
%description help

# PylertAlertManager

PylertAlertManager aims to be an easy-to-use interface for interacting with the Alert Manager API.


### Getting Started

The latest stable release is available from PyPI:

```
pip install pylertalertmanager
```

Otherwise you can install from git:

```
pip install git+https://github.com/ABORGT/PylertAlertManager.git
```

### Usage
Here we cover some basic usage examples to get folks off and running. We are importing json here just to pretty print our objects. Additionally, we have an Alert Manager instance running in docker to target.
```python
>>> import json
>>> from alertmanager import AlertManager
>>> from alertmanager import Alert
>>>
>>> # Provide some test data to be converted into an Alert object.
>>> test_data = {
...     "labels": {
...         "alertname": "TestAlert",
...         "instance": "TestInstance",
...         "severity": "critical"
...     },
...     "annotations": {
...         "description": "This is a test alert",
...         "info": "Test Alert",
...         "summary": "A simple Test alert"
...     }
... }
>>># Run the from_dict method on our test_data.
>>> test_alert = Alert.from_dict(test_data)
>>> type(test_alert)
<class 'alertmanager.alertmanager.Alert'>
>>>
>>> # Add an annotation with the add_annotation method.
>>> test_alert.add_annotation('test_annotation', 'this is a test annotation')
>>> print(json.dumps(test_alert, indent=4))
{
    "labels": {
        "alertname": "TestAlert",
        "instance": "TestInstance",
        "severity": "critical"
    },
    "annotations": {
        "description": "This is a test alert",
        "info": "Test Alert",
        "summary": "A simple Test alert",
        "test_annotation": "this is a test annotation"
    }
}
>>> # Add a label with the add_label method.
>>> test_alert.add_label('test_label', 'this is a test label')
>>> print(json.dumps(test_alert, indent=4))
{
    "labels": {
        "alertname": "TestAlert",
        "instance": "TestInstance",
        "severity": "critical",
        "test_label": "this is a test label"
    },
    "annotations": {
        "description": "This is a test alert",
        "info": "Test Alert",
        "summary": "A simple Test alert",
        "test_annotation": "this is a test annotation"
    }
}
>>> # Specify an Alert Manager host to connect to.
>>> host = 'http://127.0.0.1'
>>> a_manager = AlertManager(host=host)
>>>
>>> # Post an alert to our Alert Manager.
>>> a_manager.post_alerts(test_alert)
<Box: {'status': 'success'}>
>>> # Return a list of alerts from our Alert Manager.
>>> alerts = a_manager.get_alerts()
>>> print(json.dumps(alerts, indent=4))
[
    {
        "labels": {
            "alertname": "TestAlert",
            "instance": "TestInstance",
            "severity": "critical",
            "test_label": "this is a test label"
        },
        "annotations": {
            "description": "This is a test alert",
            "info": "Test Alert",
            "summary": "A simple Test alert",
            "test_annotation": "this is a test annotation"
        },
        "startsAt": "2018-11-08T16:25:02.327027475Z",
        "endsAt": "2018-11-08T16:30:02.327027475Z",
        "generatorURL": "",
        "status": {
            "state": "unprocessed",
            "silencedBy": [],
            "inhibitedBy": []
        },
        "receivers": [
            "team-X-mails"
        ],
        "fingerprint": "e6b119b9ce57e0c4"
    }
]
```
## Running the tests

TODO: Add tests

## Contributing
1. Fork it.
2. Create a branch describing either the issue or feature you're working.
3. Making changes, committing along the way.
4. Follow PEP8, except where ridiculous.
5. Include tests for any functionality changes.
6. Push the changes and create a pull request :D.

## Built With

* [Python3](https://www.python.org/downloads/) - Beautiful language.

## Authors

* **Tyler Coil** - [Other Projects](https://github.com/kamori)
* **Justin Palmer** - [Other Projects](https://github.com/jpavlav)

## Acknowledgments

* Kenneth Reitz -> [setup](https://github.com/kennethreitz/setup.py) - Thanks!




%prep
%autosetup -n pylertalertmanager-0.1.1

%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-pylertalertmanager -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Tue May 30 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.1-1
- Package Spec generated