diff --git a/container_registry/container_analysis/requirements.txt b/container_registry/container_analysis/requirements.txt index 42cc1dc3d812..ece5188c628b 100644 --- a/container_registry/container_analysis/requirements.txt +++ b/container_registry/container_analysis/requirements.txt @@ -1,5 +1,5 @@ google-cloud-pubsub==1.7.0 -google-cloud-containeranalysis==0.3.1 +google-cloud-containeranalysis==1.0.1 grafeas==0.4.1 pytest==5.3.0; python_version > "3.0" pytest==4.6.6; python_version < "3.0" diff --git a/container_registry/container_analysis/samples.py b/container_registry/container_analysis/samples.py index c663e4dac013..7d1348cf2e52 100644 --- a/container_registry/container_analysis/samples.py +++ b/container_registry/container_analysis/samples.py @@ -57,7 +57,7 @@ def delete_note(note_id, project_id): client = containeranalysis_v1.ContainerAnalysisClient() grafeas_client = client.get_grafeas_client() - note_name = grafeas_client.note_path(project_id, note_id) + note_name = f"projects/{project_id}/notes/{note_id}" grafeas_client.delete_note(note_name) # [END containeranalysis_delete_note] @@ -77,7 +77,7 @@ def create_occurrence(resource_url, note_id, occurrence_project, note_project): client = containeranalysis_v1.ContainerAnalysisClient() grafeas_client = client.get_grafeas_client() - formatted_note = grafeas_client.note_path(note_project, note_id) + formatted_note = f"projects/{note_project}/notes/{note_id}" formatted_project = grafeas_client.project_path(occurrence_project) occurrence = { @@ -113,7 +113,7 @@ def delete_occurrence(occurrence_id, project_id): client = containeranalysis_v1.ContainerAnalysisClient() grafeas_client = client.get_grafeas_client() - parent = grafeas_client.occurrence_path(project_id, occurrence_id) + parent = f"projects/{project_id}/occurrences/{occurrence_id}" grafeas_client.delete_occurrence(parent) # [END containeranalysis_delete_occurrence] @@ -128,7 +128,7 @@ def get_note(note_id, project_id): client = containeranalysis_v1.ContainerAnalysisClient() grafeas_client = client.get_grafeas_client() - note_name = grafeas_client.note_path(project_id, note_id) + note_name = f"projects/{project_id}/notes/{note_id}" response = grafeas_client.get_note(note_name) return response # [END containeranalysis_get_note] @@ -144,7 +144,7 @@ def get_occurrence(occurrence_id, project_id): client = containeranalysis_v1.ContainerAnalysisClient() grafeas_client = client.get_grafeas_client() - parent = grafeas_client.occurrence_path(project_id, occurrence_id) + parent = f"projects/{project_id}/occurrences/{occurrence_id}" return grafeas_client.get_occurrence(parent) # [END containeranalysis_get_occurrence] @@ -181,7 +181,7 @@ def get_occurrences_for_note(note_id, project_id): client = containeranalysis_v1.ContainerAnalysisClient() grafeas_client = client.get_grafeas_client() - note_name = grafeas_client.note_path(project_id, note_id) + note_name = f"projects/{project_id}/notes/{note_id}" response = grafeas_client.list_note_occurrences(note_name) count = 0 diff --git a/container_registry/container_analysis/samples_test.py b/container_registry/container_analysis/samples_test.py index faab9b1d09ba..56ac9ab7e2b9 100644 --- a/container_registry/container_analysis/samples_test.py +++ b/container_registry/container_analysis/samples_test.py @@ -209,7 +209,7 @@ def test_poll_discovery_occurrence(self): grafeas_client.\ create_note(grafeas_client.project_path(PROJECT_ID), note_id, note) occurrence = { - 'note_name': grafeas_client.note_path(PROJECT_ID, note_id), + 'note_name': f"projects/{PROJECT_ID}/notes/{note_id}", 'resource_uri': self.image_url, 'discovery': { 'analysis_status': DiscoveryOccurrence.AnalysisStatus @@ -280,7 +280,7 @@ def test_find_high_severity_vulnerabilities(self): grafeas_client.\ create_note(grafeas_client.project_path(PROJECT_ID), note_id, note) occurrence = { - 'note_name': client.note_path(PROJECT_ID, note_id), + 'note_name': f"projects/{PROJECT_ID}/notes/{note_id}", 'resource_uri': self.image_url, 'vulnerability': { 'effective_severity': Severity.CRITICAL,