// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.storagepool.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.storagepool.models.Acl;
import com.azure.resourcemanager.storagepool.models.IscsiLun;
import com.azure.resourcemanager.storagepool.models.IscsiTargetAclMode;
import com.azure.resourcemanager.storagepool.models.OperationalStatus;
import com.azure.resourcemanager.storagepool.models.ProvisioningStates;
import com.azure.resourcemanager.storagepool.models.SystemMetadata;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Response for iSCSI Target requests. */
@Fluent
public final class IscsiTargetInner extends ProxyResource {
    /*
     * Properties for iSCSI Target operations.
     */
    @JsonProperty(value = "properties", required = true)
    private IscsiTargetProperties innerProperties = new IscsiTargetProperties();

    /*
     * Resource metadata required by ARM RPC
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemMetadata systemData;

    /*
     * Azure resource id. Indicates if this resource is managed by another Azure resource.
     */
    @JsonProperty(value = "managedBy", access = JsonProperty.Access.WRITE_ONLY)
    private String managedBy;

    /*
     * List of Azure resource ids that manage this resource.
     */
    @JsonProperty(value = "managedByExtended", access = JsonProperty.Access.WRITE_ONLY)
    private List<String> managedByExtended;

    /** Creates an instance of IscsiTargetInner class. */
    public IscsiTargetInner() {
    }

    /**
     * Get the innerProperties property: Properties for iSCSI Target operations.
     *
     * @return the innerProperties value.
     */
    private IscsiTargetProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Resource metadata required by ARM RPC.
     *
     * @return the systemData value.
     */
    public SystemMetadata systemData() {
        return this.systemData;
    }

    /**
     * Get the managedBy property: Azure resource id. Indicates if this resource is managed by another Azure resource.
     *
     * @return the managedBy value.
     */
    public String managedBy() {
        return this.managedBy;
    }

    /**
     * Get the managedByExtended property: List of Azure resource ids that manage this resource.
     *
     * @return the managedByExtended value.
     */
    public List<String> managedByExtended() {
        return this.managedByExtended;
    }

    /**
     * Get the aclMode property: Mode for Target connectivity.
     *
     * @return the aclMode value.
     */
    public IscsiTargetAclMode aclMode() {
        return this.innerProperties() == null ? null : this.innerProperties().aclMode();
    }

    /**
     * Set the aclMode property: Mode for Target connectivity.
     *
     * @param aclMode the aclMode value to set.
     * @return the IscsiTargetInner object itself.
     */
    public IscsiTargetInner withAclMode(IscsiTargetAclMode aclMode) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IscsiTargetProperties();
        }
        this.innerProperties().withAclMode(aclMode);
        return this;
    }

    /**
     * Get the staticAcls property: Access Control List (ACL) for an iSCSI Target; defines LUN masking policy.
     *
     * @return the staticAcls value.
     */
    public List<Acl> staticAcls() {
        return this.innerProperties() == null ? null : this.innerProperties().staticAcls();
    }

    /**
     * Set the staticAcls property: Access Control List (ACL) for an iSCSI Target; defines LUN masking policy.
     *
     * @param staticAcls the staticAcls value to set.
     * @return the IscsiTargetInner object itself.
     */
    public IscsiTargetInner withStaticAcls(List<Acl> staticAcls) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IscsiTargetProperties();
        }
        this.innerProperties().withStaticAcls(staticAcls);
        return this;
    }

    /**
     * Get the luns property: List of LUNs to be exposed through iSCSI Target.
     *
     * @return the luns value.
     */
    public List<IscsiLun> luns() {
        return this.innerProperties() == null ? null : this.innerProperties().luns();
    }

    /**
     * Set the luns property: List of LUNs to be exposed through iSCSI Target.
     *
     * @param luns the luns value to set.
     * @return the IscsiTargetInner object itself.
     */
    public IscsiTargetInner withLuns(List<IscsiLun> luns) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IscsiTargetProperties();
        }
        this.innerProperties().withLuns(luns);
        return this;
    }

    /**
     * Get the targetIqn property: iSCSI Target IQN (iSCSI Qualified Name); example: "iqn.2005-03.org.iscsi:server".
     *
     * @return the targetIqn value.
     */
    public String targetIqn() {
        return this.innerProperties() == null ? null : this.innerProperties().targetIqn();
    }

    /**
     * Set the targetIqn property: iSCSI Target IQN (iSCSI Qualified Name); example: "iqn.2005-03.org.iscsi:server".
     *
     * @param targetIqn the targetIqn value to set.
     * @return the IscsiTargetInner object itself.
     */
    public IscsiTargetInner withTargetIqn(String targetIqn) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IscsiTargetProperties();
        }
        this.innerProperties().withTargetIqn(targetIqn);
        return this;
    }

    /**
     * Get the provisioningState property: State of the operation on the resource.
     *
     * @return the provisioningState value.
     */
    public ProvisioningStates provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the status property: Operational status of the iSCSI Target.
     *
     * @return the status value.
     */
    public OperationalStatus status() {
        return this.innerProperties() == null ? null : this.innerProperties().status();
    }

    /**
     * Set the status property: Operational status of the iSCSI Target.
     *
     * @param status the status value to set.
     * @return the IscsiTargetInner object itself.
     */
    public IscsiTargetInner withStatus(OperationalStatus status) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IscsiTargetProperties();
        }
        this.innerProperties().withStatus(status);
        return this;
    }

    /**
     * Get the endpoints property: List of private IPv4 addresses to connect to the iSCSI Target.
     *
     * @return the endpoints value.
     */
    public List<String> endpoints() {
        return this.innerProperties() == null ? null : this.innerProperties().endpoints();
    }

    /**
     * Set the endpoints property: List of private IPv4 addresses to connect to the iSCSI Target.
     *
     * @param endpoints the endpoints value to set.
     * @return the IscsiTargetInner object itself.
     */
    public IscsiTargetInner withEndpoints(List<String> endpoints) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IscsiTargetProperties();
        }
        this.innerProperties().withEndpoints(endpoints);
        return this;
    }

    /**
     * Get the port property: The port used by iSCSI Target portal group.
     *
     * @return the port value.
     */
    public Integer port() {
        return this.innerProperties() == null ? null : this.innerProperties().port();
    }

    /**
     * Set the port property: The port used by iSCSI Target portal group.
     *
     * @param port the port value to set.
     * @return the IscsiTargetInner object itself.
     */
    public IscsiTargetInner withPort(Integer port) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IscsiTargetProperties();
        }
        this.innerProperties().withPort(port);
        return this;
    }

    /**
     * Get the sessions property: List of identifiers for active sessions on the iSCSI target.
     *
     * @return the sessions value.
     */
    public List<String> sessions() {
        return this.innerProperties() == null ? null : this.innerProperties().sessions();
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property innerProperties in model IscsiTargetInner"));
        } else {
            innerProperties().validate();
        }
        if (systemData() != null) {
            systemData().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(IscsiTargetInner.class);
}
