Struct google_api_proto::google::cloud::osconfig::v1::os_policy::resource::ExecResource
source · pub struct ExecResource {
pub validate: Option<Exec>,
pub enforce: Option<Exec>,
}
Expand description
A resource that allows executing scripts on the VM.
The ExecResource
has 2 stages: validate
and enforce
and both stages
accept a script as an argument to execute.
When the ExecResource
is applied by the agent, it first executes the
script in the validate
stage. The validate
stage can signal that the
ExecResource
is already in the desired state by returning an exit code
of 100
. If the ExecResource
is not in the desired state, it should
return an exit code of 101
. Any other exit code returned by this stage
is considered an error.
If the ExecResource
is not in the desired state based on the exit code
from the validate
stage, the agent proceeds to execute the script from
the enforce
stage. If the ExecResource
is already in the desired
state, the enforce
stage will not be run.
Similar to validate
stage, the enforce
stage should return an exit
code of 100
to indicate that the resource in now in its desired state.
Any other exit code is considered an error.
NOTE: An exit code of 100
was chosen over 0
(and 101
vs 1
) to
have an explicit indicator of in desired state
, not in desired state
and errors. Because, for example, Powershell will always return an exit
code of 0
unless an exit
statement is provided in the script. So, for
reasons of consistency and being explicit, exit codes 100
and 101
were chosen.
Fields§
§validate: Option<Exec>
Required. What to run to validate this resource is in the desired state. An exit code of 100 indicates “in desired state”, and exit code of 101 indicates “not in desired state”. Any other exit code indicates a failure running validate.
enforce: Option<Exec>
What to run to bring this resource into the desired state. An exit code of 100 indicates “success”, any other exit code indicates a failure running enforce.
Trait Implementations§
source§impl Clone for ExecResource
impl Clone for ExecResource
source§fn clone(&self) -> ExecResource
fn clone(&self) -> ExecResource
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ExecResource
impl Debug for ExecResource
source§impl Default for ExecResource
impl Default for ExecResource
source§impl Message for ExecResource
impl Message for ExecResource
source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
. Read moresource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
.source§impl PartialEq for ExecResource
impl PartialEq for ExecResource
source§fn eq(&self, other: &ExecResource) -> bool
fn eq(&self, other: &ExecResource) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for ExecResource
Auto Trait Implementations§
impl Freeze for ExecResource
impl RefUnwindSafe for ExecResource
impl Send for ExecResource
impl Sync for ExecResource
impl Unpin for ExecResource
impl UnwindSafe for ExecResource
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request