/*
 * @(#)SftpPermissionDeniedException.java
 *
 * Copyright (c) 2001-2002 JScape
 * 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * JScape. ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with JScape.
 */
package com.jscape.inet.sftp;

import com.jscape.inet.sftp.protocol.v3.messages.StatusCode;
import com.jscape.util.SuppressObfuscation;

/**
 * Exception thrown when trying to create or access a resource with insufficient permissions.
 */
@SuppressObfuscation
public class SftpPermissionDeniedException
        extends RequestException {

    private String resource;

    /**
     * Creates a new SftpPermissionDeniedException instance.
     *
     * @param resource the resource that caused this exception
     */
    public SftpPermissionDeniedException(String resource) {
        super(StatusCode.SSH_FX_PERMISSION_DENIED.code, String.format("Unable to create or access resource '%s'.", resource));
        this.resource = resource;
    }

    /**
     * Gets resource that caused this exception
     *
     * @return the resource
     */
    public String getResource() {
        return resource;
    }
}
