001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.apache.hadoop.yarn.api.records;
020
021import java.nio.ByteBuffer;
022
023import org.apache.hadoop.classification.InterfaceAudience.Private;
024import org.apache.hadoop.classification.InterfaceAudience.Public;
025import org.apache.hadoop.classification.InterfaceStability.Stable;
026import org.apache.hadoop.yarn.api.AMRMProtocol;
027import org.apache.hadoop.yarn.api.ContainerManager;
028
029/**
030 * <p><code>ContainerToken</code> is the security token used by the framework
031 * to verify authenticity of any <code>Container</code>.</p>
032 *
033 * <p>The <code>ResourceManager</code>, on container allocation provides a
034 * secure token which is verified by the <code>NodeManager</code> on 
035 * container launch.</p>
036 * 
037 * <p>Applications do not need to care about <code>ContainerToken</code>, they
038 * are transparently handled by the framework - the allocated 
039 * <code>Container</code> includes the <code>ContainerToken</code>.</p>
040 * 
041 * @see AMRMProtocol#allocate(org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest)
042 * @see ContainerManager#startContainer(org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest)
043 */
044@Public
045@Stable
046public interface ContainerToken extends DelegationToken {
047  /**
048   * Get the token identifier.
049   * @return token identifier
050   */
051  @Public
052  @Stable
053  ByteBuffer getIdentifier();
054  
055  @Private
056  @Stable
057  void setIdentifier(ByteBuffer identifier);
058
059  /**
060   * Get the token password
061   * @return token password
062   */
063  @Public
064  @Stable
065  ByteBuffer getPassword();
066  
067  @Private
068  @Stable
069  void setPassword(ByteBuffer password);
070
071  /**
072   * Get the token kind.
073   * @return token kind
074   */
075  @Public
076  @Stable
077  String getKind();
078  
079  @Private
080  @Stable
081  void setKind(String kind);
082
083  /**
084   * Get the service to which the token is allocated.
085   * @return service to which the token is allocated
086   */
087  @Public
088  @Stable
089  String getService();
090
091  @Private
092  @Stable
093  void setService(String service);
094
095}