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

Commit

Permalink
Merge pull request #6 from grimblenz/blueprint_fix
Browse files Browse the repository at this point in the history
Adding requestScopeOrg to update and create
  • Loading branch information
grimblenz authored Feb 7, 2020
2 parents e1284c5 + f54fe37 commit ba68890
Showing 1 changed file with 5 additions and 41 deletions.
46 changes: 5 additions & 41 deletions caspyr/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def create(cls,
bp_name,
description,
version,
request_scope_org,
content
):
"""Creates a blueprint from a valid YAML input.
Expand Down Expand Up @@ -136,6 +137,7 @@ def create(cls,
'description': description,
'tags': [],
'content': content,
'requestScopeOrg': request_scope_org,
'version': version
}
i = session._request(f'{session.baseurl}{uri}',
Expand All @@ -153,6 +155,7 @@ def update(cls,
bp_name,
description,
version,
request_scope_org,
content
):
"""Updates a blueprint from a valid YAML input.
Expand Down Expand Up @@ -186,6 +189,7 @@ def update(cls,
'description': description,
'tags': [],
'content': content,
'requestScopeOrg': request_scope_org,
'version': version
}
i = session._request(f'{session.baseurl}{uri}',
Expand Down Expand Up @@ -370,44 +374,4 @@ def versions(cls,
uri = f'/blueprint/api/blueprints/{blueprint_id}/versions'

return session._request(f'{session.baseurl}{uri}',
request_method='GET')['content']

@classmethod
def release(cls, session, blueprint_id, version):
"""Releases a version of the blueprint to the catalog
:param session: The session object.
:type session: object
:param blueprint_id: The id of the blueprint that you want the details
of.
:type blueprint_id: string
:param version: the new version of the blueprint.
:type version: string
:return: Returns the HTTP status code.
:rtype: int
"""

uri = f'/blueprint/api/blueprints/{blueprint_id}/versions/{version}/actions/release'

return session._request(f'{session.baseurl}{uri}',
request_method='POST')

@classmethod
def unrelease(cls, session, blueprint_id, version):
"""Unreleases a version of the blueprint from the catalog.
:param session: The session object.
:type session: object
:param blueprint_id: The id of the blueprint that you want the details
of.
:type blueprint_id: string
:param version: the new version of the blueprint.
:type version: string
:return: Returns the HTTP status code.
:rtype: int
"""

uri = f'/blueprint/api/blueprints/{blueprint_id}/versions/{version}/actions/unrelease'

return session._request(f'{session.baseurl}{uri}',
request_method='POST')
request_method='GET')['content']

0 comments on commit ba68890

Please sign in to comment.