aws_sdk_verifiedpermissions/operation/get_policy/_get_policy_output.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct GetPolicyOutput {
/// <p>The ID of the policy store that contains the policy that you want information about.</p>
pub policy_store_id: ::std::string::String,
/// <p>The unique ID of the policy that you want information about.</p>
pub policy_id: ::std::string::String,
/// <p>The type of the policy.</p>
pub policy_type: crate::types::PolicyType,
/// <p>The principal specified in the policy's scope. This element isn't included in the response when <code>Principal</code> isn't present in the policy content.</p>
pub principal: ::std::option::Option<crate::types::EntityIdentifier>,
/// <p>The resource specified in the policy's scope. This element isn't included in the response when <code>Resource</code> isn't present in the policy content.</p>
pub resource: ::std::option::Option<crate::types::EntityIdentifier>,
/// <p>The action that a policy permits or forbids. For example, <code>{"actions": \[{"actionId": "ViewPhoto", "actionType": "PhotoFlash::Action"}, {"entityID": "SharePhoto", "entityType": "PhotoFlash::Action"}\]}</code>.</p>
pub actions: ::std::option::Option<::std::vec::Vec<crate::types::ActionIdentifier>>,
/// <p>The definition of the requested policy.</p>
pub definition: ::std::option::Option<crate::types::PolicyDefinitionDetail>,
/// <p>The date and time that the policy was originally created.</p>
pub created_date: ::aws_smithy_types::DateTime,
/// <p>The date and time that the policy was last updated.</p>
pub last_updated_date: ::aws_smithy_types::DateTime,
/// <p>The effect of the decision that a policy returns to an authorization request. For example, <code>"effect": "Permit"</code>.</p>
pub effect: ::std::option::Option<crate::types::PolicyEffect>,
_request_id: Option<String>,
}
impl GetPolicyOutput {
/// <p>The ID of the policy store that contains the policy that you want information about.</p>
pub fn policy_store_id(&self) -> &str {
use std::ops::Deref;
self.policy_store_id.deref()
}
/// <p>The unique ID of the policy that you want information about.</p>
pub fn policy_id(&self) -> &str {
use std::ops::Deref;
self.policy_id.deref()
}
/// <p>The type of the policy.</p>
pub fn policy_type(&self) -> &crate::types::PolicyType {
&self.policy_type
}
/// <p>The principal specified in the policy's scope. This element isn't included in the response when <code>Principal</code> isn't present in the policy content.</p>
pub fn principal(&self) -> ::std::option::Option<&crate::types::EntityIdentifier> {
self.principal.as_ref()
}
/// <p>The resource specified in the policy's scope. This element isn't included in the response when <code>Resource</code> isn't present in the policy content.</p>
pub fn resource(&self) -> ::std::option::Option<&crate::types::EntityIdentifier> {
self.resource.as_ref()
}
/// <p>The action that a policy permits or forbids. For example, <code>{"actions": \[{"actionId": "ViewPhoto", "actionType": "PhotoFlash::Action"}, {"entityID": "SharePhoto", "entityType": "PhotoFlash::Action"}\]}</code>.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.actions.is_none()`.
pub fn actions(&self) -> &[crate::types::ActionIdentifier] {
self.actions.as_deref().unwrap_or_default()
}
/// <p>The definition of the requested policy.</p>
pub fn definition(&self) -> ::std::option::Option<&crate::types::PolicyDefinitionDetail> {
self.definition.as_ref()
}
/// <p>The date and time that the policy was originally created.</p>
pub fn created_date(&self) -> &::aws_smithy_types::DateTime {
&self.created_date
}
/// <p>The date and time that the policy was last updated.</p>
pub fn last_updated_date(&self) -> &::aws_smithy_types::DateTime {
&self.last_updated_date
}
/// <p>The effect of the decision that a policy returns to an authorization request. For example, <code>"effect": "Permit"</code>.</p>
pub fn effect(&self) -> ::std::option::Option<&crate::types::PolicyEffect> {
self.effect.as_ref()
}
}
impl ::aws_types::request_id::RequestId for GetPolicyOutput {
fn request_id(&self) -> Option<&str> {
self._request_id.as_deref()
}
}
impl GetPolicyOutput {
/// Creates a new builder-style object to manufacture [`GetPolicyOutput`](crate::operation::get_policy::GetPolicyOutput).
pub fn builder() -> crate::operation::get_policy::builders::GetPolicyOutputBuilder {
crate::operation::get_policy::builders::GetPolicyOutputBuilder::default()
}
}
/// A builder for [`GetPolicyOutput`](crate::operation::get_policy::GetPolicyOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct GetPolicyOutputBuilder {
pub(crate) policy_store_id: ::std::option::Option<::std::string::String>,
pub(crate) policy_id: ::std::option::Option<::std::string::String>,
pub(crate) policy_type: ::std::option::Option<crate::types::PolicyType>,
pub(crate) principal: ::std::option::Option<crate::types::EntityIdentifier>,
pub(crate) resource: ::std::option::Option<crate::types::EntityIdentifier>,
pub(crate) actions: ::std::option::Option<::std::vec::Vec<crate::types::ActionIdentifier>>,
pub(crate) definition: ::std::option::Option<crate::types::PolicyDefinitionDetail>,
pub(crate) created_date: ::std::option::Option<::aws_smithy_types::DateTime>,
pub(crate) last_updated_date: ::std::option::Option<::aws_smithy_types::DateTime>,
pub(crate) effect: ::std::option::Option<crate::types::PolicyEffect>,
_request_id: Option<String>,
}
impl GetPolicyOutputBuilder {
/// <p>The ID of the policy store that contains the policy that you want information about.</p>
/// This field is required.
pub fn policy_store_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.policy_store_id = ::std::option::Option::Some(input.into());
self
}
/// <p>The ID of the policy store that contains the policy that you want information about.</p>
pub fn set_policy_store_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.policy_store_id = input;
self
}
/// <p>The ID of the policy store that contains the policy that you want information about.</p>
pub fn get_policy_store_id(&self) -> &::std::option::Option<::std::string::String> {
&self.policy_store_id
}
/// <p>The unique ID of the policy that you want information about.</p>
/// This field is required.
pub fn policy_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.policy_id = ::std::option::Option::Some(input.into());
self
}
/// <p>The unique ID of the policy that you want information about.</p>
pub fn set_policy_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.policy_id = input;
self
}
/// <p>The unique ID of the policy that you want information about.</p>
pub fn get_policy_id(&self) -> &::std::option::Option<::std::string::String> {
&self.policy_id
}
/// <p>The type of the policy.</p>
/// This field is required.
pub fn policy_type(mut self, input: crate::types::PolicyType) -> Self {
self.policy_type = ::std::option::Option::Some(input);
self
}
/// <p>The type of the policy.</p>
pub fn set_policy_type(mut self, input: ::std::option::Option<crate::types::PolicyType>) -> Self {
self.policy_type = input;
self
}
/// <p>The type of the policy.</p>
pub fn get_policy_type(&self) -> &::std::option::Option<crate::types::PolicyType> {
&self.policy_type
}
/// <p>The principal specified in the policy's scope. This element isn't included in the response when <code>Principal</code> isn't present in the policy content.</p>
pub fn principal(mut self, input: crate::types::EntityIdentifier) -> Self {
self.principal = ::std::option::Option::Some(input);
self
}
/// <p>The principal specified in the policy's scope. This element isn't included in the response when <code>Principal</code> isn't present in the policy content.</p>
pub fn set_principal(mut self, input: ::std::option::Option<crate::types::EntityIdentifier>) -> Self {
self.principal = input;
self
}
/// <p>The principal specified in the policy's scope. This element isn't included in the response when <code>Principal</code> isn't present in the policy content.</p>
pub fn get_principal(&self) -> &::std::option::Option<crate::types::EntityIdentifier> {
&self.principal
}
/// <p>The resource specified in the policy's scope. This element isn't included in the response when <code>Resource</code> isn't present in the policy content.</p>
pub fn resource(mut self, input: crate::types::EntityIdentifier) -> Self {
self.resource = ::std::option::Option::Some(input);
self
}
/// <p>The resource specified in the policy's scope. This element isn't included in the response when <code>Resource</code> isn't present in the policy content.</p>
pub fn set_resource(mut self, input: ::std::option::Option<crate::types::EntityIdentifier>) -> Self {
self.resource = input;
self
}
/// <p>The resource specified in the policy's scope. This element isn't included in the response when <code>Resource</code> isn't present in the policy content.</p>
pub fn get_resource(&self) -> &::std::option::Option<crate::types::EntityIdentifier> {
&self.resource
}
/// Appends an item to `actions`.
///
/// To override the contents of this collection use [`set_actions`](Self::set_actions).
///
/// <p>The action that a policy permits or forbids. For example, <code>{"actions": \[{"actionId": "ViewPhoto", "actionType": "PhotoFlash::Action"}, {"entityID": "SharePhoto", "entityType": "PhotoFlash::Action"}\]}</code>.</p>
pub fn actions(mut self, input: crate::types::ActionIdentifier) -> Self {
let mut v = self.actions.unwrap_or_default();
v.push(input);
self.actions = ::std::option::Option::Some(v);
self
}
/// <p>The action that a policy permits or forbids. For example, <code>{"actions": \[{"actionId": "ViewPhoto", "actionType": "PhotoFlash::Action"}, {"entityID": "SharePhoto", "entityType": "PhotoFlash::Action"}\]}</code>.</p>
pub fn set_actions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ActionIdentifier>>) -> Self {
self.actions = input;
self
}
/// <p>The action that a policy permits or forbids. For example, <code>{"actions": \[{"actionId": "ViewPhoto", "actionType": "PhotoFlash::Action"}, {"entityID": "SharePhoto", "entityType": "PhotoFlash::Action"}\]}</code>.</p>
pub fn get_actions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ActionIdentifier>> {
&self.actions
}
/// <p>The definition of the requested policy.</p>
/// This field is required.
pub fn definition(mut self, input: crate::types::PolicyDefinitionDetail) -> Self {
self.definition = ::std::option::Option::Some(input);
self
}
/// <p>The definition of the requested policy.</p>
pub fn set_definition(mut self, input: ::std::option::Option<crate::types::PolicyDefinitionDetail>) -> Self {
self.definition = input;
self
}
/// <p>The definition of the requested policy.</p>
pub fn get_definition(&self) -> &::std::option::Option<crate::types::PolicyDefinitionDetail> {
&self.definition
}
/// <p>The date and time that the policy was originally created.</p>
/// This field is required.
pub fn created_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.created_date = ::std::option::Option::Some(input);
self
}
/// <p>The date and time that the policy was originally created.</p>
pub fn set_created_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.created_date = input;
self
}
/// <p>The date and time that the policy was originally created.</p>
pub fn get_created_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
&self.created_date
}
/// <p>The date and time that the policy was last updated.</p>
/// This field is required.
pub fn last_updated_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.last_updated_date = ::std::option::Option::Some(input);
self
}
/// <p>The date and time that the policy was last updated.</p>
pub fn set_last_updated_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.last_updated_date = input;
self
}
/// <p>The date and time that the policy was last updated.</p>
pub fn get_last_updated_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
&self.last_updated_date
}
/// <p>The effect of the decision that a policy returns to an authorization request. For example, <code>"effect": "Permit"</code>.</p>
pub fn effect(mut self, input: crate::types::PolicyEffect) -> Self {
self.effect = ::std::option::Option::Some(input);
self
}
/// <p>The effect of the decision that a policy returns to an authorization request. For example, <code>"effect": "Permit"</code>.</p>
pub fn set_effect(mut self, input: ::std::option::Option<crate::types::PolicyEffect>) -> Self {
self.effect = input;
self
}
/// <p>The effect of the decision that a policy returns to an authorization request. For example, <code>"effect": "Permit"</code>.</p>
pub fn get_effect(&self) -> &::std::option::Option<crate::types::PolicyEffect> {
&self.effect
}
pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
self._request_id = Some(request_id.into());
self
}
pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
self._request_id = request_id;
self
}
/// Consumes the builder and constructs a [`GetPolicyOutput`](crate::operation::get_policy::GetPolicyOutput).
/// This method will fail if any of the following fields are not set:
/// - [`policy_store_id`](crate::operation::get_policy::builders::GetPolicyOutputBuilder::policy_store_id)
/// - [`policy_id`](crate::operation::get_policy::builders::GetPolicyOutputBuilder::policy_id)
/// - [`policy_type`](crate::operation::get_policy::builders::GetPolicyOutputBuilder::policy_type)
/// - [`created_date`](crate::operation::get_policy::builders::GetPolicyOutputBuilder::created_date)
/// - [`last_updated_date`](crate::operation::get_policy::builders::GetPolicyOutputBuilder::last_updated_date)
pub fn build(self) -> ::std::result::Result<crate::operation::get_policy::GetPolicyOutput, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::operation::get_policy::GetPolicyOutput {
policy_store_id: self.policy_store_id.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"policy_store_id",
"policy_store_id was not specified but it is required when building GetPolicyOutput",
)
})?,
policy_id: self.policy_id.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"policy_id",
"policy_id was not specified but it is required when building GetPolicyOutput",
)
})?,
policy_type: self.policy_type.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"policy_type",
"policy_type was not specified but it is required when building GetPolicyOutput",
)
})?,
principal: self.principal,
resource: self.resource,
actions: self.actions,
definition: self.definition,
created_date: self.created_date.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"created_date",
"created_date was not specified but it is required when building GetPolicyOutput",
)
})?,
last_updated_date: self.last_updated_date.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"last_updated_date",
"last_updated_date was not specified but it is required when building GetPolicyOutput",
)
})?,
effect: self.effect,
_request_id: self._request_id,
})
}
}