当前位置: 首页>>代码示例>>Java>>正文


Java KMSRESTConstants.VERSIONS_SUB_RESOURCE属性代码示例

本文整理汇总了Java中org.apache.hadoop.crypto.key.kms.KMSRESTConstants.VERSIONS_SUB_RESOURCE属性的典型用法代码示例。如果您正苦于以下问题:Java KMSRESTConstants.VERSIONS_SUB_RESOURCE属性的具体用法?Java KMSRESTConstants.VERSIONS_SUB_RESOURCE怎么用?Java KMSRESTConstants.VERSIONS_SUB_RESOURCE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.hadoop.crypto.key.kms.KMSRESTConstants的用法示例。


在下文中一共展示了KMSRESTConstants.VERSIONS_SUB_RESOURCE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getKeyPairVersions

@GET
@Path(KMSRESTConstants.KEY_PAIR_RESOURCE + "/{name:.*}/" +
    KMSRESTConstants.VERSIONS_SUB_RESOURCE)
@Produces(MediaType.APPLICATION_JSON)
public Response getKeyPairVersions(@PathParam("name") final String name)
    throws Exception {
  UserGroupInformation user = HttpUserGroupInformation.get();
  KMSClientProvider.checkNotEmpty(name, "name");
  KMSWebApp.getKeyCallsMeter().mark();
  assertAccess(KMSACLs.Type.GET, user, KMSOp.GET_KEY_VERSIONS, name);

  List<KeyPairVersion> ret = user.doAs(
      new PrivilegedExceptionAction<List<KeyPairVersion>>() {
        @Override
        public List<KeyPairVersion> run() throws Exception {
          return provider.getKeyPairVersions(name);
        }
      }
  );

  Object json = KMSServerJSONUtils.toJSONPair(ret);
  kmsAudit.ok(user, KMSOp.GET_KEY_VERSIONS, name, "");
  return Response.ok().type(MediaType.APPLICATION_JSON).entity(json).build();
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:24,代码来源:KMS.java

示例2: getKeyVersions

@GET
@Path(KMSRESTConstants.KEY_RESOURCE + "/{name:.*}/" +
    KMSRESTConstants.VERSIONS_SUB_RESOURCE)
@Produces(MediaType.APPLICATION_JSON)
public Response getKeyVersions(@PathParam("name") final String name)
    throws Exception {
  UserGroupInformation user = HttpUserGroupInformation.get();
  KMSClientProvider.checkNotEmpty(name, "name");
  KMSWebApp.getKeyCallsMeter().mark();
  assertAccess(KMSACLs.Type.GET, user, KMSOp.GET_KEY_VERSIONS, name);

  List<KeyVersion> ret = user.doAs(
      new PrivilegedExceptionAction<List<KeyVersion>>() {
        @Override
        public List<KeyVersion> run() throws Exception {
          return provider.getKeyVersions(name);
        }
      }
  );

  Object json = KMSServerJSONUtils.toJSON(ret);
  kmsAudit.ok(user, KMSOp.GET_KEY_VERSIONS, name, "");
  return Response.ok().type(MediaType.APPLICATION_JSON).entity(json).build();
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:24,代码来源:KMS.java

示例3: getKeyVersions

@GET
@Path(KMSRESTConstants.KEY_RESOURCE + "/{name:.*}/" +
    KMSRESTConstants.VERSIONS_SUB_RESOURCE)
@Produces(MediaType.APPLICATION_JSON)
public Response getKeyVersions(@PathParam("name") final String name)
    throws Exception {
  try {
    LOG.trace("Entering getKeyVersions method.");
    UserGroupInformation user = HttpUserGroupInformation.get();
    KMSClientProvider.checkNotEmpty(name, "name");
    KMSWebApp.getKeyCallsMeter().mark();
    assertAccess(KMSACLs.Type.GET, user, KMSOp.GET_KEY_VERSIONS, name);
    LOG.debug("Getting key versions for key {}", name);

    List<KeyVersion> ret = user.doAs(
            new PrivilegedExceptionAction<List<KeyVersion>>() {
            @Override
              public List<KeyVersion> run() throws Exception {
              return provider.getKeyVersions(name);
            }
          }
    );

    Object json = KMSServerJSONUtils.toJSON(ret);
    kmsAudit.ok(user, KMSOp.GET_KEY_VERSIONS, name, "");
    LOG.trace("Exiting getKeyVersions method.");
    return Response.ok().type(MediaType.APPLICATION_JSON).entity(json)
            .build();
  } catch (Exception e) {
    LOG.debug("Exception in getKeyVersions.", e);
    throw e;
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:33,代码来源:KMS.java


注:本文中的org.apache.hadoop.crypto.key.kms.KMSRESTConstants.VERSIONS_SUB_RESOURCE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。