Skip to content
This repository was archived by the owner on Mar 15, 2021. It is now read-only.

Commit

Permalink
adding catalog source removal code
Browse files Browse the repository at this point in the history
  • Loading branch information
codyde committed Sep 11, 2019
1 parent ecab73f commit 694a0b7
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion caspyr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
from .iaas import Machine, Network
from .datacollector import DataCollector
from .extensibility import Subscription,Action
from .integration import Source,Integration
from .integration import Source,Integration,CatalogSource
35 changes: 35 additions & 0 deletions caspyr/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,38 @@ def delete(session,id):
request_method='DELETE'
)

class CatalogSource:
def __init__(self, source):
self.name = source['name']
self.id = source['name']

@staticmethod
def list(session):
"""Retrieves list of all integration source within a
Organization
:param session: The session object.
:type session: object
:return: A list of sources.
:rtype: list
"""
uri = '/catalog/api/admin/sources/'
j = session._request(f'{session.baseurl}{uri}')
return j['content']

@staticmethod
def delete(session,id):
"""Deletes source based on a supplied id.
:param session: The session object.
:type session: object
:param id: The ID of an integration source
:type id: string
:return: Success/Failure.
:rtype: status code
"""
uri = f'/catalog/api/admin/sources/{id}'
return session._request(f'{session.baseurl}{uri}',
request_method='DELETE'
)

Binary file added examples/.DS_Store
Binary file not shown.

0 comments on commit 694a0b7

Please sign in to comment.