/**
 * ******************************************************************************
 *  Copyright Fujitsu.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  You may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License 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.
 * *****************************************************************************
 *
 *  NIFCLOUD SDK for Java
 *
 */
package com.nifty.cloud.sdk.security.model;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.nifty.cloud.sdk.Request;
import com.nifty.cloud.sdk.annotation.Action;
import com.nifty.cloud.sdk.annotation.Query;

/**
 * DescribeKeyPairsリクエストクラス。<br />
 * このクラスはDescribeKeyPairsへのリクエストを構築します。
 */
@Action("DescribeKeyPairs")
public class DescribeKeyPairsRequest implements Request {
	
	/** SSHキー名リスト */
	private List<String> keyNames;

	/**
	 * SSHキー名リストを取得します。
	 * 
	 * @return SSHキー名リスト
	 */
	@Query(name="KeyName")	
	public List<String> getKeyNames() {
		return keyNames;
	}
	/**
	 * SSHキー名リストを設定します。
	 * 
	 * @param keyNames SSHキー名リスト
	 */
	public void setKeyNames(List<String> keyNames) {
		this.keyNames = keyNames;
	}
	/**
	 * SSHキー名の配列を設定し、自オブジェクトを返します。
	 *
	 * @param keyNames SSHキー名の配列
	 * @return 自オブジェクト	 
	 */
	public DescribeKeyPairsRequest withKeyNames(String ... keyNames) {
		if(this.keyNames == null) this.keyNames = new ArrayList<String>();
		for(String keyName: keyNames) {
			getKeyNames().add(keyName);
		}
		return this;
	}
	/**
	 * SSHキー名リストを設定し、自オブジェクトを返します。
	 *
	 * @param keyNames SSHキー名リスト
	 * @return 自オブジェクト	 
	 */
	public DescribeKeyPairsRequest withKeyNames(Collection<String> keyNames) {
		if(this.keyNames == null) this.keyNames = new ArrayList<String>();
		if (keyNames != null) {
			getKeyNames().addAll(keyNames);
		}
		return this;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("[keyNames=");
		builder.append(keyNames);
		builder.append("]");
		return builder.toString();
	}
	
}
