aws_sdk_verifiedpermissions/operation/create_policy/_create_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
// 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 CreatePolicyOutput {
/// <p>The ID of the policy store that contains the new policy.</p>
pub policy_store_id: ::std::string::String,
/// <p>The unique ID of the new policy.</p>
pub policy_id: ::std::string::String,
/// <p>The policy type of the new policy.</p>
pub policy_type: crate::types::PolicyType,
/// <p>The principal specified in the new policy's scope. This response element isn't present when <code>principal</code> isn't specified in the policy content.</p>
pub principal: ::std::option::Option<crate::types::EntityIdentifier>,
/// <p>The resource specified in the new policy's scope. This response element isn't present when the <code>resource</code> isn't specified 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 date and time the policy was originally created.</p>
pub created_date: ::aws_smithy_types::DateTime,
/// <p>The date and time 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 CreatePolicyOutput {
/// <p>The ID of the policy store that contains the new policy.</p>
pub fn policy_store_id(&self) -> &str {
use std::ops::Deref;
self.policy_store_id.deref()
}
/// <p>The unique ID of the new policy.</p>
pub fn policy_id(&self) -> &str {
use std::ops::Deref;
self.policy_id.deref()
}
/// <p>The policy type of the new policy.</p>
pub fn policy_type(&self) -> &crate::types::PolicyType {
&self.policy_type
}
/// <p>The principal specified in the new policy's scope. This response element isn't present when <code>principal</code> isn't specified 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 new policy's scope. This response element isn't present when the <code>resource</code> isn't specified 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 date and time the policy was originally created.</p>
pub fn created_date(&self) -> &::aws_smithy_types::DateTime {
&self.created_date
}
/// <p>The date and time 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 CreatePolicyOutput {
fn request_id(&self) -> Option<&str> {
self._request_id.as_deref()
}
}
impl CreatePolicyOutput {
/// Creates a new builder-style object to manufacture [`CreatePolicyOutput`](crate::operation::create_policy::CreatePolicyOutput).
pub fn builder() -> crate::operation::create_policy::builders::CreatePolicyOutputBuilder {
crate::operation::create_policy::builders::CreatePolicyOutputBuilder::default()
}
}
/// A builder for [`CreatePolicyOutput`](crate::operation::create_policy::CreatePolicyOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CreatePolicyOutputBuilder {
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) 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 CreatePolicyOutputBuilder {
/// <p>The ID of the policy store that contains the new policy.</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 new policy.</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 new policy.</p>
pub fn get_policy_store_id(&self) -> &::std::option::Option<::std::string::String> {
&self.policy_store_id
}
/// <p>The unique ID of the new policy.</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 new policy.</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 new policy.</p>
pub fn get_policy_id(&self) -> &::std::option::Option<::std::string::String> {
&self.policy_id
}
/// <p>The policy type of the new 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 policy type of the new policy.</p>
pub fn set_policy_type(mut self, input: ::std::option::Option<crate::types::PolicyType>) -> Self {
self.policy_type = input;
self
}
/// <p>The policy type of the new policy.</p>
pub fn get_policy_type(&self) -> &::std::option::Option<crate::types::PolicyType> {
&self.policy_type
}
/// <p>The principal specified in the new policy's scope. This response element isn't present when <code>principal</code> isn't specified 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 new policy's scope. This response element isn't present when <code>principal</code> isn't specified 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 new policy's scope. This response element isn't present when <code>principal</code> isn't specified in the policy content.</p>
pub fn get_principal(&self) -> &::std::option::Option<crate::types::EntityIdentifier> {
&self.principal
}
/// <p>The resource specified in the new policy's scope. This response element isn't present when the <code>resource</code> isn't specified 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 new policy's scope. This response element isn't present when the <code>resource</code> isn't specified 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 new policy's scope. This response element isn't present when the <code>resource</code> isn't specified 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 date and time 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 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 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 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 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 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 [`CreatePolicyOutput`](crate::operation::create_policy::CreatePolicyOutput).
/// This method will fail if any of the following fields are not set:
/// - [`policy_store_id`](crate::operation::create_policy::builders::CreatePolicyOutputBuilder::policy_store_id)
/// - [`policy_id`](crate::operation::create_policy::builders::CreatePolicyOutputBuilder::policy_id)
/// - [`policy_type`](crate::operation::create_policy::builders::CreatePolicyOutputBuilder::policy_type)
/// - [`created_date`](crate::operation::create_policy::builders::CreatePolicyOutputBuilder::created_date)
/// - [`last_updated_date`](crate::operation::create_policy::builders::CreatePolicyOutputBuilder::last_updated_date)
pub fn build(
self,
) -> ::std::result::Result<crate::operation::create_policy::CreatePolicyOutput, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::operation::create_policy::CreatePolicyOutput {
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 CreatePolicyOutput",
)
})?,
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 CreatePolicyOutput",
)
})?,
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 CreatePolicyOutput",
)
})?,
principal: self.principal,
resource: self.resource,
actions: self.actions,
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 CreatePolicyOutput",
)
})?,
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 CreatePolicyOutput",
)
})?,
effect: self.effect,
_request_id: self._request_id,
})
}
}