create method
- AuditSchedule request,
- String parent, {
- String? auditScheduleId,
- bool? validateOnly,
- String? $fields,
Creates a new audit schedule in a given project and location.
request - The metadata request object.
Request parameters:
parent - Required. Project or folder that this audit schedule is for, in
one of the following formats: * projects/{project}/locations/{location}
folders/{folder}/locations/{location}Value must have pattern^projects/\[^/\]+/locations/\[^/\]+$.
auditScheduleId - Required. ID to use for the audit schedule, which
becomes the final component of the audit schedule's resource name.
validateOnly - Optional. If true, only validates the request and does
not create the audit schedule. This executes standard request validation
(such as schema, framework existence, scope, and IAM checks) and skips the
apply phase. Use this field for the following purposes: * Infrastructure
as Code (IaC): Allow tools like Terraform to run dry-run mutations
(e.g., terraform plan) without creating real resources or incurring
costs. * User Interface Validation: Enable real-time form and
permission validation in custom UIs before submitting requests. * CI/CD
& Automation: Test your scripts, permissions, and parameters safely
without consuming resource quotas.
$fields - Selector specifying which fields to include in a partial
response.
Completes with a AuditSchedule.
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<AuditSchedule> create(
AuditSchedule request,
core.String parent, {
core.String? auditScheduleId,
core.bool? validateOnly,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'auditScheduleId': ?auditScheduleId == null ? null : [auditScheduleId],
'validateOnly': ?validateOnly == null ? null : ['${validateOnly}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'v1/' + core.Uri.encodeFull('$parent') + '/auditSchedules';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return AuditSchedule.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}