// Path: src/main/java/com/cloudera/director/spi/v2/model/Configured.java
// public interface Configured {
// 
//   /**
//    * Returns the unmodifiable map of configuration parameter values.
//    *
//    * @param localizationContext the localization context
//    * @return the unmodifiable map of configuration parameter values
//    */
//   Map<String, String> getConfiguration(LocalizationContext localizationContext);
// 
//   /**
//    * Returns the value of the specified configuration property, or the default value if the value
//    * is not present and the configuration property is optional.
//    *
//    * @param token               the configuration property token
//    * @param localizationContext the localization context
//    * @return the value of the specified configuration property, or the default value if the value
//    * is not present and the configuration property is optional
//    * @throws IllegalArgumentException if the specified configuration property is not present and
//    *                                  required
//    */
//   String getConfigurationValue(ConfigurationPropertyToken token,
//       LocalizationContext localizationContext);
// 
//   /**
//    * Returns the value of the specified configuration property, or the default value if the value
//    * is not present and the configuration property is optional.
//    *
//    * @param property            the configuration property
//    * @param localizationContext the localization context
//    * @return the value of the specified configuration property, or the default value if the value
//    * is not present and the configuration property is optional
//    * @throws IllegalArgumentException if the specified configuration property is not present and
//    *                                  required
//    */
//   String getConfigurationValue(ConfigurationProperty property,
//       LocalizationContext localizationContext);
// }
// 
// Path: src/main/java/com/cloudera/director/spi/v2/model/LocalizationContext.java
// public interface LocalizationContext {
// 
//   /**
//    * Localization context factory.
//    */
//   interface Factory {
// 
//     /**
//      * Creates a root localization context for the specified locale.
//      *
//      * @param locale the locale
//      * @return a root localization context for the specified locale
//      */
//     LocalizationContext createRootLocalizationContext(Locale locale);
//   }
// 
//   /**
//    * Returns the locale.
//    *
//    * @return the locale
//    */
//   Locale getLocale();
// 
//   /**
//    * Returns the key prefix of the context, which can be used for property namespacing.
//    *
//    * @return the key prefix of the context
//    */
//   String getKeyPrefix();
// 
//   /**
//    * Returns a localized value for the specified localization key suffix components,
//    * or the specified default value if a localized value cannot be determined.
//    *
//    * @param defaultValue  the default value to return if a localized value cannot be determined
//    * @param keyComponents the localization key suffix components
//    * @return a localized value for the specified localization key suffix components,
//    * or the specified default value if a localized value cannot be determined
//    */
//   String localize(String defaultValue, String... keyComponents);
// }


import com.cloudera.director.spi.v2.model.Configured;
import com.cloudera.director.spi.v2.model.LocalizationContext;
// (c) Copyright 2015 Cloudera, Inc.
//
// 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.

package com.cloudera.director.spi.v2.provider;


/**
 * Represents a provider of cloud credentials.
 *
 * @param <T> the type of credentials provided
 */
public interface CredentialsProvider<T> {

  /**
   * Returns the credentials provider metadata.
   *
   * @return the credentials provider metadata
   */
  CredentialsProviderMetadata getMetadata();

  /**
   * Creates credentials based on the specified configuration.
   *
   * @param configuration       the configuration
   * @param localizationContext the localization context
   * @return the credentials
   */
// Path: src/main/java/com/cloudera/director/spi/v2/model/Configured.java
// public interface Configured {
// 
//   /**
//    * Returns the unmodifiable map of configuration parameter values.
//    *
//    * @param localizationContext the localization context
//    * @return the unmodifiable map of configuration parameter values
//    */
//   Map<String, String> getConfiguration(LocalizationContext localizationContext);
// 
//   /**
//    * Returns the value of the specified configuration property, or the default value if the value
//    * is not present and the configuration property is optional.
//    *
//    * @param token               the configuration property token
//    * @param localizationContext the localization context
//    * @return the value of the specified configuration property, or the default value if the value
//    * is not present and the configuration property is optional
//    * @throws IllegalArgumentException if the specified configuration property is not present and
//    *                                  required
//    */
//   String getConfigurationValue(ConfigurationPropertyToken token,
//       LocalizationContext localizationContext);
// 
//   /**
//    * Returns the value of the specified configuration property, or the default value if the value
//    * is not present and the configuration property is optional.
//    *
//    * @param property            the configuration property
//    * @param localizationContext the localization context
//    * @return the value of the specified configuration property, or the default value if the value
//    * is not present and the configuration property is optional
//    * @throws IllegalArgumentException if the specified configuration property is not present and
//    *                                  required
//    */
//   String getConfigurationValue(ConfigurationProperty property,
//       LocalizationContext localizationContext);
// }
// 
// Path: src/main/java/com/cloudera/director/spi/v2/model/LocalizationContext.java
// public interface LocalizationContext {
// 
//   /**
//    * Localization context factory.
//    */
//   interface Factory {
// 
//     /**
//      * Creates a root localization context for the specified locale.
//      *
//      * @param locale the locale
//      * @return a root localization context for the specified locale
//      */
//     LocalizationContext createRootLocalizationContext(Locale locale);
//   }
// 
//   /**
//    * Returns the locale.
//    *
//    * @return the locale
//    */
//   Locale getLocale();
// 
//   /**
//    * Returns the key prefix of the context, which can be used for property namespacing.
//    *
//    * @return the key prefix of the context
//    */
//   String getKeyPrefix();
// 
//   /**
//    * Returns a localized value for the specified localization key suffix components,
//    * or the specified default value if a localized value cannot be determined.
//    *
//    * @param defaultValue  the default value to return if a localized value cannot be determined
//    * @param keyComponents the localization key suffix components
//    * @return a localized value for the specified localization key suffix components,
//    * or the specified default value if a localized value cannot be determined
//    */
//   String localize(String defaultValue, String... keyComponents);
// }


// Path: src/main/java/com/cloudera/director/spi/v2/provider/CredentialsProvider.java
import com.cloudera.director.spi.v2.model.Configured;
import com.cloudera.director.spi.v2.model.LocalizationContext;

// (c) Copyright 2015 Cloudera, Inc.
//
// 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.

package com.cloudera.director.spi.v2.provider;


/**
 * Represents a provider of cloud credentials.
 *
 * @param <T> the type of credentials provided
 */
public interface CredentialsProvider<T> {

  /**
   * Returns the credentials provider metadata.
   *
   * @return the credentials provider metadata
   */
  CredentialsProviderMetadata getMetadata();

  /**
   * Creates credentials based on the specified configuration.
   *
   * @param configuration       the configuration
   * @param localizationContext the localization context
   * @return the credentials
   */
  T createCredentials(Configured configuration, LocalizationContext localizationContext);