All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.iam.model.AccessDetail Maven / Gradle / Ivy

/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.iam.model;

import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* An object that contains details about when a principal in the reported AWS Organizations entity last attempted to * access an AWS service. A principal can be an IAM user, an IAM role, or the AWS account root user within the reported * Organizations entity. *

*

* This data type is a response element in the GetOrganizationsAccessReport operation. *

*/ @Generated("software.amazon.awssdk:codegen") public final class AccessDetail implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField SERVICE_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(AccessDetail::serviceName)).setter(setter(Builder::serviceName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServiceName").build()).build(); private static final SdkField SERVICE_NAMESPACE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(AccessDetail::serviceNamespace)).setter(setter(Builder::serviceNamespace)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServiceNamespace").build()).build(); private static final SdkField REGION_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(AccessDetail::region)).setter(setter(Builder::region)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Region").build()).build(); private static final SdkField ENTITY_PATH_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(AccessDetail::entityPath)).setter(setter(Builder::entityPath)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EntityPath").build()).build(); private static final SdkField LAST_AUTHENTICATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .getter(getter(AccessDetail::lastAuthenticatedTime)).setter(setter(Builder::lastAuthenticatedTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastAuthenticatedTime").build()) .build(); private static final SdkField TOTAL_AUTHENTICATED_ENTITIES_FIELD = SdkField . builder(MarshallingType.INTEGER) .getter(getter(AccessDetail::totalAuthenticatedEntities)) .setter(setter(Builder::totalAuthenticatedEntities)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TotalAuthenticatedEntities").build()) .build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SERVICE_NAME_FIELD, SERVICE_NAMESPACE_FIELD, REGION_FIELD, ENTITY_PATH_FIELD, LAST_AUTHENTICATED_TIME_FIELD, TOTAL_AUTHENTICATED_ENTITIES_FIELD)); private static final long serialVersionUID = 1L; private final String serviceName; private final String serviceNamespace; private final String region; private final String entityPath; private final Instant lastAuthenticatedTime; private final Integer totalAuthenticatedEntities; private AccessDetail(BuilderImpl builder) { this.serviceName = builder.serviceName; this.serviceNamespace = builder.serviceNamespace; this.region = builder.region; this.entityPath = builder.entityPath; this.lastAuthenticatedTime = builder.lastAuthenticatedTime; this.totalAuthenticatedEntities = builder.totalAuthenticatedEntities; } /** *

* The name of the service in which access was attempted. *

* * @return The name of the service in which access was attempted. */ public String serviceName() { return serviceName; } /** *

* The namespace of the service in which access was attempted. *

*

* To learn the service namespace of a service, go to Actions, Resources, and Condition Keys for AWS Services in the IAM User Guide. Choose the name of the * service to view details for that service. In the first paragraph, find the service prefix. For example, * (service prefix: a4b). For more information about service namespaces, see AWS Service Namespaces in the AWS General Reference. *

* * @return The namespace of the service in which access was attempted.

*

* To learn the service namespace of a service, go to Actions, Resources, and Condition Keys for AWS Services in the IAM User Guide. Choose the * name of the service to view details for that service. In the first paragraph, find the service prefix. * For example, (service prefix: a4b). For more information about service namespaces, see AWS Service Namespaces in the AWS General Reference. */ public String serviceNamespace() { return serviceNamespace; } /** *

* The Region where the last service access attempt occurred. *

*

* This field is null if no principals in the reported Organizations entity attempted to access the service within * the reporting period. *

* * @return The Region where the last service access attempt occurred.

*

* This field is null if no principals in the reported Organizations entity attempted to access the service * within the reporting period. */ public String region() { return region; } /** *

* The path of the Organizations entity (root, organizational unit, or account) from which an authenticated * principal last attempted to access the service. AWS does not report unauthenticated requests. *

*

* This field is null if no principals (IAM users, IAM roles, or root users) in the reported Organizations entity * attempted to access the service within the reporting period. *

* * @return The path of the Organizations entity (root, organizational unit, or account) from which an authenticated * principal last attempted to access the service. AWS does not report unauthenticated requests.

*

* This field is null if no principals (IAM users, IAM roles, or root users) in the reported Organizations * entity attempted to access the service within the reporting period. */ public String entityPath() { return entityPath; } /** *

* The date and time, in ISO 8601 date-time format, when an * authenticated principal most recently attempted to access the service. AWS does not report unauthenticated * requests. *

*

* This field is null if no principals in the reported Organizations entity attempted to access the service within * the reporting period. *

* * @return The date and time, in ISO 8601 date-time format, when an * authenticated principal most recently attempted to access the service. AWS does not report * unauthenticated requests.

*

* This field is null if no principals in the reported Organizations entity attempted to access the service * within the reporting period. */ public Instant lastAuthenticatedTime() { return lastAuthenticatedTime; } /** *

* The number of accounts with authenticated principals (root users, IAM users, and IAM roles) that attempted to * access the service in the reporting period. *

* * @return The number of accounts with authenticated principals (root users, IAM users, and IAM roles) that * attempted to access the service in the reporting period. */ public Integer totalAuthenticatedEntities() { return totalAuthenticatedEntities; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(serviceName()); hashCode = 31 * hashCode + Objects.hashCode(serviceNamespace()); hashCode = 31 * hashCode + Objects.hashCode(region()); hashCode = 31 * hashCode + Objects.hashCode(entityPath()); hashCode = 31 * hashCode + Objects.hashCode(lastAuthenticatedTime()); hashCode = 31 * hashCode + Objects.hashCode(totalAuthenticatedEntities()); return hashCode; } @Override public boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof AccessDetail)) { return false; } AccessDetail other = (AccessDetail) obj; return Objects.equals(serviceName(), other.serviceName()) && Objects.equals(serviceNamespace(), other.serviceNamespace()) && Objects.equals(region(), other.region()) && Objects.equals(entityPath(), other.entityPath()) && Objects.equals(lastAuthenticatedTime(), other.lastAuthenticatedTime()) && Objects.equals(totalAuthenticatedEntities(), other.totalAuthenticatedEntities()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public String toString() { return ToString.builder("AccessDetail").add("ServiceName", serviceName()).add("ServiceNamespace", serviceNamespace()) .add("Region", region()).add("EntityPath", entityPath()).add("LastAuthenticatedTime", lastAuthenticatedTime()) .add("TotalAuthenticatedEntities", totalAuthenticatedEntities()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ServiceName": return Optional.ofNullable(clazz.cast(serviceName())); case "ServiceNamespace": return Optional.ofNullable(clazz.cast(serviceNamespace())); case "Region": return Optional.ofNullable(clazz.cast(region())); case "EntityPath": return Optional.ofNullable(clazz.cast(entityPath())); case "LastAuthenticatedTime": return Optional.ofNullable(clazz.cast(lastAuthenticatedTime())); case "TotalAuthenticatedEntities": return Optional.ofNullable(clazz.cast(totalAuthenticatedEntities())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((AccessDetail) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the service in which access was attempted. *

* * @param serviceName * The name of the service in which access was attempted. * @return Returns a reference to this object so that method calls can be chained together. */ Builder serviceName(String serviceName); /** *

* The namespace of the service in which access was attempted. *

*

* To learn the service namespace of a service, go to Actions, Resources, and Condition Keys for AWS Services in the IAM User Guide. Choose the name of * the service to view details for that service. In the first paragraph, find the service prefix. For example, * (service prefix: a4b). For more information about service namespaces, see AWS Service Namespaces in the AWS General Reference. *

* * @param serviceNamespace * The namespace of the service in which access was attempted.

*

* To learn the service namespace of a service, go to Actions, Resources, and Condition Keys for AWS Services in the IAM User Guide. Choose the * name of the service to view details for that service. In the first paragraph, find the service prefix. * For example, (service prefix: a4b). For more information about service namespaces, see AWS Service Namespaces in the AWS General Reference. * @return Returns a reference to this object so that method calls can be chained together. */ Builder serviceNamespace(String serviceNamespace); /** *

* The Region where the last service access attempt occurred. *

*

* This field is null if no principals in the reported Organizations entity attempted to access the service * within the reporting period. *

* * @param region * The Region where the last service access attempt occurred.

*

* This field is null if no principals in the reported Organizations entity attempted to access the * service within the reporting period. * @return Returns a reference to this object so that method calls can be chained together. */ Builder region(String region); /** *

* The path of the Organizations entity (root, organizational unit, or account) from which an authenticated * principal last attempted to access the service. AWS does not report unauthenticated requests. *

*

* This field is null if no principals (IAM users, IAM roles, or root users) in the reported Organizations * entity attempted to access the service within the reporting period. *

* * @param entityPath * The path of the Organizations entity (root, organizational unit, or account) from which an * authenticated principal last attempted to access the service. AWS does not report unauthenticated * requests.

*

* This field is null if no principals (IAM users, IAM roles, or root users) in the reported * Organizations entity attempted to access the service within the reporting period. * @return Returns a reference to this object so that method calls can be chained together. */ Builder entityPath(String entityPath); /** *

* The date and time, in ISO 8601 date-time format, when an * authenticated principal most recently attempted to access the service. AWS does not report unauthenticated * requests. *

*

* This field is null if no principals in the reported Organizations entity attempted to access the service * within the reporting period. *

* * @param lastAuthenticatedTime * The date and time, in ISO 8601 date-time format, when an * authenticated principal most recently attempted to access the service. AWS does not report * unauthenticated requests.

*

* This field is null if no principals in the reported Organizations entity attempted to access the * service within the reporting period. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastAuthenticatedTime(Instant lastAuthenticatedTime); /** *

* The number of accounts with authenticated principals (root users, IAM users, and IAM roles) that attempted to * access the service in the reporting period. *

* * @param totalAuthenticatedEntities * The number of accounts with authenticated principals (root users, IAM users, and IAM roles) that * attempted to access the service in the reporting period. * @return Returns a reference to this object so that method calls can be chained together. */ Builder totalAuthenticatedEntities(Integer totalAuthenticatedEntities); } static final class BuilderImpl implements Builder { private String serviceName; private String serviceNamespace; private String region; private String entityPath; private Instant lastAuthenticatedTime; private Integer totalAuthenticatedEntities; private BuilderImpl() { } private BuilderImpl(AccessDetail model) { serviceName(model.serviceName); serviceNamespace(model.serviceNamespace); region(model.region); entityPath(model.entityPath); lastAuthenticatedTime(model.lastAuthenticatedTime); totalAuthenticatedEntities(model.totalAuthenticatedEntities); } public final String getServiceName() { return serviceName; } @Override public final Builder serviceName(String serviceName) { this.serviceName = serviceName; return this; } public final void setServiceName(String serviceName) { this.serviceName = serviceName; } public final String getServiceNamespace() { return serviceNamespace; } @Override public final Builder serviceNamespace(String serviceNamespace) { this.serviceNamespace = serviceNamespace; return this; } public final void setServiceNamespace(String serviceNamespace) { this.serviceNamespace = serviceNamespace; } public final String getRegion() { return region; } @Override public final Builder region(String region) { this.region = region; return this; } public final void setRegion(String region) { this.region = region; } public final String getEntityPath() { return entityPath; } @Override public final Builder entityPath(String entityPath) { this.entityPath = entityPath; return this; } public final void setEntityPath(String entityPath) { this.entityPath = entityPath; } public final Instant getLastAuthenticatedTime() { return lastAuthenticatedTime; } @Override public final Builder lastAuthenticatedTime(Instant lastAuthenticatedTime) { this.lastAuthenticatedTime = lastAuthenticatedTime; return this; } public final void setLastAuthenticatedTime(Instant lastAuthenticatedTime) { this.lastAuthenticatedTime = lastAuthenticatedTime; } public final Integer getTotalAuthenticatedEntities() { return totalAuthenticatedEntities; } @Override public final Builder totalAuthenticatedEntities(Integer totalAuthenticatedEntities) { this.totalAuthenticatedEntities = totalAuthenticatedEntities; return this; } public final void setTotalAuthenticatedEntities(Integer totalAuthenticatedEntities) { this.totalAuthenticatedEntities = totalAuthenticatedEntities; } @Override public AccessDetail build() { return new AccessDetail(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy