Skip to content

Commit fc872b1

Browse files
renovate-botbusunkim96
authored andcommitted
chore(deps): update dependency google-cloud-containeranalysis to v1 [(#4108)](GoogleCloudPlatform/python-docs-samples#4108)
1 parent 8184bb0 commit fc872b1

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

packages/google-cloud-containeranalysis/samples/snippets/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
google-cloud-pubsub==1.7.0
2-
google-cloud-containeranalysis==0.3.1
2+
google-cloud-containeranalysis==1.0.1
33
grafeas==0.4.1
44
pytest==5.3.0; python_version > "3.0"
55
pytest==4.6.6; python_version < "3.0"

packages/google-cloud-containeranalysis/samples/snippets/samples.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def delete_note(note_id, project_id):
5757

5858
client = containeranalysis_v1.ContainerAnalysisClient()
5959
grafeas_client = client.get_grafeas_client()
60-
note_name = grafeas_client.note_path(project_id, note_id)
60+
note_name = f"projects/{project_id}/notes/{note_id}"
6161

6262
grafeas_client.delete_note(note_name)
6363
# [END containeranalysis_delete_note]
@@ -77,7 +77,7 @@ def create_occurrence(resource_url, note_id, occurrence_project, note_project):
7777

7878
client = containeranalysis_v1.ContainerAnalysisClient()
7979
grafeas_client = client.get_grafeas_client()
80-
formatted_note = grafeas_client.note_path(note_project, note_id)
80+
formatted_note = f"projects/{note_project}/notes/{note_id}"
8181
formatted_project = grafeas_client.project_path(occurrence_project)
8282

8383
occurrence = {
@@ -113,7 +113,7 @@ def delete_occurrence(occurrence_id, project_id):
113113

114114
client = containeranalysis_v1.ContainerAnalysisClient()
115115
grafeas_client = client.get_grafeas_client()
116-
parent = grafeas_client.occurrence_path(project_id, occurrence_id)
116+
parent = f"projects/{project_id}/occurrences/{occurrence_id}"
117117
grafeas_client.delete_occurrence(parent)
118118
# [END containeranalysis_delete_occurrence]
119119

@@ -128,7 +128,7 @@ def get_note(note_id, project_id):
128128

129129
client = containeranalysis_v1.ContainerAnalysisClient()
130130
grafeas_client = client.get_grafeas_client()
131-
note_name = grafeas_client.note_path(project_id, note_id)
131+
note_name = f"projects/{project_id}/notes/{note_id}"
132132
response = grafeas_client.get_note(note_name)
133133
return response
134134
# [END containeranalysis_get_note]
@@ -144,7 +144,7 @@ def get_occurrence(occurrence_id, project_id):
144144

145145
client = containeranalysis_v1.ContainerAnalysisClient()
146146
grafeas_client = client.get_grafeas_client()
147-
parent = grafeas_client.occurrence_path(project_id, occurrence_id)
147+
parent = f"projects/{project_id}/occurrences/{occurrence_id}"
148148
return grafeas_client.get_occurrence(parent)
149149
# [END containeranalysis_get_occurrence]
150150

@@ -181,7 +181,7 @@ def get_occurrences_for_note(note_id, project_id):
181181

182182
client = containeranalysis_v1.ContainerAnalysisClient()
183183
grafeas_client = client.get_grafeas_client()
184-
note_name = grafeas_client.note_path(project_id, note_id)
184+
note_name = f"projects/{project_id}/notes/{note_id}"
185185

186186
response = grafeas_client.list_note_occurrences(note_name)
187187
count = 0

packages/google-cloud-containeranalysis/samples/snippets/samples_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def test_poll_discovery_occurrence(self):
209209
grafeas_client.\
210210
create_note(grafeas_client.project_path(PROJECT_ID), note_id, note)
211211
occurrence = {
212-
'note_name': grafeas_client.note_path(PROJECT_ID, note_id),
212+
'note_name': f"projects/{PROJECT_ID}/notes/{note_id}",
213213
'resource_uri': self.image_url,
214214
'discovery': {
215215
'analysis_status': DiscoveryOccurrence.AnalysisStatus
@@ -280,7 +280,7 @@ def test_find_high_severity_vulnerabilities(self):
280280
grafeas_client.\
281281
create_note(grafeas_client.project_path(PROJECT_ID), note_id, note)
282282
occurrence = {
283-
'note_name': client.note_path(PROJECT_ID, note_id),
283+
'note_name': f"projects/{PROJECT_ID}/notes/{note_id}",
284284
'resource_uri': self.image_url,
285285
'vulnerability': {
286286
'effective_severity': Severity.CRITICAL,

0 commit comments

Comments
 (0)