Skip to content

Commit 3aa565f

Browse files
Google APIscopybara-github
authored andcommitted
feat: v2 version for GetComment and GetAttachment
PiperOrigin-RevId: 915218100
1 parent 631b473 commit 3aa565f

3 files changed

Lines changed: 101 additions & 4 deletions

File tree

google/cloud/support/v2/attachment_service.proto

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,44 @@ service CaseAttachmentService {
4747
};
4848
option (google.api.method_signature) = "parent";
4949
}
50+
51+
// Retrieve an attachment associated with a support case.
52+
//
53+
// EXAMPLES:
54+
//
55+
// cURL:
56+
//
57+
// ```shell
58+
// attachment="projects/some-project/cases/23598314/attachments/0684M00000P3h1fQAB"
59+
// curl \
60+
// --header "Authorization: Bearer $(gcloud auth print-access-token)" \
61+
// "https://cloudsupport.googleapis.com/v2/$attachment"
62+
// ```
63+
//
64+
// Python:
65+
//
66+
// ```python
67+
// import googleapiclient.discovery
68+
//
69+
// api_version = "v2"
70+
// supportApiService = googleapiclient.discovery.build(
71+
// serviceName="cloudsupport",
72+
// version=api_version,
73+
// discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version={api_version}",
74+
// )
75+
// request = (
76+
// supportApiService.cases()
77+
// .attachments()
78+
// .get(name="projects/some-project/cases/43595344/attachments/0684M00000P3h1fQAB")
79+
// )
80+
// print(request.execute())
81+
// ```
82+
rpc GetAttachment(GetAttachmentRequest) returns (Attachment) {
83+
option (google.api.http) = {
84+
get: "/v2/{name=*/*/cases/*/attachments/*}"
85+
};
86+
option (google.api.method_signature) = "name";
87+
}
5088
}
5189

5290
// The request message for the ListAttachments endpoint.
@@ -74,6 +112,17 @@ message ListAttachmentsRequest {
74112
string page_token = 3;
75113
}
76114

115+
// Request for getting an attachment.
116+
message GetAttachmentRequest {
117+
// Required. The name of the attachment to get.
118+
string name = 1 [
119+
(google.api.field_behavior) = REQUIRED,
120+
(google.api.resource_reference) = {
121+
type: "cloudsupport.googleapis.com/Attachment"
122+
}
123+
];
124+
}
125+
77126
// The response message for the ListAttachments endpoint.
78127
message ListAttachmentsResponse {
79128
// The list of attachments associated with a case.

google/cloud/support/v2/cloudsupport_v2.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ documentation:
1515
1616
authentication:
1717
rules:
18-
- selector: google.cloud.support.v2.CaseAttachmentService.ListAttachments
18+
- selector: google.cloud.support.v2.CaseAttachmentService.GetAttachment
1919
oauth:
2020
canonical_scopes: |-
2121
https://www.googleapis.com/auth/cloud-platform
22-
- selector: 'google.cloud.support.v2.CaseService.*'
22+
- selector: google.cloud.support.v2.CaseAttachmentService.ListAttachments
2323
oauth:
2424
canonical_scopes: |-
2525
https://www.googleapis.com/auth/cloud-platform
26-
- selector: google.cloud.support.v2.CommentService.CreateComment
26+
- selector: 'google.cloud.support.v2.CaseService.*'
2727
oauth:
2828
canonical_scopes: |-
2929
https://www.googleapis.com/auth/cloud-platform
30-
- selector: google.cloud.support.v2.CommentService.ListComments
30+
- selector: 'google.cloud.support.v2.CommentService.*'
3131
oauth:
3232
canonical_scopes: |-
3333
https://www.googleapis.com/auth/cloud-platform

google/cloud/support/v2/comment_service.proto

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,43 @@ service CommentService {
6161
};
6262
option (google.api.method_signature) = "parent,comment";
6363
}
64+
65+
// Retrieve a comment.
66+
//
67+
// EXAMPLES:
68+
//
69+
// cURL:
70+
//
71+
// ```shell
72+
// comment="projects/some-project/cases/43595344/comments/234567890"
73+
// curl \
74+
// --header "Authorization: Bearer $(gcloud auth print-access-token)" \
75+
// "https://cloudsupport.googleapis.com/v2/$comment"
76+
// ```
77+
//
78+
// Python:
79+
//
80+
// ```python
81+
// import googleapiclient.discovery
82+
//
83+
// api_version = "v2"
84+
// supportApiService = googleapiclient.discovery.build(
85+
// serviceName="cloudsupport",
86+
// version=api_version,
87+
// discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version={api_version}",
88+
// )
89+
//
90+
// request = supportApiService.cases().comments().get(
91+
// name="projects/some-project/cases/43595344/comments/234567890",
92+
// )
93+
// print(request.execute())
94+
// ```
95+
rpc GetComment(GetCommentRequest) returns (Comment) {
96+
option (google.api.http) = {
97+
get: "/v2/{name=*/*/cases/*/comments/*}"
98+
};
99+
option (google.api.method_signature) = "name";
100+
}
64101
}
65102

66103
// The request message for the ListComments endpoint.
@@ -105,3 +142,14 @@ message CreateCommentRequest {
105142
// Required. The comment to be added.
106143
Comment comment = 2 [(google.api.field_behavior) = REQUIRED];
107144
}
145+
146+
// The request message for the GetComment endpoint.
147+
message GetCommentRequest {
148+
// Required. The name of the comment to retrieve.
149+
string name = 1 [
150+
(google.api.field_behavior) = REQUIRED,
151+
(google.api.resource_reference) = {
152+
type: "cloudsupport.googleapis.com/Comment"
153+
}
154+
];
155+
}

0 commit comments

Comments
 (0)