{"action":"created","comment":{"url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/pulls/comments/105173326","pull_request_review_id":26039384,"id":105173326,"diff_hunk":"@@ -0,0 +1,111 @@\n+################################################################################\n+# (C) Copyright 2017 Hewlett Packard Enterprise Development LP\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# You may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+################################################################################\n+\n+require_relative '../image_streamer_resource'\n+\n+Puppet::Type.type(:image_streamer_artifact_bundle).provide :image_streamer, parent: Puppet::ImageStreamerResource do\n+  desc 'Provider for Image Streamer Artifact Bundles using the Image Streamer API'\n+\n+  mk_resource_methods\n+\n+  def exists?\n+    artifacts_uri_parse('buildPlans')\n+    artifacts_uri_parse('deploymentPlans')\n+    artifacts_uri_parse('goldenImages')\n+    artifacts_uri_parse('planScripts')\n+    @deployment_group_class = OneviewSDK::ImageStreamer.resource_named('DeploymentGroup', @client.api_version)\n+    super([nil, :found, :extract, :download])\n+  end\n+\n+  def create\n+    current_resource = @resourcetype.find_by(@client, unique_id).first\n+    if current_resource\n+      current_resource.update_name(@data['new_name']) if @data['new_name']\n+    elsif @data['artifact_bundle_path']\n+      @resourcetype.create_from_file(@client, @data['artifact_bundle_path'], @data['name'])\n+    else\n+      @resourcetype.new(@client, @data).create\n+    end\n+    true\n+  end\n+\n+  def extract\n+    artifact_bundle = get_single_resource_instance\n+    artifact_bundle.extract\n+    true\n+  end\n+\n+  def download\n+    path = @data.delete('artifact_bundle_download_path')\n+    validate_file(path) unless @data.delete('force')\n+    artifact_bundle = get_single_resource_instance\n+    artifact_bundle.download(path)\n+    true\n+  end\n+\n+  def get_backups\n+    backups = @resourcetype.get_backups(@client)\n+    backups.each { |item| pretty item.data }\n+    true\n+  end\n+\n+  def extract_backup\n+    @resourcetype.extract_backup(@client, get_deployment_group, 'uri' => '/archive')\n+    true\n+  end\n+\n+  def create_backup\n+    @resourcetype.create_backup(@client, get_deployment_group)\n+    true\n+  end\n+\n+  def create_backup_from_file\n+    path = @data.delete('backup_upload_path')\n+    @resourcetype.create_backup_from_file!(@client, get_deployment_group, path, File.basename(path), 21_600)\n+    true\n+  end\n+\n+  def download_backup\n+    path = @data.delete('backup_download_path')\n+    validate_file(path) unless @data.delete('force')\n+    backup = @resourcetype.get_backups(@client)\n+    @resourcetype.download_backup(@client, path, backup.first)\n+    true\n+  end\n+\n+  def get_deployment_group\n+    deployment_group_uri = @data.delete('deploymentGroupUri')\n+    raise 'The \\'deploymentGroupUri\\' field is required in data hash to run this action.' unless deployment_group_uri\n+    deployment_groups = @deployment_group_class.find_by(@client, 'uri' => deployment_group_uri)\n+    raise 'Deployment Group has not been found in the Appliance.' if deployment_groups.empty?\n+    deployment_groups.first\n+  end\n+\n+  def artifacts_uri_parse(artifacts_key)\n+    artifacts_list ||= resource['data'][artifacts_key]\n+    artifacts_list ||= @data[artifacts_key]","path":"lib/puppet/provider/image_streamer_artifact_bundle/image_streamer.rb","position":99,"original_position":99,"commit_id":"c5026be03d30663aa2fa29014c122d0d032bdef9","original_commit_id":"c5026be03d30663aa2fa29014c122d0d032bdef9","user":{"login":"marikrg","id":7041658,"avatar_url":"https://avatars1.githubusercontent.com/u/7041658?v=3","gravatar_id":"","url":"https://api.github.com/users/marikrg","html_url":"https://github.com/marikrg","followers_url":"https://api.github.com/users/marikrg/followers","following_url":"https://api.github.com/users/marikrg/following{/other_user}","gists_url":"https://api.github.com/users/marikrg/gists{/gist_id}","starred_url":"https://api.github.com/users/marikrg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marikrg/subscriptions","organizations_url":"https://api.github.com/users/marikrg/orgs","repos_url":"https://api.github.com/users/marikrg/repos","events_url":"https://api.github.com/users/marikrg/events{/privacy}","received_events_url":"https://api.github.com/users/marikrg/received_events","type":"User","site_admin":false},"body":"makes sense.","created_at":"2017-03-09T14:20:55Z","updated_at":"2017-03-09T14:20:55Z","html_url":"https://github.com/HewlettPackard/oneview-puppet/pull/124#discussion_r105173326","pull_request_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/pulls/124","_links":{"self":{"href":"https://api.github.com/repos/HewlettPackard/oneview-puppet/pulls/comments/105173326"},"html":{"href":"https://github.com/HewlettPackard/oneview-puppet/pull/124#discussion_r105173326"},"pull_request":{"href":"https://api.github.com/repos/HewlettPackard/oneview-puppet/pulls/124"}}},"pull_request":{"url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/pulls/124","id":108812853,"html_url":"https://github.com/HewlettPackard/oneview-puppet/pull/124","diff_url":"https://github.com/HewlettPackard/oneview-puppet/pull/124.diff","patch_url":"https://github.com/HewlettPackard/oneview-puppet/pull/124.patch","issue_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/issues/124","number":124,"state":"open","locked":false,"title":"Add support to the Image_streamer_artifact_bundle resource","user":{"login":"marikrg","id":7041658,"avatar_url":"https://avatars1.githubusercontent.com/u/7041658?v=3","gravatar_id":"","url":"https://api.github.com/users/marikrg","html_url":"https://github.com/marikrg","followers_url":"https://api.github.com/users/marikrg/followers","following_url":"https://api.github.com/users/marikrg/following{/other_user}","gists_url":"https://api.github.com/users/marikrg/gists{/gist_id}","starred_url":"https://api.github.com/users/marikrg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marikrg/subscriptions","organizations_url":"https://api.github.com/users/marikrg/orgs","repos_url":"https://api.github.com/users/marikrg/repos","events_url":"https://api.github.com/users/marikrg/events{/privacy}","received_events_url":"https://api.github.com/users/marikrg/received_events","type":"User","site_admin":false},"body":"### Description\r\nAdds support to the Image_streamer_artifact_bundle resource\r\n\r\n### Issues Resolved\r\n#100 \r\n\r\n### Check List\r\n- [x] New functionality includes testing.\r\n  - [x] All tests pass (`$ rake test`).\r\n- [x] New functionality has been documented in the README if applicable.\r\n  - [x] New functionality has been thoroughly documented in the examples (please include helpful comments).\r\n- [x] Changes are documented in the CHANGELOG.\r\n","created_at":"2017-03-02T17:40:27Z","updated_at":"2017-03-09T14:20:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4ef8b181d893b336a8c22e4d13c86e77b702d138","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/pulls/124/commits","review_comments_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/pulls/124/comments","review_comment_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/issues/124/comments","statuses_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/statuses/c5026be03d30663aa2fa29014c122d0d032bdef9","head":{"label":"HewlettPackard:enhancement/100-artifact-bundle","ref":"enhancement/100-artifact-bundle","sha":"c5026be03d30663aa2fa29014c122d0d032bdef9","user":{"login":"HewlettPackard","id":6004705,"avatar_url":"https://avatars3.githubusercontent.com/u/6004705?v=3","gravatar_id":"","url":"https://api.github.com/users/HewlettPackard","html_url":"https://github.com/HewlettPackard","followers_url":"https://api.github.com/users/HewlettPackard/followers","following_url":"https://api.github.com/users/HewlettPackard/following{/other_user}","gists_url":"https://api.github.com/users/HewlettPackard/gists{/gist_id}","starred_url":"https://api.github.com/users/HewlettPackard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HewlettPackard/subscriptions","organizations_url":"https://api.github.com/users/HewlettPackard/orgs","repos_url":"https://api.github.com/users/HewlettPackard/repos","events_url":"https://api.github.com/users/HewlettPackard/events{/privacy}","received_events_url":"https://api.github.com/users/HewlettPackard/received_events","type":"Organization","site_admin":false},"repo":{"id":69398956,"name":"oneview-puppet","full_name":"HewlettPackard/oneview-puppet","owner":{"login":"HewlettPackard","id":6004705,"avatar_url":"https://avatars3.githubusercontent.com/u/6004705?v=3","gravatar_id":"","url":"https://api.github.com/users/HewlettPackard","html_url":"https://github.com/HewlettPackard","followers_url":"https://api.github.com/users/HewlettPackard/followers","following_url":"https://api.github.com/users/HewlettPackard/following{/other_user}","gists_url":"https://api.github.com/users/HewlettPackard/gists{/gist_id}","starred_url":"https://api.github.com/users/HewlettPackard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HewlettPackard/subscriptions","organizations_url":"https://api.github.com/users/HewlettPackard/orgs","repos_url":"https://api.github.com/users/HewlettPackard/repos","events_url":"https://api.github.com/users/HewlettPackard/events{/privacy}","received_events_url":"https://api.github.com/users/HewlettPackard/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HewlettPackard/oneview-puppet","description":"Puppet module for managing HPE OneView resources","fork":false,"url":"https://api.github.com/repos/HewlettPackard/oneview-puppet","forks_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/forks","keys_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/teams","hooks_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/hooks","issue_events_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/issues/events{/number}","events_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/events","assignees_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/assignees{/user}","branches_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/branches{/branch}","tags_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/tags","blobs_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/git/refs{/sha}","trees_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/statuses/{sha}","languages_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/languages","stargazers_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/stargazers","contributors_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/contributors","subscribers_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/subscribers","subscription_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/subscription","commits_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/commits{/sha}","git_commits_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/git/commits{/sha}","comments_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/comments{/number}","issue_comment_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/issues/comments{/number}","contents_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/contents/{+path}","compare_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/merges","archive_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/downloads","issues_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/issues{/number}","pulls_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/pulls{/number}","milestones_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/milestones{/number}","notifications_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/labels{/name}","releases_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/releases{/id}","deployments_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/deployments","created_at":"2016-09-27T21:10:50Z","updated_at":"2017-03-06T14:32:54Z","pushed_at":"2017-03-09T12:57:33Z","git_url":"git://github.com/HewlettPackard/oneview-puppet.git","ssh_url":"git@github.com:HewlettPackard/oneview-puppet.git","clone_url":"https://github.com/HewlettPackard/oneview-puppet.git","svn_url":"https://github.com/HewlettPackard/oneview-puppet","homepage":"https://forge.puppet.com/hewlettpackard/oneview","size":11729,"stargazers_count":5,"watchers_count":5,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":16,"forks":3,"open_issues":16,"watchers":5,"default_branch":"master"}},"base":{"label":"HewlettPackard:master","ref":"master","sha":"9956db4ac95d6fc5ac858a3758f036d0849164d6","user":{"login":"HewlettPackard","id":6004705,"avatar_url":"https://avatars3.githubusercontent.com/u/6004705?v=3","gravatar_id":"","url":"https://api.github.com/users/HewlettPackard","html_url":"https://github.com/HewlettPackard","followers_url":"https://api.github.com/users/HewlettPackard/followers","following_url":"https://api.github.com/users/HewlettPackard/following{/other_user}","gists_url":"https://api.github.com/users/HewlettPackard/gists{/gist_id}","starred_url":"https://api.github.com/users/HewlettPackard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HewlettPackard/subscriptions","organizations_url":"https://api.github.com/users/HewlettPackard/orgs","repos_url":"https://api.github.com/users/HewlettPackard/repos","events_url":"https://api.github.com/users/HewlettPackard/events{/privacy}","received_events_url":"https://api.github.com/users/HewlettPackard/received_events","type":"Organization","site_admin":false},"repo":{"id":69398956,"name":"oneview-puppet","full_name":"HewlettPackard/oneview-puppet","owner":{"login":"HewlettPackard","id":6004705,"avatar_url":"https://avatars3.githubusercontent.com/u/6004705?v=3","gravatar_id":"","url":"https://api.github.com/users/HewlettPackard","html_url":"https://github.com/HewlettPackard","followers_url":"https://api.github.com/users/HewlettPackard/followers","following_url":"https://api.github.com/users/HewlettPackard/following{/other_user}","gists_url":"https://api.github.com/users/HewlettPackard/gists{/gist_id}","starred_url":"https://api.github.com/users/HewlettPackard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HewlettPackard/subscriptions","organizations_url":"https://api.github.com/users/HewlettPackard/orgs","repos_url":"https://api.github.com/users/HewlettPackard/repos","events_url":"https://api.github.com/users/HewlettPackard/events{/privacy}","received_events_url":"https://api.github.com/users/HewlettPackard/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HewlettPackard/oneview-puppet","description":"Puppet module for managing HPE OneView resources","fork":false,"url":"https://api.github.com/repos/HewlettPackard/oneview-puppet","forks_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/forks","keys_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/teams","hooks_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/hooks","issue_events_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/issues/events{/number}","events_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/events","assignees_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/assignees{/user}","branches_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/branches{/branch}","tags_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/tags","blobs_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/git/refs{/sha}","trees_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/statuses/{sha}","languages_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/languages","stargazers_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/stargazers","contributors_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/contributors","subscribers_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/subscribers","subscription_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/subscription","commits_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/commits{/sha}","git_commits_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/git/commits{/sha}","comments_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/comments{/number}","issue_comment_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/issues/comments{/number}","contents_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/contents/{+path}","compare_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/merges","archive_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/downloads","issues_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/issues{/number}","pulls_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/pulls{/number}","milestones_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/milestones{/number}","notifications_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/labels{/name}","releases_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/releases{/id}","deployments_url":"https://api.github.com/repos/HewlettPackard/oneview-puppet/deployments","created_at":"2016-09-27T21:10:50Z","updated_at":"2017-03-06T14:32:54Z","pushed_at":"2017-03-09T12:57:33Z","git_url":"git://github.com/HewlettPackard/oneview-puppet.git","ssh_url":"git@github.com:HewlettPackard/oneview-puppet.git","clone_url":"https://github.com/HewlettPackard/oneview-puppet.git","svn_url":"https://github.com/HewlettPackard/oneview-puppet","homepage":"https://forge.puppet.com/hewlettpackard/oneview","size":11729,"stargazers_count":5,"watchers_count":5,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":16,"forks":3,"open_issues":16,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/HewlettPackard/oneview-puppet/pulls/124"},"html":{"href":"https://github.com/HewlettPackard/oneview-puppet/pull/124"},"issue":{"href":"https://api.github.com/repos/HewlettPackard/oneview-puppet/issues/124"},"comments":{"href":"https://api.github.com/repos/HewlettPackard/oneview-puppet/issues/124/comments"},"review_comments":{"href":"https://api.github.com/repos/HewlettPackard/oneview-puppet/pulls/124/comments"},"review_comment":{"href":"https://api.github.com/repos/HewlettPackard/oneview-puppet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HewlettPackard/oneview-puppet/pulls/124/commits"},"statuses":{"href":"https://api.github.com/repos/HewlettPackard/oneview-puppet/statuses/c5026be03d30663aa2fa29014c122d0d032bdef9"}}}}
{"actor":{"display_login":"marikrg"}}