Api sync for key storage

* change ssh-key/ to keys/ in api paths
This commit is contained in:
Greg Schueler 2014-04-23 16:18:41 -07:00
parent 89452e731a
commit a59246bdf3
17 changed files with 200 additions and 199 deletions

View file

@ -82,7 +82,7 @@ public class RundeckClient implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final String JOBS_IMPORT = "/jobs/import"; public static final String JOBS_IMPORT = "/jobs/import";
public static final String STORAGE_ROOT_PATH = "/storage/"; public static final String STORAGE_ROOT_PATH = "/storage/";
public static final String SSH_KEY_PATH = "ssh-key/"; public static final String STORAGE_KEYS_PATH = "keys/";
/** /**
* Supported version numbers * Supported version numbers
@ -2375,18 +2375,18 @@ public class RundeckClient implements Serializable {
} }
/** /**
* Store an SSH key file * Store an key file
* @param path ssh key storage path, must start with "ssh-key/" * @param path ssh key storage path, must start with "keys/"
* @param keyfile key file * @param keyfile key file
* @param privateKey true to store private key, false to store public key * @param privateKey true to store private key, false to store public key
* @return the SSH key resource * @return the key resource
* @throws RundeckApiException * @throws RundeckApiException
*/ */
public SSHKeyResource storeSshKey(final String path, final File keyfile, boolean privateKey) throws RundeckApiException{ public KeyResource storeKey(final String path, final File keyfile, boolean privateKey) throws RundeckApiException{
AssertUtil.notNull(path, "path is mandatory to store an SSH key."); AssertUtil.notNull(path, "path is mandatory to store an key.");
AssertUtil.notNull(keyfile, "keyfile is mandatory to store an SSH key."); AssertUtil.notNull(keyfile, "keyfile is mandatory to store an key.");
if (!path.startsWith(SSH_KEY_PATH)) { if (!path.startsWith(STORAGE_KEYS_PATH)) {
throw new IllegalArgumentException("SSH key storage path must start with: " + SSH_KEY_PATH); throw new IllegalArgumentException("key storage path must start with: " + STORAGE_KEYS_PATH);
} }
return new ApiCall(this).post( return new ApiCall(this).post(
new ApiPathBuilder(STORAGE_ROOT_PATH, path).content( new ApiPathBuilder(STORAGE_ROOT_PATH, path).content(
@ -2398,42 +2398,42 @@ public class RundeckClient implements Serializable {
} }
/** /**
* Get metadata for an SSH key file * Get metadata for an key file
* *
* @param path ssh key storage path, must start with "ssh-key/" * @param path ssh key storage path, must start with "keys/"
* *
* @return the ssh key resource * @return the ssh key resource
* *
* @throws RundeckApiException if there is an error, or if the path is a directory not a file * @throws RundeckApiException if there is an error, or if the path is a directory not a file
*/ */
public SSHKeyResource getSshKey(final String path) throws RundeckApiException { public KeyResource getKey(final String path) throws RundeckApiException {
AssertUtil.notNull(path, "path is mandatory to get an SSH key."); AssertUtil.notNull(path, "path is mandatory to get an key.");
if (!path.startsWith(SSH_KEY_PATH)) { if (!path.startsWith(STORAGE_KEYS_PATH)) {
throw new IllegalArgumentException("SSH key storage path must start with: " + SSH_KEY_PATH); throw new IllegalArgumentException("key storage path must start with: " + STORAGE_KEYS_PATH);
} }
SSHKeyResource storageResource = new ApiCall(this).get( KeyResource storageResource = new ApiCall(this).get(
new ApiPathBuilder(STORAGE_ROOT_PATH, path), new ApiPathBuilder(STORAGE_ROOT_PATH, path),
new SSHKeyResourceParser("/resource") new SSHKeyResourceParser("/resource")
); );
if (storageResource.isDirectory()) { if (storageResource.isDirectory()) {
throw new RundeckApiException("SSH Key Path is a directory: " + path); throw new RundeckApiException("Key Path is a directory: " + path);
} }
return storageResource; return storageResource;
} }
/** /**
* Get content for a public SSH key file * Get content for a public key file
* @param path ssh key storage path, must start with "ssh-key/" * @param path ssh key storage path, must start with "keys/"
* @param out outputstream to write data to * @param out outputstream to write data to
* *
* @return length of written data * @return length of written data
* @throws RundeckApiException * @throws RundeckApiException
*/ */
public int getPublicSshKeyContent(final String path, final OutputStream out) throws public int getPublicKeyContent(final String path, final OutputStream out) throws
RundeckApiException, IOException { RundeckApiException, IOException {
AssertUtil.notNull(path, "path is mandatory to get an SSH key."); AssertUtil.notNull(path, "path is mandatory to get an key.");
if (!path.startsWith(SSH_KEY_PATH)) { if (!path.startsWith(STORAGE_KEYS_PATH)) {
throw new IllegalArgumentException("SSH key storage path must start with: " + SSH_KEY_PATH); throw new IllegalArgumentException("key storage path must start with: " + STORAGE_KEYS_PATH);
} }
try { try {
return new ApiCall(this).get( return new ApiCall(this).get(
@ -2443,66 +2443,66 @@ public class RundeckClient implements Serializable {
out out
); );
} catch (RundeckApiException.RundeckApiHttpContentTypeException e) { } catch (RundeckApiException.RundeckApiHttpContentTypeException e) {
throw new RundeckApiException("Requested SSH Key path was not a Public key: " + path, e); throw new RundeckApiException("Requested Key path was not a Public key: " + path, e);
} }
} }
/** /**
* Get content for a public SSH key file * Get content for a public key file
* @param path ssh key storage path, must start with "ssh-key/" * @param path ssh key storage path, must start with "keys/"
* @param out file to write data to * @param out file to write data to
* @return length of written data * @return length of written data
* @throws RundeckApiException * @throws RundeckApiException
*/ */
public int getPublicSshKeyContent(final String path, final File out) throws public int getPublicKeyContent(final String path, final File out) throws
RundeckApiException, IOException { RundeckApiException, IOException {
final FileOutputStream fileOutputStream = new FileOutputStream(out); final FileOutputStream fileOutputStream = new FileOutputStream(out);
try { try {
return getPublicSshKeyContent(path, fileOutputStream); return getPublicKeyContent(path, fileOutputStream);
}finally { }finally {
fileOutputStream.close(); fileOutputStream.close();
} }
} }
/** /**
* List contents of root SSH key directory * List contents of root key directory
* *
* @return list of SSH key resources * @return list of key resources
* @throws RundeckApiException * @throws RundeckApiException
*/ */
public List<SSHKeyResource> listSshKeyDirectoryRoot() throws RundeckApiException { public List<KeyResource> listKeyDirectoryRoot() throws RundeckApiException {
return listSshKeyDirectory(SSH_KEY_PATH); return listKeyDirectory(STORAGE_KEYS_PATH);
} }
/** /**
* List contents of SSH key directory * List contents of key directory
* *
* @param path ssh key storage path, must start with "ssh-key/" * @param path ssh key storage path, must start with "keys/"
* *
* @throws RundeckApiException if there is an error, or if the path is a file not a directory * @throws RundeckApiException if there is an error, or if the path is a file not a directory
*/ */
public List<SSHKeyResource> listSshKeyDirectory(final String path) throws RundeckApiException { public List<KeyResource> listKeyDirectory(final String path) throws RundeckApiException {
AssertUtil.notNull(path, "path is mandatory to get an SSH key."); AssertUtil.notNull(path, "path is mandatory to get an key.");
if (!path.startsWith(SSH_KEY_PATH)) { if (!path.startsWith(STORAGE_KEYS_PATH)) {
throw new IllegalArgumentException("SSH key storage path must start with: " + SSH_KEY_PATH); throw new IllegalArgumentException("key storage path must start with: " + STORAGE_KEYS_PATH);
} }
SSHKeyResource storageResource = new ApiCall(this).get( KeyResource storageResource = new ApiCall(this).get(
new ApiPathBuilder(STORAGE_ROOT_PATH, path), new ApiPathBuilder(STORAGE_ROOT_PATH, path),
new SSHKeyResourceParser("/resource") new SSHKeyResourceParser("/resource")
); );
if(!storageResource.isDirectory()) { if(!storageResource.isDirectory()) {
throw new RundeckApiException("SSH key path is not a directory path: " + path); throw new RundeckApiException("key path is not a directory path: " + path);
} }
return storageResource.getDirectoryContents(); return storageResource.getDirectoryContents();
} }
/** /**
* Delete an SSH key file * Delete an key file
* @param path a path to a SSH key file, must start with "ssh-key/" * @param path a path to a key file, must start with "keys/"
*/ */
public void deleteSshKey(final String path){ public void deleteKey(final String path){
AssertUtil.notNull(path, "path is mandatory to delete an SSH key."); AssertUtil.notNull(path, "path is mandatory to delete an key.");
if (!path.startsWith(SSH_KEY_PATH)) { if (!path.startsWith(STORAGE_KEYS_PATH)) {
throw new IllegalArgumentException("SSH key storage path must start with: " + SSH_KEY_PATH); throw new IllegalArgumentException("key storage path must start with: " + STORAGE_KEYS_PATH);
} }
new ApiCall(this).delete(new ApiPathBuilder(STORAGE_ROOT_PATH, path)); new ApiCall(this).delete(new ApiPathBuilder(STORAGE_ROOT_PATH, path));
} }

View file

@ -1,21 +1,18 @@
package org.rundeck.api.domain; package org.rundeck.api.domain;
import org.rundeck.api.RundeckClient;
import org.rundeck.api.parser.StorageResourceParser;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* BaseSSHKeyResource is ... * BaseKeyResource is ...
* *
* @author Greg Schueler <greg@simplifyops.com> * @author Greg Schueler <greg@simplifyops.com>
* @since 2014-04-04 * @since 2014-04-04
*/ */
public class BaseSSHKeyResource extends BaseStorageResource implements SSHKeyResource { public class BaseKeyResource extends BaseStorageResource implements KeyResource {
private boolean privateKey; private boolean privateKey;
public BaseSSHKeyResource() { public BaseKeyResource() {
} }
@ -27,22 +24,22 @@ public class BaseSSHKeyResource extends BaseStorageResource implements SSHKeyRes
this.privateKey = privateKey; this.privateKey = privateKey;
} }
ArrayList<SSHKeyResource> sshKeyResources = new ArrayList<SSHKeyResource>(); ArrayList<KeyResource> keyResources = new ArrayList<KeyResource>();
@Override @Override
public void setDirectoryContents(List<? extends StorageResource> directoryContents) { public void setDirectoryContents(List<? extends StorageResource> directoryContents) {
for (StorageResource directoryContent : directoryContents) { for (StorageResource directoryContent : directoryContents) {
sshKeyResources.add(from(directoryContent)); keyResources.add(from(directoryContent));
} }
} }
@Override @Override
public List<SSHKeyResource> getDirectoryContents() { public List<KeyResource> getDirectoryContents() {
return sshKeyResources; return keyResources;
} }
public static BaseSSHKeyResource from(final StorageResource source) { public static BaseKeyResource from(final StorageResource source) {
final BaseSSHKeyResource baseSshKeyResource = new BaseSSHKeyResource(); final BaseKeyResource baseSshKeyResource = new BaseKeyResource();
baseSshKeyResource.setDirectory(source.isDirectory()); baseSshKeyResource.setDirectory(source.isDirectory());
baseSshKeyResource.setPath(source.getPath()); baseSshKeyResource.setPath(source.getPath());
baseSshKeyResource.setName(source.getName()); baseSshKeyResource.setName(source.getName());
@ -51,7 +48,7 @@ public class BaseSSHKeyResource extends BaseStorageResource implements SSHKeyRes
if (!baseSshKeyResource.isDirectory()) { if (!baseSshKeyResource.isDirectory()) {
baseSshKeyResource.setPrivateKey( baseSshKeyResource.setPrivateKey(
null != baseSshKeyResource.getMetadata() && "private".equals(baseSshKeyResource.getMetadata().get null != baseSshKeyResource.getMetadata() && "private".equals(baseSshKeyResource.getMetadata().get
("Rundeck-ssh-key-type")) ("Rundeck-key-type"))
); );
} else if (null != source.getDirectoryContents()) { } else if (null != source.getDirectoryContents()) {
baseSshKeyResource.setDirectoryContents(source.getDirectoryContents()); baseSshKeyResource.setDirectoryContents(source.getDirectoryContents());

View file

@ -3,12 +3,12 @@ package org.rundeck.api.domain;
import java.util.List; import java.util.List;
/** /**
* SSHKeyResource represents a directory or an SSH key file * KeyResource represents a directory or an SSH key file
* *
* @author Greg Schueler <greg@simplifyops.com> * @author Greg Schueler <greg@simplifyops.com>
* @since 2014-04-04 * @since 2014-04-04
*/ */
public interface SSHKeyResource extends StorageResource { public interface KeyResource extends StorageResource {
/** /**
* Return true if this is a file and is a private SSH key file. * Return true if this is a file and is a private SSH key file.
* @return * @return
@ -19,5 +19,5 @@ public interface SSHKeyResource extends StorageResource {
* Return the list of SSH Key resources if this is a directory * Return the list of SSH Key resources if this is a directory
* @return * @return
*/ */
public List<SSHKeyResource> getDirectoryContents(); public List<KeyResource> getDirectoryContents();
} }

View file

@ -1,9 +1,8 @@
package org.rundeck.api.parser; package org.rundeck.api.parser;
import org.dom4j.Node; import org.dom4j.Node;
import org.rundeck.api.RundeckClient; import org.rundeck.api.domain.BaseKeyResource;
import org.rundeck.api.domain.BaseSSHKeyResource; import org.rundeck.api.domain.KeyResource;
import org.rundeck.api.domain.SSHKeyResource;
/** /**
* SSHKeyResourceParser is ... * SSHKeyResourceParser is ...
@ -11,7 +10,7 @@ import org.rundeck.api.domain.SSHKeyResource;
* @author Greg Schueler <greg@simplifyops.com> * @author Greg Schueler <greg@simplifyops.com>
* @since 2014-04-04 * @since 2014-04-04
*/ */
public class SSHKeyResourceParser extends BaseXpathParser<SSHKeyResource> implements XmlNodeParser<SSHKeyResource> { public class SSHKeyResourceParser extends BaseXpathParser<KeyResource> implements XmlNodeParser<KeyResource> {
public SSHKeyResourceParser() { public SSHKeyResourceParser() {
} }
@ -20,7 +19,7 @@ public class SSHKeyResourceParser extends BaseXpathParser<SSHKeyResource> implem
} }
@Override @Override
public SSHKeyResource parse(Node node) { public KeyResource parse(Node node) {
return BaseSSHKeyResource.from(new StorageResourceParser().parse(node)); return BaseKeyResource.from(new StorageResourceParser().parse(node));
} }
} }

View file

@ -1284,8 +1284,8 @@ public class RundeckClientTest {
* Store ssh key * Store ssh key
*/ */
@Test @Test
@Betamax(tape = "ssh_key_store_private", mode = TapeMode.READ_ONLY) @Betamax(tape = "key_store_private", mode = TapeMode.READ_ONLY)
public void storeSshKey_private() throws Exception { public void storeKey_private() throws Exception {
final RundeckClient client = createClient(TEST_TOKEN_7, 11); final RundeckClient client = createClient(TEST_TOKEN_7, 11);
File temp = File.createTempFile("test-key", ".tmp"); File temp = File.createTempFile("test-key", ".tmp");
temp.deleteOnExit(); temp.deleteOnExit();
@ -1295,26 +1295,26 @@ public class RundeckClientTest {
}finally { }finally {
out.close(); out.close();
} }
SSHKeyResource storageResource = client.storeSshKey("ssh-key/test/example/file1.pem", temp, true); KeyResource storageResource = client.storeKey("keys/test/example/file1.pem", temp, true);
Assert.assertNotNull(storageResource); Assert.assertNotNull(storageResource);
Assert.assertFalse(storageResource.isDirectory()); Assert.assertFalse(storageResource.isDirectory());
Assert.assertTrue(storageResource.isPrivateKey()); Assert.assertTrue(storageResource.isPrivateKey());
Assert.assertEquals("file1.pem", storageResource.getName()); Assert.assertEquals("file1.pem", storageResource.getName());
Assert.assertEquals("ssh-key/test/example/file1.pem", storageResource.getPath()); Assert.assertEquals("keys/test/example/file1.pem", storageResource.getPath());
Assert.assertEquals("http://dignan.local:4440/api/11/storage/ssh-key/test/example/file1.pem", Assert.assertEquals("http://dignan.local:4440/api/11/storage/keys/test/example/file1.pem",
storageResource.getUrl()); storageResource.getUrl());
Assert.assertEquals(0, storageResource.getDirectoryContents().size()); Assert.assertEquals(0, storageResource.getDirectoryContents().size());
Map<String, String> metadata = storageResource.getMetadata(); Map<String, String> metadata = storageResource.getMetadata();
Assert.assertNotNull(metadata); Assert.assertNotNull(metadata);
Assert.assertEquals("application/octet-stream", metadata.get("Rundeck-content-type")); Assert.assertEquals("application/octet-stream", metadata.get("Rundeck-content-type"));
Assert.assertEquals("private", metadata.get("Rundeck-ssh-key-type")); Assert.assertEquals("private", metadata.get("Rundeck-key-type"));
} }
/** /**
* Store ssh key * Store ssh key
*/ */
@Test @Test
@Betamax(tape = "ssh_key_store_public", mode = TapeMode.READ_ONLY) @Betamax(tape = "key_store_public", mode = TapeMode.READ_ONLY)
public void storeSshKey_public() throws Exception { public void storeKey_public() throws Exception {
final RundeckClient client = createClient(TEST_TOKEN_7, 11); final RundeckClient client = createClient(TEST_TOKEN_7, 11);
File temp = File.createTempFile("test-key", ".tmp"); File temp = File.createTempFile("test-key", ".tmp");
temp.deleteOnExit(); temp.deleteOnExit();
@ -1324,76 +1324,76 @@ public class RundeckClientTest {
}finally { }finally {
out.close(); out.close();
} }
SSHKeyResource storageResource = client.storeSshKey("ssh-key/test/example/file2.pub", temp, false); KeyResource storageResource = client.storeKey("keys/test/example/file2.pub", temp, false);
Assert.assertNotNull(storageResource); Assert.assertNotNull(storageResource);
Assert.assertFalse(storageResource.isDirectory()); Assert.assertFalse(storageResource.isDirectory());
Assert.assertFalse(storageResource.isPrivateKey()); Assert.assertFalse(storageResource.isPrivateKey());
Assert.assertEquals("file2.pub", storageResource.getName()); Assert.assertEquals("file2.pub", storageResource.getName());
Assert.assertEquals("ssh-key/test/example/file2.pub", storageResource.getPath()); Assert.assertEquals("keys/test/example/file2.pub", storageResource.getPath());
Assert.assertEquals("http://dignan.local:4440/api/11/storage/ssh-key/test/example/file2.pub", Assert.assertEquals("http://dignan.local:4440/api/11/storage/keys/test/example/file2.pub",
storageResource.getUrl()); storageResource.getUrl());
Assert.assertEquals(0, storageResource.getDirectoryContents().size()); Assert.assertEquals(0, storageResource.getDirectoryContents().size());
Map<String, String> metadata = storageResource.getMetadata(); Map<String, String> metadata = storageResource.getMetadata();
Assert.assertNotNull(metadata); Assert.assertNotNull(metadata);
Assert.assertEquals("application/pgp-keys", metadata.get("Rundeck-content-type")); Assert.assertEquals("application/pgp-keys", metadata.get("Rundeck-content-type"));
Assert.assertEquals("public", metadata.get("Rundeck-ssh-key-type")); Assert.assertEquals("public", metadata.get("Rundeck-key-type"));
} }
/** /**
* get ssh key * get ssh key
*/ */
@Test @Test
@Betamax(tape = "ssh_key_get_public", mode = TapeMode.READ_ONLY) @Betamax(tape = "key_get_public", mode = TapeMode.READ_ONLY)
public void getSshKey_public() throws Exception { public void getKey_public() throws Exception {
final RundeckClient client = createClient(TEST_TOKEN_7, 11); final RundeckClient client = createClient(TEST_TOKEN_7, 11);
SSHKeyResource storageResource = client.getSshKey("ssh-key/test/example/file2.pub"); KeyResource storageResource = client.getKey("keys/test/example/file2.pub");
Assert.assertNotNull(storageResource); Assert.assertNotNull(storageResource);
Assert.assertFalse(storageResource.isDirectory()); Assert.assertFalse(storageResource.isDirectory());
Assert.assertFalse(storageResource.isPrivateKey()); Assert.assertFalse(storageResource.isPrivateKey());
Assert.assertEquals("file2.pub", storageResource.getName()); Assert.assertEquals("file2.pub", storageResource.getName());
Assert.assertEquals("ssh-key/test/example/file2.pub", storageResource.getPath()); Assert.assertEquals("keys/test/example/file2.pub", storageResource.getPath());
Assert.assertEquals("http://dignan.local:4440/api/11/storage/ssh-key/test/example/file2.pub", Assert.assertEquals("http://dignan.local:4440/api/11/storage/keys/test/example/file2.pub",
storageResource.getUrl()); storageResource.getUrl());
Assert.assertEquals(0, storageResource.getDirectoryContents().size()); Assert.assertEquals(0, storageResource.getDirectoryContents().size());
Map<String, String> metadata = storageResource.getMetadata(); Map<String, String> metadata = storageResource.getMetadata();
Assert.assertNotNull(metadata); Assert.assertNotNull(metadata);
Assert.assertEquals("application/pgp-keys", metadata.get("Rundeck-content-type")); Assert.assertEquals("application/pgp-keys", metadata.get("Rundeck-content-type"));
Assert.assertEquals("public", metadata.get("Rundeck-ssh-key-type")); Assert.assertEquals("public", metadata.get("Rundeck-key-type"));
} }
/** /**
* get ssh key * get ssh key
*/ */
@Test @Test
@Betamax(tape = "ssh_key_get_private", mode = TapeMode.READ_ONLY) @Betamax(tape = "key_get_private", mode = TapeMode.READ_ONLY)
public void getSshKey_private() throws Exception { public void getKey_private() throws Exception {
final RundeckClient client = createClient(TEST_TOKEN_7, 11); final RundeckClient client = createClient(TEST_TOKEN_7, 11);
SSHKeyResource storageResource = client.getSshKey("ssh-key/test/example/file1.pem"); KeyResource storageResource = client.getKey("keys/test/example/file1.pem");
Assert.assertNotNull(storageResource); Assert.assertNotNull(storageResource);
Assert.assertFalse(storageResource.isDirectory()); Assert.assertFalse(storageResource.isDirectory());
Assert.assertTrue(storageResource.isPrivateKey()); Assert.assertTrue(storageResource.isPrivateKey());
Assert.assertEquals("file1.pem", storageResource.getName()); Assert.assertEquals("file1.pem", storageResource.getName());
Assert.assertEquals("ssh-key/test/example/file1.pem", storageResource.getPath()); Assert.assertEquals("keys/test/example/file1.pem", storageResource.getPath());
Assert.assertEquals("http://dignan.local:4440/api/11/storage/ssh-key/test/example/file1.pem", Assert.assertEquals("http://dignan.local:4440/api/11/storage/keys/test/example/file1.pem",
storageResource.getUrl()); storageResource.getUrl());
Assert.assertEquals(0, storageResource.getDirectoryContents().size()); Assert.assertEquals(0, storageResource.getDirectoryContents().size());
Map<String, String> metadata = storageResource.getMetadata(); Map<String, String> metadata = storageResource.getMetadata();
Assert.assertNotNull(metadata); Assert.assertNotNull(metadata);
Assert.assertEquals("application/octet-stream", metadata.get("Rundeck-content-type")); Assert.assertEquals("application/octet-stream", metadata.get("Rundeck-content-type"));
Assert.assertEquals("private", metadata.get("Rundeck-ssh-key-type")); Assert.assertEquals("private", metadata.get("Rundeck-key-type"));
} }
/** /**
* get ssh key data * get ssh key data
*/ */
@Test @Test
@Betamax(tape = "ssh_key_get_data_private", mode = TapeMode.READ_ONLY) @Betamax(tape = "key_get_data_private", mode = TapeMode.READ_ONLY)
public void getSshKeyData_private() throws Exception { public void getKeyData_private() throws Exception {
final RundeckClient client = createClient(TEST_TOKEN_7, 11); final RundeckClient client = createClient(TEST_TOKEN_7, 11);
File temp = File.createTempFile("test-key", ".tmp"); File temp = File.createTempFile("test-key", ".tmp");
temp.deleteOnExit(); temp.deleteOnExit();
try { try {
int data = client.getPublicSshKeyContent("ssh-key/test/example/file1.pem", temp); int data = client.getPublicKeyContent("keys/test/example/file1.pem", temp);
Assert.fail("expected failure"); Assert.fail("expected failure");
} catch (RundeckApiException e) { } catch (RundeckApiException e) {
Assert.assertEquals("Requested SSH Key path was not a Public key: ssh-key/test/example/file1.pem", Assert.assertEquals("Requested Key path was not a Public key: keys/test/example/file1.pem",
e.getMessage()); e.getMessage());
} }
} }
@ -1401,72 +1401,72 @@ public class RundeckClientTest {
* get ssh key data * get ssh key data
*/ */
@Test @Test
@Betamax(tape = "ssh_key_get_data_public", mode = TapeMode.READ_ONLY) @Betamax(tape = "key_get_data_public", mode = TapeMode.READ_ONLY)
public void getSshKeyData_public() throws Exception { public void getKeyData_public() throws Exception {
final RundeckClient client = createClient(TEST_TOKEN_7, 11); final RundeckClient client = createClient(TEST_TOKEN_7, 11);
File temp = File.createTempFile("test-key", ".tmp"); File temp = File.createTempFile("test-key", ".tmp");
temp.deleteOnExit(); temp.deleteOnExit();
int length = client.getPublicSshKeyContent("ssh-key/test/example/file2.pub", temp); int length = client.getPublicKeyContent("keys/test/example/file2.pub", temp);
Assert.assertEquals(5, length); Assert.assertEquals(5, length);
} }
/** /**
* list directory * list directory
*/ */
@Test @Test
@Betamax(tape = "ssh_key_list_directory", mode = TapeMode.READ_ONLY) @Betamax(tape = "key_list_directory", mode = TapeMode.READ_ONLY)
public void listSshKeyDirectory() throws Exception { public void listKeyDirectory() throws Exception {
final RundeckClient client = createClient(TEST_TOKEN_7, 11); final RundeckClient client = createClient(TEST_TOKEN_7, 11);
List<SSHKeyResource> list = client.listSshKeyDirectory("ssh-key/test/example"); List<KeyResource> list = client.listKeyDirectory("keys/test/example");
Assert.assertEquals(2, list.size()); Assert.assertEquals(2, list.size());
SSHKeyResource storageResource1 = list.get(0); KeyResource storageResource1 = list.get(0);
SSHKeyResource storageResource2 = list.get(1); KeyResource storageResource2 = list.get(1);
Assert.assertFalse(storageResource2.isDirectory()); Assert.assertFalse(storageResource2.isDirectory());
Assert.assertTrue(storageResource2.isPrivateKey()); Assert.assertTrue(storageResource2.isPrivateKey());
Assert.assertEquals("file1.pem", storageResource2.getName()); Assert.assertEquals("file1.pem", storageResource2.getName());
Assert.assertEquals("ssh-key/test/example/file1.pem", storageResource2.getPath()); Assert.assertEquals("keys/test/example/file1.pem", storageResource2.getPath());
Assert.assertEquals("http://dignan.local:4440/api/11/storage/ssh-key/test/example/file1.pem", storageResource2.getUrl()); Assert.assertEquals("http://dignan.local:4440/api/11/storage/keys/test/example/file1.pem", storageResource2.getUrl());
Assert.assertNotNull(storageResource2.getMetadata()); Assert.assertNotNull(storageResource2.getMetadata());
Assert.assertEquals("application/octet-stream", storageResource2.getMetadata().get("Rundeck-content-type")); Assert.assertEquals("application/octet-stream", storageResource2.getMetadata().get("Rundeck-content-type"));
Assert.assertEquals("private", storageResource2.getMetadata().get("Rundeck-ssh-key-type")); Assert.assertEquals("private", storageResource2.getMetadata().get("Rundeck-key-type"));
Assert.assertFalse(storageResource1.isDirectory()); Assert.assertFalse(storageResource1.isDirectory());
Assert.assertFalse(storageResource1.isPrivateKey()); Assert.assertFalse(storageResource1.isPrivateKey());
Assert.assertEquals("file2.pub", storageResource1.getName()); Assert.assertEquals("file2.pub", storageResource1.getName());
Assert.assertEquals("ssh-key/test/example/file2.pub", storageResource1.getPath()); Assert.assertEquals("keys/test/example/file2.pub", storageResource1.getPath());
Assert.assertEquals("http://dignan.local:4440/api/11/storage/ssh-key/test/example/file2.pub", Assert.assertEquals("http://dignan.local:4440/api/11/storage/keys/test/example/file2.pub",
storageResource1.getUrl()); storageResource1.getUrl());
Assert.assertNotNull(storageResource1.getMetadata()); Assert.assertNotNull(storageResource1.getMetadata());
Assert.assertEquals("application/pgp-keys", storageResource1.getMetadata().get("Rundeck-content-type")); Assert.assertEquals("application/pgp-keys", storageResource1.getMetadata().get("Rundeck-content-type"));
Assert.assertEquals("public", storageResource1.getMetadata().get("Rundeck-ssh-key-type")); Assert.assertEquals("public", storageResource1.getMetadata().get("Rundeck-key-type"));
} }
/** /**
* list root * list root
*/ */
@Test @Test
@Betamax(tape = "ssh_key_list_root", mode = TapeMode.READ_ONLY) @Betamax(tape = "key_list_root", mode = TapeMode.READ_ONLY)
public void listSshKeyDirectoryRoot() throws Exception { public void listKeyDirectoryRoot() throws Exception {
final RundeckClient client = createClient(TEST_TOKEN_7, 11); final RundeckClient client = createClient(TEST_TOKEN_7, 11);
List<SSHKeyResource> list = client.listSshKeyDirectoryRoot(); List<KeyResource> list = client.listKeyDirectoryRoot();
Assert.assertEquals(2, list.size()); Assert.assertEquals(2, list.size());
SSHKeyResource storageResource0 = list.get(0); KeyResource storageResource0 = list.get(0);
SSHKeyResource storageResource1 = list.get(1); KeyResource storageResource1 = list.get(1);
Assert.assertFalse(storageResource0.isDirectory()); Assert.assertFalse(storageResource0.isDirectory());
Assert.assertTrue(storageResource0.isPrivateKey()); Assert.assertTrue(storageResource0.isPrivateKey());
Assert.assertEquals("test1.pem", storageResource0.getName()); Assert.assertEquals("test1.pem", storageResource0.getName());
Assert.assertEquals("ssh-key/test1.pem", storageResource0.getPath()); Assert.assertEquals("keys/test1.pem", storageResource0.getPath());
Assert.assertEquals("http://dignan.local:4440/api/11/storage/ssh-key/test1.pem", storageResource0.getUrl()); Assert.assertEquals("http://dignan.local:4440/api/11/storage/keys/test1.pem", storageResource0.getUrl());
Assert.assertNotNull(storageResource0.getMetadata()); Assert.assertNotNull(storageResource0.getMetadata());
Assert.assertEquals("application/octet-stream", storageResource0.getMetadata().get("Rundeck-content-type")); Assert.assertEquals("application/octet-stream", storageResource0.getMetadata().get("Rundeck-content-type"));
Assert.assertEquals("private", storageResource0.getMetadata().get("Rundeck-ssh-key-type")); Assert.assertEquals("private", storageResource0.getMetadata().get("Rundeck-key-type"));
Assert.assertTrue(storageResource1.toString(), storageResource1.isDirectory()); Assert.assertTrue(storageResource1.toString(), storageResource1.isDirectory());
Assert.assertEquals(null, storageResource1.getName()); Assert.assertEquals(null, storageResource1.getName());
Assert.assertEquals("ssh-key/test", storageResource1.getPath()); Assert.assertEquals("keys/test", storageResource1.getPath());
Assert.assertEquals("http://dignan.local:4440/api/11/storage/ssh-key/test", Assert.assertEquals("http://dignan.local:4440/api/11/storage/keys/test",
storageResource1.getUrl()); storageResource1.getUrl());
Assert.assertNull(storageResource1.getMetadata()); Assert.assertNull(storageResource1.getMetadata());
@ -1477,13 +1477,13 @@ public class RundeckClientTest {
* delete ssh key * delete ssh key
*/ */
@Test @Test
@Betamax(tape = "ssh_key_delete", mode = TapeMode.READ_ONLY) @Betamax(tape = "key_delete", mode = TapeMode.READ_ONLY)
public void deleteSshKey() throws Exception { public void deleteKey() throws Exception {
final RundeckClient client = createClient(TEST_TOKEN_7, 11); final RundeckClient client = createClient(TEST_TOKEN_7, 11);
client.deleteSshKey("ssh-key/test/example/file2.pub"); client.deleteKey("keys/test/example/file2.pub");
try { try {
client.getSshKey("ssh-key/test/example/file2.pub"); client.getKey("keys/test/example/file2.pub");
Assert.fail("expected failure"); Assert.fail("expected failure");
} catch (RundeckApiException.RundeckApiHttpStatusException e) { } catch (RundeckApiException.RundeckApiHttpStatusException e) {
Assert.assertEquals(404,e.getStatusCode()); Assert.assertEquals(404,e.getStatusCode());

View file

@ -4,7 +4,7 @@ interactions:
- recorded: 2014-04-04T23:16:02.256Z - recorded: 2014-04-04T23:16:02.256Z
request: request:
method: DELETE method: DELETE
uri: http://rundeck.local:4440/api/11/storage/ssh-key/test/example/file2.pub uri: http://rundeck.local:4440/api/11/storage/keys/test/example/file2.pub
headers: headers:
Host: rundeck.local:4440 Host: rundeck.local:4440
Proxy-Connection: Keep-Alive Proxy-Connection: Keep-Alive
@ -20,7 +20,7 @@ interactions:
- recorded: 2014-04-04T23:16:02.372Z - recorded: 2014-04-04T23:16:02.372Z
request: request:
method: GET method: GET
uri: http://rundeck.local:4440/api/11/storage/ssh-key/test/example/file2.pub uri: http://rundeck.local:4440/api/11/storage/keys/test/example/file2.pub
headers: headers:
Accept: text/xml Accept: text/xml
Host: rundeck.local:4440 Host: rundeck.local:4440

View file

@ -4,7 +4,7 @@ interactions:
- recorded: 2014-04-04T19:50:59.155Z - recorded: 2014-04-04T19:50:59.155Z
request: request:
method: GET method: GET
uri: http://rundeck.local:4440/api/11/storage/ssh-key/test/example/file1.pem uri: http://rundeck.local:4440/api/11/storage/keys/test/example/file1.pem
headers: headers:
Accept: application/pgp-keys Accept: application/pgp-keys
Host: rundeck.local:4440 Host: rundeck.local:4440
@ -19,4 +19,5 @@ interactions:
Server: Jetty(7.6.0.v20120127) Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=1gzu37lkjr0fitxhf5fgkgsfu;Path=/ Set-Cookie: JSESSIONID=1gzu37lkjr0fitxhf5fgkgsfu;Path=/
body: !!binary |- body: !!binary |-
eyJwYXRoIjoic3NoLWtleS90ZXN0L2V4YW1wbGUvZmlsZTEucGVtIiwidHlwZSI6ImZpbGUiLCJuYW1lIjoiZmlsZTEucGVtIiwidXJsIjoiaHR0cDovL2RpZ25hbi5sb2NhbDo0NDQwL2FwaS8xMS9zdG9yYWdlL3NzaC1rZXkvdGVzdC9leGFtcGxlL2ZpbGUxLnBlbSIsIm1ldGEiOnsiUnVuZGVjay1jb250ZW50LXR5cGUiOiJhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0iLCJSdW5kZWNrLWNvbnRlbnQtc2l6ZSI6IjUiLCJSdW5kZWNrLWNvbnRlbnQtbWFzayI6ImNvbnRlbnQiLCJSdW5kZWNrLXNzaC1rZXktdHlwZSI6InByaXZhdGUifX0= eyJwYXRoIjoia2V5cy90ZXN0L2V4YW1wbGUvZmlsZTEucGVtIiwidHlwZSI6ImZpbGUiLCJuYW1lIjoiZmlsZTEucGVtIiwidXJsIjoiaHR0cDovL2RpZ25hbi5sb2NhbDo0NDQwL2FwaS8xMS9zdG9yYWdlL2tleXMvdGVzdC9leGFtcGxlL2ZpbGUxLnBlbSIsIm1ldGEiOnsiUnVuZGVjay1jb250ZW50LXR5cGUiOiJhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0iLCJSdW5kZWNrLWNvbnRlbnQtc2l6ZSI6IjUiLCJSdW5kZWNrLWNvbnRlbnQtbWFzayI6ImNvbnRlbnQiLCJSdW5kZWNrLWtleS10eXBlIjoicHJpdmF0ZSJ9fQo=

View file

@ -4,7 +4,7 @@ interactions:
- recorded: 2014-04-04T20:20:44.331Z - recorded: 2014-04-04T20:20:44.331Z
request: request:
method: GET method: GET
uri: http://rundeck.local:4440/api/11/storage/ssh-key/test/example/file2.pub uri: http://rundeck.local:4440/api/11/storage/keys/test/example/file2.pub
headers: headers:
Accept: application/pgp-keys Accept: application/pgp-keys
Host: rundeck.local:4440 Host: rundeck.local:4440

View file

@ -0,0 +1,23 @@
!tape
name: ssh_key_get_private
interactions:
- recorded: 2014-04-04T19:47:29.880Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/storage/keys/test/example/file1.pem
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: application/xml;charset=utf-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=nc5p0he3nw19e4gegidc4bs7;Path=/
body: !!binary |-
PHJlc291cmNlIHBhdGg9J2tleXMvdGVzdC9leGFtcGxlL2ZpbGUxLnBlbScgdHlwZT0nZmlsZScgdXJsPSdodHRwOi8vZGlnbmFuLmxvY2FsOjQ0NDAvYXBpLzExL3N0b3JhZ2Uva2V5cy90ZXN0L2V4YW1wbGUvZmlsZTEucGVtJyBuYW1lPSdmaWxlMS5wZW0nPjxyZXNvdXJjZS1tZXRhPjxSdW5kZWNrLWNvbnRlbnQtdHlwZT5hcHBsaWNhdGlvbi9vY3RldC1zdHJlYW08L1J1bmRlY2stY29udGVudC10eXBlPjxSdW5kZWNrLWNvbnRlbnQtc2l6ZT41PC9SdW5kZWNrLWNvbnRlbnQtc2l6ZT48UnVuZGVjay1jb250ZW50LW1hc2s+Y29udGVudDwvUnVuZGVjay1jb250ZW50LW1hc2s+PFJ1bmRlY2sta2V5LXR5cGU+cHJpdmF0ZTwvUnVuZGVjay1rZXktdHlwZT48L3Jlc291cmNlLW1ldGE+PC9yZXNvdXJjZT4K

View file

@ -4,7 +4,7 @@ interactions:
- recorded: 2014-04-04T19:47:29.626Z - recorded: 2014-04-04T19:47:29.626Z
request: request:
method: GET method: GET
uri: http://rundeck.local:4440/api/11/storage/ssh-key/test/example/file2.pub uri: http://rundeck.local:4440/api/11/storage/keys/test/example/file2.pub
headers: headers:
Accept: text/xml Accept: text/xml
Host: rundeck.local:4440 Host: rundeck.local:4440
@ -19,4 +19,5 @@ interactions:
Server: Jetty(7.6.0.v20120127) Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=r6p6fl87ftrb1mkwwi0pcak5i;Path=/ Set-Cookie: JSESSIONID=r6p6fl87ftrb1mkwwi0pcak5i;Path=/
body: !!binary |- body: !!binary |-
PHJlc291cmNlIHBhdGg9J3NzaC1rZXkvdGVzdC9leGFtcGxlL2ZpbGUyLnB1YicgdHlwZT0nZmlsZScgdXJsPSdodHRwOi8vZGlnbmFuLmxvY2FsOjQ0NDAvYXBpLzExL3N0b3JhZ2Uvc3NoLWtleS90ZXN0L2V4YW1wbGUvZmlsZTIucHViJyBuYW1lPSdmaWxlMi5wdWInPjxyZXNvdXJjZS1tZXRhPjxSdW5kZWNrLWNvbnRlbnQtdHlwZT5hcHBsaWNhdGlvbi9wZ3Ata2V5czwvUnVuZGVjay1jb250ZW50LXR5cGU+PFJ1bmRlY2stY29udGVudC1zaXplPjU8L1J1bmRlY2stY29udGVudC1zaXplPjxSdW5kZWNrLXNzaC1rZXktdHlwZT5wdWJsaWM8L1J1bmRlY2stc3NoLWtleS10eXBlPjwvcmVzb3VyY2UtbWV0YT48L3Jlc291cmNlPg== PHJlc291cmNlIHBhdGg9J2tleXMvdGVzdC9leGFtcGxlL2ZpbGUyLnB1YicgdHlwZT0nZmlsZScgdXJsPSdodHRwOi8vZGlnbmFuLmxvY2FsOjQ0NDAvYXBpLzExL3N0b3JhZ2Uva2V5cy90ZXN0L2V4YW1wbGUvZmlsZTIucHViJyBuYW1lPSdmaWxlMi5wdWInPjxyZXNvdXJjZS1tZXRhPjxSdW5kZWNrLWNvbnRlbnQtdHlwZT5hcHBsaWNhdGlvbi9wZ3Ata2V5czwvUnVuZGVjay1jb250ZW50LXR5cGU+PFJ1bmRlY2stY29udGVudC1zaXplPjU8L1J1bmRlY2stY29udGVudC1zaXplPjxSdW5kZWNrLWtleS10eXBlPnB1YmxpYzwvUnVuZGVjay1rZXktdHlwZT48L3Jlc291cmNlLW1ldGE+PC9yZXNvdXJjZT4N

View file

@ -0,0 +1,21 @@
!tape
name: key_list_directory
interactions:
- recorded: 2014-04-04T20:33:07.968Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/storage/keys/test/example
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/html;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=1stwtoatsosy91ca0gcrzde698;Path=/
body: <resource path='keys/test/example' type='directory' url='http://dignan.local:4440/api/11/storage/keys/test/example'><contents count='2'><resource path='keys/test/example/file2.pub' type='file' url='http://dignan.local:4440/api/11/storage/keys/test/example/file2.pub' name='file2.pub'><resource-meta><Rundeck-content-type>application/pgp-keys</Rundeck-content-type><Rundeck-content-size>5</Rundeck-content-size><Rundeck-key-type>public</Rundeck-key-type></resource-meta></resource><resource path='keys/test/example/file1.pem' type='file' url='http://dignan.local:4440/api/11/storage/keys/test/example/file1.pem' name='file1.pem'><resource-meta><Rundeck-content-type>application/octet-stream</Rundeck-content-type><Rundeck-content-size>5</Rundeck-content-size><Rundeck-content-mask>content</Rundeck-content-mask><Rundeck-key-type>private</Rundeck-key-type></resource-meta></resource></contents></resource>

View file

@ -0,0 +1,21 @@
!tape
name: key_list_root
interactions:
- recorded: 2014-04-04T20:41:16.501Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/storage/keys/
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/html;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=5sj36vytg4y1182mziim4868b;Path=/
body: <resource path='keys' type='directory' url='http://dignan.local:4440/api/11/storage/keys'><contents count='2'><resource path='keys/test1.pem' type='file' url='http://dignan.local:4440/api/11/storage/keys/test1.pem' name='test1.pem'><resource-meta><Rundeck-content-type>application/octet-stream</Rundeck-content-type><Rundeck-content-size>1679</Rundeck-content-size><Rundeck-content-mask>content</Rundeck-content-mask><Rundeck-key-type>private</Rundeck-key-type></resource-meta></resource><resource path='keys/test' type='directory' url='http://dignan.local:4440/api/11/storage/keys/test'></resource></contents></resource>

View file

@ -4,7 +4,7 @@ interactions:
- recorded: 2014-04-04T19:30:35.367Z - recorded: 2014-04-04T19:30:35.367Z
request: request:
method: POST method: POST
uri: http://rundeck.local:4440/api/11/storage/ssh-key/test/example/file1.pem uri: http://rundeck.local:4440/api/11/storage/keys/test/example/file1.pem
headers: headers:
Accept: text/xml Accept: text/xml
Content-Length: '5' Content-Length: '5'
@ -22,4 +22,5 @@ interactions:
Server: Jetty(7.6.0.v20120127) Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=ktmwc4h53xfud6v2ch67x5p9;Path=/ Set-Cookie: JSESSIONID=ktmwc4h53xfud6v2ch67x5p9;Path=/
body: !!binary |- body: !!binary |-
PHJlc291cmNlIHBhdGg9J3NzaC1rZXkvdGVzdC9leGFtcGxlL2ZpbGUxLnBlbScgdHlwZT0nZmlsZScgdXJsPSdodHRwOi8vZGlnbmFuLmxvY2FsOjQ0NDAvYXBpLzExL3N0b3JhZ2Uvc3NoLWtleS90ZXN0L2V4YW1wbGUvZmlsZTEucGVtJyBuYW1lPSdmaWxlMS5wZW0nPjxyZXNvdXJjZS1tZXRhPjxSdW5kZWNrLWNvbnRlbnQtdHlwZT5hcHBsaWNhdGlvbi9vY3RldC1zdHJlYW08L1J1bmRlY2stY29udGVudC10eXBlPjxSdW5kZWNrLWNvbnRlbnQtc2l6ZT41PC9SdW5kZWNrLWNvbnRlbnQtc2l6ZT48UnVuZGVjay1jb250ZW50LW1hc2s+Y29udGVudDwvUnVuZGVjay1jb250ZW50LW1hc2s+PFJ1bmRlY2stc3NoLWtleS10eXBlPnByaXZhdGU8L1J1bmRlY2stc3NoLWtleS10eXBlPjwvcmVzb3VyY2UtbWV0YT48L3Jlc291cmNlPg== PHJlc291cmNlIHBhdGg9J2tleXMvdGVzdC9leGFtcGxlL2ZpbGUxLnBlbScgdHlwZT0nZmlsZScgdXJsPSdodHRwOi8vZGlnbmFuLmxvY2FsOjQ0NDAvYXBpLzExL3N0b3JhZ2Uva2V5cy90ZXN0L2V4YW1wbGUvZmlsZTEucGVtJyBuYW1lPSdmaWxlMS5wZW0nPjxyZXNvdXJjZS1tZXRhPjxSdW5kZWNrLWNvbnRlbnQtdHlwZT5hcHBsaWNhdGlvbi9vY3RldC1zdHJlYW08L1J1bmRlY2stY29udGVudC10eXBlPjxSdW5kZWNrLWNvbnRlbnQtc2l6ZT41PC9SdW5kZWNrLWNvbnRlbnQtc2l6ZT48UnVuZGVjay1jb250ZW50LW1hc2s+Y29udGVudDwvUnVuZGVjay1jb250ZW50LW1hc2s+PFJ1bmRlY2sta2V5LXR5cGU+cHJpdmF0ZTwvUnVuZGVjay1rZXktdHlwZT48L3Jlc291cmNlLW1ldGE+PC9yZXNvdXJjZT4N

View file

@ -4,7 +4,7 @@ interactions:
- recorded: 2014-04-04T19:34:02.683Z - recorded: 2014-04-04T19:34:02.683Z
request: request:
method: POST method: POST
uri: http://rundeck.local:4440/api/11/storage/ssh-key/test/example/file2.pub uri: http://rundeck.local:4440/api/11/storage/keys/test/example/file2.pub
headers: headers:
Accept: text/xml Accept: text/xml
Content-Length: '5' Content-Length: '5'
@ -22,4 +22,5 @@ interactions:
Server: Jetty(7.6.0.v20120127) Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=2l3g8m0tvwef19jn2bu23bzk6;Path=/ Set-Cookie: JSESSIONID=2l3g8m0tvwef19jn2bu23bzk6;Path=/
body: !!binary |- body: !!binary |-
PHJlc291cmNlIHBhdGg9J3NzaC1rZXkvdGVzdC9leGFtcGxlL2ZpbGUyLnB1YicgdHlwZT0nZmlsZScgdXJsPSdodHRwOi8vZGlnbmFuLmxvY2FsOjQ0NDAvYXBpLzExL3N0b3JhZ2Uvc3NoLWtleS90ZXN0L2V4YW1wbGUvZmlsZTIucHViJyBuYW1lPSdmaWxlMi5wdWInPjxyZXNvdXJjZS1tZXRhPjxSdW5kZWNrLWNvbnRlbnQtdHlwZT5hcHBsaWNhdGlvbi9wZ3Ata2V5czwvUnVuZGVjay1jb250ZW50LXR5cGU+PFJ1bmRlY2stY29udGVudC1zaXplPjU8L1J1bmRlY2stY29udGVudC1zaXplPjxSdW5kZWNrLXNzaC1rZXktdHlwZT5wdWJsaWM8L1J1bmRlY2stc3NoLWtleS10eXBlPjwvcmVzb3VyY2UtbWV0YT48L3Jlc291cmNlPg== PHJlc291cmNlIHBhdGg9J2tleXMvdGVzdC9leGFtcGxlL2ZpbGUyLnB1YicgdHlwZT0nZmlsZScgdXJsPSdodHRwOi8vZGlnbmFuLmxvY2FsOjQ0NDAvYXBpLzExL3N0b3JhZ2Uva2V5cy90ZXN0L2V4YW1wbGUvZmlsZTIucHViJyBuYW1lPSdmaWxlMi5wdWInPjxyZXNvdXJjZS1tZXRhPjxSdW5kZWNrLWNvbnRlbnQtdHlwZT5hcHBsaWNhdGlvbi9wZ3Ata2V5czwvUnVuZGVjay1jb250ZW50LXR5cGU+PFJ1bmRlY2stY29udGVudC1zaXplPjU8L1J1bmRlY2stY29udGVudC1zaXplPjxSdW5kZWNrLWtleS10eXBlPnB1YmxpYzwvUnVuZGVjay1rZXktdHlwZT48L3Jlc291cmNlLW1ldGE+PC9yZXNvdXJjZT4K

View file

@ -1,22 +0,0 @@
!tape
name: ssh_key_get_private
interactions:
- recorded: 2014-04-04T19:47:29.880Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/storage/ssh-key/test/example/file1.pem
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: application/xml;charset=utf-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=nc5p0he3nw19e4gegidc4bs7;Path=/
body: !!binary |-
PHJlc291cmNlIHBhdGg9J3NzaC1rZXkvdGVzdC9leGFtcGxlL2ZpbGUxLnBlbScgdHlwZT0nZmlsZScgdXJsPSdodHRwOi8vZGlnbmFuLmxvY2FsOjQ0NDAvYXBpLzExL3N0b3JhZ2Uvc3NoLWtleS90ZXN0L2V4YW1wbGUvZmlsZTEucGVtJyBuYW1lPSdmaWxlMS5wZW0nPjxyZXNvdXJjZS1tZXRhPjxSdW5kZWNrLWNvbnRlbnQtdHlwZT5hcHBsaWNhdGlvbi9vY3RldC1zdHJlYW08L1J1bmRlY2stY29udGVudC10eXBlPjxSdW5kZWNrLWNvbnRlbnQtc2l6ZT41PC9SdW5kZWNrLWNvbnRlbnQtc2l6ZT48UnVuZGVjay1jb250ZW50LW1hc2s+Y29udGVudDwvUnVuZGVjay1jb250ZW50LW1hc2s+PFJ1bmRlY2stc3NoLWtleS10eXBlPnByaXZhdGU8L1J1bmRlY2stc3NoLWtleS10eXBlPjwvcmVzb3VyY2UtbWV0YT48L3Jlc291cmNlPg==

View file

@ -1,21 +0,0 @@
!tape
name: ssh_key_list_directory
interactions:
- recorded: 2014-04-04T20:33:07.968Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/storage/ssh-key/test/example
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/html;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=1stwtoatsosy91ca0gcrzde698;Path=/
body: <resource path='ssh-key/test/example' type='directory' url='http://dignan.local:4440/api/11/storage/ssh-key/test/example'><contents count='2'><resource path='ssh-key/test/example/file2.pub' type='file' url='http://dignan.local:4440/api/11/storage/ssh-key/test/example/file2.pub' name='file2.pub'><resource-meta><Rundeck-content-type>application/pgp-keys</Rundeck-content-type><Rundeck-content-size>5</Rundeck-content-size><Rundeck-ssh-key-type>public</Rundeck-ssh-key-type></resource-meta></resource><resource path='ssh-key/test/example/file1.pem' type='file' url='http://dignan.local:4440/api/11/storage/ssh-key/test/example/file1.pem' name='file1.pem'><resource-meta><Rundeck-content-type>application/octet-stream</Rundeck-content-type><Rundeck-content-size>5</Rundeck-content-size><Rundeck-content-mask>content</Rundeck-content-mask><Rundeck-ssh-key-type>private</Rundeck-ssh-key-type></resource-meta></resource></contents></resource>

View file

@ -1,21 +0,0 @@
!tape
name: ssh_key_list_root
interactions:
- recorded: 2014-04-04T20:41:16.501Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/storage/ssh-key/
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/html;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=5sj36vytg4y1182mziim4868b;Path=/
body: <resource path='ssh-key' type='directory' url='http://dignan.local:4440/api/11/storage/ssh-key'><contents count='2'><resource path='ssh-key/test1.pem' type='file' url='http://dignan.local:4440/api/11/storage/ssh-key/test1.pem' name='test1.pem'><resource-meta><Rundeck-content-type>application/octet-stream</Rundeck-content-type><Rundeck-content-size>1679</Rundeck-content-size><Rundeck-content-mask>content</Rundeck-content-mask><Rundeck-ssh-key-type>private</Rundeck-ssh-key-type></resource-meta></resource><resource path='ssh-key/test' type='directory' url='http://dignan.local:4440/api/11/storage/ssh-key/test'></resource></contents></resource>