Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Extends support of the SDK to OneView REST API version 1600 (OneView v5.20).

#### Features supported with the current release
- Appliance SNMPv1 Trap Destinations
- Artifact Bundles
- Certificates Server
- Deployment plan
- Enclosures
Expand Down
16 changes: 16 additions & 0 deletions endpoints-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,3 +366,19 @@
|<sub> /rest/deployment-plans/{id} </sub> | DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/deployment-plans/{id}/usedby </sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/deployment-plans/{id}/osdp </sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| **Artifact Bundles**
|<sub> /rest/artifact-bundles </sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/artifact-bundles </sub> | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/artifact-bundles </sub> | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/artifact-bundles/backups </sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/artifact-bundles/backups </sub> | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/artifact-bundles/backups/archive </sub> | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/artifact-bundles/backups/archive/{id} </sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/artifact-bundles/backups/{id} </sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/artifact-bundles/backups/{id} </sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/artifact-bundles/download/{id} </sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/artifact-bundles/{id} </sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/artifact-bundles/{id} </sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/artifact-bundles/{id} </sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/artifact-bundles/{id} </sub> | DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/artifact-bundles/{id}/stopArtifactCreate </sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
130 changes: 53 additions & 77 deletions examples/image_streamer/artifact_bundles.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
###
# (C) Copyright [2019] Hewlett Packard Enterprise Development LP
# (C) Copyright [2020] Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -22,132 +22,108 @@
EXAMPLE_CONFIG_FILE = os.path.join(os.path.dirname(__file__), '../config.json')

oneview_client = OneViewClient.from_json_file(EXAMPLE_CONFIG_FILE)

image_streamer_client = oneview_client.create_image_streamer_client()
artifact_bundles = image_streamer_client.artifact_bundles

artifact_bundles_to_be_created = {
"name": "Artifact Bundles Test",
"description": "Description of Artifact Bundles Test",
"buildPlans": [
{
"resourceUri": "/rest/build-plans/3ec91dd2-0ebb-4484-8b2d-90d065114315",
"resourceUri": "/rest/build-plans/81088ef9-631d-4c5c-9de1-026afa234bc8",
"readOnly": "false"
}
]
}

artifact_bundles_deployment_group = {
"deploymentGroupURI": "/rest/deployment-groups/c5a727ef-71e9-4154-a512-6655b168c2e3"
"deploymentGroupURI": "/rest/deployment-groups/2117634b-d911-4673-98ac-1a7e19f3b40f"
}

artifact_bundle_file_path = {
"download": "~/artifact_bundle.zip",
"download_archive": "~/archive.zip",
"name_upload": "artifact_bundle",
"upload": "~/artifact_bundle.zip",
"upload_backup": "~/backup.zip"
"download": "./artifact_bundle.zip",
"download_archive": "./archive.zip",
"upload": "./artifact_bundle.zip",
"upload_backup": "./archive.zip"
}

artifact_bundle_new_name = "Artifact Bundles Test Updated"

# Create an Artifact Bundle
print("\nCreate an Artifact Bundle")
response = image_streamer_client.artifact_bundles.create(artifact_bundles_to_be_created)
pprint(response)


# Get all Artifacts Bundle
print("\nGet all Artifact Bundles")
artifact_bundles = image_streamer_client.artifact_bundles.get_all()
for artifacts_bundle in artifact_bundles:
pprint(artifacts_bundle)

all_artifact_bundles = artifact_bundles.get_all()
for artifacts_bundle in all_artifact_bundles:
print(" - {}".format(artifacts_bundle['name']))

# Get the Artifacts Bundle by Name
print("\nGet Artifact Bundles by Name")
artifact_bundle = image_streamer_client.artifact_bundles.get_by_name(artifact_bundles_to_be_created['name'])
pprint(artifact_bundle)
artifact_bundle = artifact_bundles.get_by_name(artifact_bundles_to_be_created['name'])

if artifact_bundle:
print("Found artifact bundle with name- {} and uri- {}".format(artifact_bundle.data['name'], artifact_bundle.data['uri']))
else:
# Create an Artifact Bundle
print("\nCreate an Artifact Bundle")
artifact_bundle = artifact_bundles.create(artifact_bundles_to_be_created)
print("Created artifact bundle with name- {} and uri- {}".format(artifact_bundle.data['name'], artifact_bundle.data['uri']))

# Get the Artifacts Bundle
print("\nGet the Artifact Bundle")
response = image_streamer_client.artifact_bundles.get(artifact_bundle['uri'])
pprint(response)

# Get the Artifacts Bundle by uri
print("\nGet the Artifact Bundle by uri")
ab_by_uri = artifact_bundles.get_by_uri(artifact_bundle.data['uri'])
print(ab_by_uri.data)

# Download the Artifact Bundle
print("\nDownload the Artifact Bundle")
response = image_streamer_client.artifact_bundles.download_artifact_bundle(
artifact_bundle['uri'], artifact_bundle_file_path['download'])
pprint(response)


