getPolicy method
A policy specifies the attestors that must attest to a container image, before the project is allowed to deploy that image.
There is at most one policy per project. All image admission requests are permitted if a project has no policy. Gets the policy for this project. Returns a default policy if the project does not have one.
Request parameters:
name
- Required. The resource name of the policy to retrieve, in the
format projects / * /policy
.
Value must have pattern ^projects/\[^/\]+/policy$
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a Policy.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<Policy> getPolicy(
core.String name, {
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/' + core.Uri.encodeFull('$name');
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return Policy.fromJson(response_ as core.Map<core.String, core.dynamic>);
}