Resource

Struct Resource 

Source
#[non_exhaustive]
pub struct Resource { pub name: String, pub display_name: String, pub type: String, pub cloud_provider: CloudProvider, pub service: String, pub location: String, pub resource_path: Option<ResourcePath>, pub resource_path_string: String, pub cloud_provider_metadata: Option<CloudProviderMetadata>, /* private fields */ }
Expand description

Information related to the Google Cloud resource.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§name: String§display_name: String

The human readable name of the resource.

§type: String

The full resource type of the resource.

§cloud_provider: CloudProvider

Indicates which cloud provider the finding is from.

§service: String

The service or resource provider associated with the resource.

§location: String

The region or location of the service (if applicable).

§resource_path: Option<ResourcePath>

Provides the path to the resource within the resource hierarchy.

§resource_path_string: String

A string representation of the resource path. For Google Cloud, it has the format of organizations/{organization_id}/folders/{folder_id}/folders/{folder_id}/projects/{project_id} where there can be any number of folders. For AWS, it has the format of org/{organization_id}/ou/{organizational_unit_id}/ou/{organizational_unit_id}/account/{account_id} where there can be any number of organizational units. For Azure, it has the format of mg/{management_group_id}/mg/{management_group_id}/subscription/{subscription_id}/rg/{resource_group_name} where there can be any number of management groups.

§cloud_provider_metadata: Option<CloudProviderMetadata>

The metadata associated with the cloud provider.

Implementations§

Source§

impl Resource

Source

pub fn new() -> Self

Source

pub fn set_name<T: Into<String>>(self, v: T) -> Self

Sets the value of name.

§Example
let x = Resource::new().set_name("example");
Source

pub fn set_display_name<T: Into<String>>(self, v: T) -> Self

Sets the value of display_name.

§Example
let x = Resource::new().set_display_name("example");
Source

pub fn set_type<T: Into<String>>(self, v: T) -> Self

Sets the value of r#type.

§Example
let x = Resource::new().set_type("example");
Source

pub fn set_cloud_provider<T: Into<CloudProvider>>(self, v: T) -> Self

Sets the value of cloud_provider.

§Example
use google_cloud_securitycenter_v2::model::CloudProvider;
let x0 = Resource::new().set_cloud_provider(CloudProvider::GoogleCloudPlatform);
let x1 = Resource::new().set_cloud_provider(CloudProvider::AmazonWebServices);
let x2 = Resource::new().set_cloud_provider(CloudProvider::MicrosoftAzure);
Source

pub fn set_service<T: Into<String>>(self, v: T) -> Self

Sets the value of service.

§Example
let x = Resource::new().set_service("example");
Source

pub fn set_location<T: Into<String>>(self, v: T) -> Self

Sets the value of location.

§Example
let x = Resource::new().set_location("example");
Source

pub fn set_resource_path<T>(self, v: T) -> Self
where T: Into<ResourcePath>,

Sets the value of resource_path.

§Example
use google_cloud_securitycenter_v2::model::ResourcePath;
let x = Resource::new().set_resource_path(ResourcePath::default()/* use setters */);
Source

pub fn set_or_clear_resource_path<T>(self, v: Option<T>) -> Self
where T: Into<ResourcePath>,

Sets or clears the value of resource_path.

§Example
use google_cloud_securitycenter_v2::model::ResourcePath;
let x = Resource::new().set_or_clear_resource_path(Some(ResourcePath::default()/* use setters */));
let x = Resource::new().set_or_clear_resource_path(None::<ResourcePath>);
Source

pub fn set_resource_path_string<T: Into<String>>(self, v: T) -> Self

Sets the value of resource_path_string.

§Example
let x = Resource::new().set_resource_path_string("example");
Source

pub fn set_cloud_provider_metadata<T: Into<Option<CloudProviderMetadata>>>( self, v: T, ) -> Self

Sets the value of cloud_provider_metadata.

Note that all the setters affecting cloud_provider_metadata are mutually exclusive.

§Example
use google_cloud_securitycenter_v2::model::GcpMetadata;
let x = Resource::new().set_cloud_provider_metadata(Some(
    google_cloud_securitycenter_v2::model::resource::CloudProviderMetadata::GcpMetadata(GcpMetadata::default().into())));
Source

pub fn gcp_metadata(&self) -> Option<&Box<GcpMetadata>>

The value of cloud_provider_metadata if it holds a GcpMetadata, None if the field is not set or holds a different branch.

Source

pub fn set_gcp_metadata<T: Into<Box<GcpMetadata>>>(self, v: T) -> Self

Sets the value of cloud_provider_metadata to hold a GcpMetadata.

Note that all the setters affecting cloud_provider_metadata are mutually exclusive.

§Example
use google_cloud_securitycenter_v2::model::GcpMetadata;
let x = Resource::new().set_gcp_metadata(GcpMetadata::default()/* use setters */);
assert!(x.gcp_metadata().is_some());
assert!(x.aws_metadata().is_none());
assert!(x.azure_metadata().is_none());
Source

pub fn aws_metadata(&self) -> Option<&Box<AwsMetadata>>

The value of cloud_provider_metadata if it holds a AwsMetadata, None if the field is not set or holds a different branch.

Source

pub fn set_aws_metadata<T: Into<Box<AwsMetadata>>>(self, v: T) -> Self

Sets the value of cloud_provider_metadata to hold a AwsMetadata.

Note that all the setters affecting cloud_provider_metadata are mutually exclusive.

§Example
use google_cloud_securitycenter_v2::model::AwsMetadata;
let x = Resource::new().set_aws_metadata(AwsMetadata::default()/* use setters */);
assert!(x.aws_metadata().is_some());
assert!(x.gcp_metadata().is_none());
assert!(x.azure_metadata().is_none());
Source

pub fn azure_metadata(&self) -> Option<&Box<AzureMetadata>>

The value of cloud_provider_metadata if it holds a AzureMetadata, None if the field is not set or holds a different branch.

Source

pub fn set_azure_metadata<T: Into<Box<AzureMetadata>>>(self, v: T) -> Self

Sets the value of cloud_provider_metadata to hold a AzureMetadata.

Note that all the setters affecting cloud_provider_metadata are mutually exclusive.

§Example
use google_cloud_securitycenter_v2::model::AzureMetadata;
let x = Resource::new().set_azure_metadata(AzureMetadata::default()/* use setters */);
assert!(x.azure_metadata().is_some());
assert!(x.gcp_metadata().is_none());
assert!(x.aws_metadata().is_none());

Trait Implementations§

Source§

impl Clone for Resource

Source§

fn clone(&self) -> Resource

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Resource

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Resource

Source§

fn default() -> Resource

Returns the “default value” for a type. Read more
Source§

impl Message for Resource

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for Resource

Source§

fn eq(&self, other: &Resource) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Resource

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,