# Download the Archive of the Artifact Bundle
print("\nDownload the Archive of the Artifact Bundle")
response = image_streamer_client.artifact_bundles\
.download_archive_artifact_bundle(artifact_bundle['uri'], artifact_bundle_file_path['download_archive'])
pprint(response)
response = artifact_bundle.download(artifact_bundle_file_path['download'])
print(response)

# Update name of an Artifact Bundle
print("\nUpdate an Artifact Bundle")
data_to_update = {'name': artifact_bundle_new_name}
artifact_bundle.update(data=data_to_update)
pprint(artifact_bundle.data)

# Extract an Artifact Bundle
print("\nExtract an Artifact Bundle")
response = image_streamer_client.artifact_bundles.extract_bundle(artifact_bundle)
pprint(response)


# Update an Artifact Bundle
print("\nUpdate an Artifact Bundle")
artifact_bundle = image_streamer_client.artifact_bundles.get_by_name(artifact_bundles_to_be_created['name'])
artifact_bundle['name'] = artifact_bundle_new_name
response = image_streamer_client.artifact_bundles.update(artifact_bundle)
response = artifact_bundle.extract()
pprint(response)


# Delete an Artifact Bundle
print("\nDelete an Artifact Bundle")
artifact_bundle = image_streamer_client.artifact_bundles.get_by_name(artifact_bundle_new_name)
image_streamer_client.artifact_bundles.delete(artifact_bundle)


# Create a Backup for the Artifact Bundle
print("\nCreate a Backup for Artifact Bundle")
response = image_streamer_client.artifact_bundles.create_backup(artifact_bundles_deployment_group)
pprint(response)
artifact_bundle.delete()

# Create a Backup for all the Artifact Bundle
print("\nCreate a Backup for all Artifact Bundles")
ab_backup = artifact_bundles.create_backup(artifact_bundles_deployment_group)
print(ab_backup.data)

# Get all Backups Bundles
print("\nGet all Backups Bundles")
backups_artifacts_bundle = image_streamer_client.artifact_bundles.get_all_backups()
pprint(backups_artifacts_bundle)

backup_artifact_bundles = artifact_bundles.get_all_backups()
for backup in backup_artifact_bundles:
print(" - {}".format(backup['name']))

# Get Backup Bundle
print("\nGet Backup Bundle")
artifacts_bundle = image_streamer_client.artifact_bundles.get_backup(backups_artifacts_bundle[0]['uri'])
pprint(artifacts_bundle)
ab_bkp = artifact_bundles.get_backup(backup_artifact_bundles[0]['uri'])
pprint(ab_bkp.data)

# Extract an Artifact Bundle from backup
print("\nExtract an Artifact Bundle from Backup")
response = ab_bkp.extract_backup(artifact_bundles_deployment_group)
pprint(response)

# Download the backup archive of the Artifact Bundle
print("\nDownload the backup archive of the Artifact Bundle")
response = ab_bkp.download_archive(artifact_bundle_file_path['download_archive'])
print(response)

# Upload an Artifact Bundle from file
print("\nUpload an Artifact Bundle from file")
response = image_streamer_client.artifact_bundles.upload_bundle_from_file(artifact_bundle_file_path['upload'])
response = artifact_bundles.upload_bundle_from_file(artifact_bundle_file_path['upload'])
pprint(response)


# Upload a Backup of Artifact Bundle from file
print("\nUpload a Backup of Artifact Bundle from file")
response = image_streamer_client.artifact_bundles\
.upload_backup_bundle_from_file(artifact_bundle_file_path['upload_backup'],
artifact_bundles_deployment_group['deploymentGroupURI'])
pprint(response)


# Extract an Artifact Bundle
print("\nExtract an Artifact Bundle from Backup")
response = image_streamer_client.artifact_bundles.extract_backup_bundle(artifact_bundles_deployment_group)
pprint(response)


# Delete the Artifact Bundle created from file
print("\nDelete the Artifact Bundle created from file")
artifact_bundle = image_streamer_client.artifact_bundles.get_by_name(artifact_bundle_file_path['name_upload'])
image_streamer_client.artifact_bundles.delete(artifact_bundle)
res = artifact_bundles.upload_backup_bundle_from_file(artifact_bundle_file_path['upload_backup'], artifact_bundles_deployment_group['deploymentGroupURI'])
pprint(res)
6 changes: 2 additions & 4 deletions hpOneView/image_streamer/image_streamer_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
###
# (C) Copyright [2019] Hewlett Packard Enterprise Development LP
# (C) Copyright [2020] Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -125,9 +125,7 @@ def artifact_bundles(self):
Returns:
ArtifactBundles:
"""
if not self.__artifact_bundles:
self.__artifact_bundles = ArtifactBundles(self.__connection)
return self.__artifact_bundles
return ArtifactBundles(self.__connection)

@property
def deployment_groups(self):
Expand Down
Loading