Cloud Management API 1.5

Repositories

A Repository is a location from which you can download and import design objects such as Chef cookbooks. Using this resource you can add and modify repository information and import assets discovered in the repository.

RightScale currently supports the following types of repositores: git, svn, and URLs of compressed files (tar, tgz, gzip).

Actions

index

Lists all Repositories for this Account.

URLs
GET /api/repositories
HTTP response code
200 OK
Content-type
application/vnd.rightscale.repository;type=collection

Required roles

Parameters

name required type values regexp blank? description
filter no Array * * no See below for valid filter parameters.
view no String default, extended * no Specifies how many attributes and/or expanded nested relationships to include.

Filters

name partial_match? description
description yes Description of the Repositories to filter on.
name yes Name of the Repositories to filter on.

Example Responses

Click on a format below to see an example response for the 'default' view:

JSON XML
[{
  "id": "1",
  "source_type": "git",
  "created_at": "2023/10/09 11:06:02 +0000",
  "updated_at": "2023/10/09 11:06:02 +0000",
  "asset_paths": {
    "cookbooks": null
  },
  "fetch_status": {
  },
  "credentials": {
    "ssh_key": null
  },
  "read_only": false,
  "links": [
    {"rel":"self","href":"/api/repositories/1"},
    {"rel":"repository_assets","href":"/api/repositories/1/repository_assets"}
  ],
  "actions": [
    {
      "rel": "cookbook_import_preview"
    },
    {
      "rel": "cookbook_import"
    },
    {
      "rel": "refetch"
    },
    {
      "rel": "resolve"
    }
  ],
  "name": "cookbook_repo_3347459063",
  "source": "git://host42502.com/repo11346.git"
},{
  "id": "2",
  "source_type": "git",
  "created_at": "2023/10/09 11:06:03 +0000",
  "updated_at": "2023/10/09 11:06:03 +0000",
  "asset_paths": {
    "cookbooks": null
  },
  "fetch_status": {
  },
  "credentials": {
    "ssh_key": null
  },
  "read_only": false,
  "links": [
    {"rel":"self","href":"/api/repositories/2"},
    {"rel":"repository_assets","href":"/api/repositories/2/repository_assets"}
  ],
  "actions": [
    {
      "rel": "cookbook_import_preview"
    },
    {
      "rel": "cookbook_import"
    },
    {
      "rel": "refetch"
    },
    {
      "rel": "resolve"
    }
  ],
  "name": "cookbook_repo_781352256",
  "source": "git://host44270.com/repo7280.git"
}]
<?xml version="1.0" encoding="UTF-8"?>
<repositories>
  <repository>
    <id>1</id>
    <source_type>git</source_type>
    <created_at>2023/10/09 11:06:02 +0000</created_at>
    <updated_at>2023/10/09 11:06:02 +0000</updated_at>
    <asset_paths>
      <cookbooks/>
    </asset_paths>
    <fetch_status/>
    <credentials>
      <ssh_key/>
    </credentials>
    <read_only>false</read_only>
    <links>
      <link rel="self" href="/api/repositories/1"/>
      <link rel="repository_assets" href="/api/repositories/1/repository_assets"/>
    </links>
    <actions>
      <action rel="cookbook_import_preview"/>
      <action rel="cookbook_import"/>
      <action rel="refetch"/>
      <action rel="resolve"/>
    </actions>
    <name>cookbook_repo_3347459063</name>
    <source>git://host42502.com/repo11346.git</source>
  </repository>
  <repository>
    <id>2</id>
    <source_type>git</source_type>
    <created_at>2023/10/09 11:06:03 +0000</created_at>
    <updated_at>2023/10/09 11:06:03 +0000</updated_at>
    <asset_paths>
      <cookbooks/>
    </asset_paths>
    <fetch_status/>
    <credentials>
      <ssh_key/>
    </credentials>
    <read_only>false</read_only>
    <links>
      <link rel="self" href="/api/repositories/2"/>
      <link rel="repository_assets" href="/api/repositories/2/repository_assets"/>
    </links>
    <actions>
      <action rel="cookbook_import_preview"/>
      <action rel="cookbook_import"/>
      <action rel="refetch"/>
      <action rel="resolve"/>
    </actions>
    <name>cookbook_repo_781352256</name>
    <source>git://host44270.com/repo7280.git</source>
  </repository>
</repositories>

Click on a format below to see an example response for the 'extended' view:

JSON XML
[{
  "id": "1",
  "source_type": "git",
  "created_at": "2023/10/09 11:06:02 +0000",
  "updated_at": "2023/10/09 11:06:02 +0000",
  "asset_paths": {
    "cookbooks": null
  },
  "fetch_status": {
  },
  "credentials": {
    "ssh_key": null
  },
  "read_only": false,
  "links": [
    {"rel":"self","href":"/api/repositories/1"},
    {"rel":"repository_assets","href":"/api/repositories/1/repository_assets"}
  ],
  "actions": [
    {
      "rel": "cookbook_import_preview"
    },
    {
      "rel": "cookbook_import"
    },
    {
      "rel": "refetch"
    },
    {
      "rel": "resolve"
    }
  ],
  "name": "cookbook_repo_3347459063",
  "source": "git://host42502.com/repo11346.git",
  "asset_counts": {
    "cookbooks": 1
  }
},{
  "id": "2",
  "source_type": "git",
  "created_at": "2023/10/09 11:06:03 +0000",
  "updated_at": "2023/10/09 11:06:03 +0000",
  "asset_paths": {
    "cookbooks": null
  },
  "fetch_status": {
  },
  "credentials": {
    "ssh_key": null
  },
  "read_only": false,
  "links": [
    {"rel":"self","href":"/api/repositories/2"},
    {"rel":"repository_assets","href":"/api/repositories/2/repository_assets"}
  ],
  "actions": [
    {
      "rel": "cookbook_import_preview"
    },
    {
      "rel": "cookbook_import"
    },
    {
      "rel": "refetch"
    },
    {
      "rel": "resolve"
    }
  ],
  "name": "cookbook_repo_781352256",
  "source": "git://host44270.com/repo7280.git",
  "asset_counts": {
    "cookbooks": 1
  }
}]
<?xml version="1.0" encoding="UTF-8"?>
<repositories>
  <repository>
    <id>1</id>
    <source_type>git</source_type>
    <created_at>2023/10/09 11:06:02 +0000</created_at>
    <updated_at>2023/10/09 11:06:02 +0000</updated_at>
    <asset_paths>
      <cookbooks/>
    </asset_paths>
    <fetch_status/>
    <credentials>
      <ssh_key/>
    </credentials>
    <read_only>false</read_only>
    <links>
      <link rel="self" href="/api/repositories/1"/>
      <link rel="repository_assets" href="/api/repositories/1/repository_assets"/>
    </links>
    <actions>
      <action rel="cookbook_import_preview"/>
      <action rel="cookbook_import"/>
      <action rel="refetch"/>
      <action rel="resolve"/>
    </actions>
    <name>cookbook_repo_3347459063</name>
    <source>git://host42502.com/repo11346.git</source>
    <asset_counts>
      <cookbooks>1</cookbooks>
    </asset_counts>
  </repository>
  <repository>
    <id>2</id>
    <source_type>git</source_type>
    <created_at>2023/10/09 11:06:03 +0000</created_at>
    <updated_at>2023/10/09 11:06:03 +0000</updated_at>
    <asset_paths>
      <cookbooks/>
    </asset_paths>
    <fetch_status/>
    <credentials>
      <ssh_key/>
    </credentials>
    <read_only>false</read_only>
    <links>
      <link rel="self" href="/api/repositories/2"/>
      <link rel="repository_assets" href="/api/repositories/2/repository_assets"/>
    </links>
    <actions>
      <action rel="cookbook_import_preview"/>
      <action rel="cookbook_import"/>
      <action rel="refetch"/>
      <action rel="resolve"/>
    </actions>
    <name>cookbook_repo_781352256</name>
    <source>git://host44270.com/repo7280.git</source>
    <asset_counts>
      <cookbooks>1</cookbooks>
    </asset_counts>
  </repository>
</repositories>

show

Shows a specified Repository.

URLs
GET /api/repositories/:id
HTTP response code
200 OK
Content-type
application/vnd.rightscale.repository

Required roles

Parameters

name required type values regexp blank? description
view no String default, extended * no Specifies how many attributes and/or expanded nested relationships to include.

Example Responses

Click on a format below to see an example response for the 'default' view:

JSON XML
{
  "id": "1",
  "source_type": "git",
  "created_at": "2023/10/09 11:06:02 +0000",
  "updated_at": "2023/10/09 11:06:02 +0000",
  "asset_paths": {
    "cookbooks": null
  },
  "fetch_status": {
  },
  "credentials": {
    "ssh_key": null
  },
  "read_only": false,
  "links": [
    {"rel":"self","href":"/api/repositories/1"},
    {"rel":"repository_assets","href":"/api/repositories/1/repository_assets"}
  ],
  "actions": [
    {
      "rel": "cookbook_import_preview"
    },
    {
      "rel": "cookbook_import"
    },
    {
      "rel": "refetch"
    },
    {
      "rel": "resolve"
    }
  ],
  "name": "cookbook_repo_3347459063",
  "source": "git://host42502.com/repo11346.git"
}
<?xml version="1.0" encoding="UTF-8"?>
<repository>
  <id>1</id>
  <source_type>git</source_type>
  <created_at>2023/10/09 11:06:02 +0000</created_at>
  <updated_at>2023/10/09 11:06:02 +0000</updated_at>
  <asset_paths>
    <cookbooks/>
  </asset_paths>
  <fetch_status/>
  <credentials>
    <ssh_key/>
  </credentials>
  <read_only>false</read_only>
  <links>
    <link rel="self" href="/api/repositories/1"/>
    <link rel="repository_assets" href="/api/repositories/1/repository_assets"/>
  </links>
  <actions>
    <action rel="cookbook_import_preview"/>
    <action rel="cookbook_import"/>
    <action rel="refetch"/>
    <action rel="resolve"/>
  </actions>
  <name>cookbook_repo_3347459063</name>
  <source>git://host42502.com/repo11346.git</source>
</repository>

Click on a format below to see an example response for the 'extended' view:

JSON XML
{
  "id": "1",
  "source_type": "git",
  "created_at": "2023/10/09 11:06:02 +0000",
  "updated_at": "2023/10/09 11:06:02 +0000",
  "asset_paths": {
    "cookbooks": null
  },
  "fetch_status": {
  },
  "credentials": {
    "ssh_key": null
  },
  "read_only": false,
  "links": [
    {"rel":"self","href":"/api/repositories/1"},
    {"rel":"repository_assets","href":"/api/repositories/1/repository_assets"}
  ],
  "actions": [
    {
      "rel": "cookbook_import_preview"
    },
    {
      "rel": "cookbook_import"
    },
    {
      "rel": "refetch"
    },
    {
      "rel": "resolve"
    }
  ],
  "name": "cookbook_repo_3347459063",
  "source": "git://host42502.com/repo11346.git",
  "asset_counts": {
    "cookbooks": 1
  }
}
<?xml version="1.0" encoding="UTF-8"?>
<repository>
  <id>1</id>
  <source_type>git</source_type>
  <created_at>2023/10/09 11:06:02 +0000</created_at>
  <updated_at>2023/10/09 11:06:02 +0000</updated_at>
  <asset_paths>
    <cookbooks/>
  </asset_paths>
  <fetch_status/>
  <credentials>
    <ssh_key/>
  </credentials>
  <read_only>false</read_only>
  <links>
    <link rel="self" href="/api/repositories/1"/>
    <link rel="repository_assets" href="/api/repositories/1/repository_assets"/>
  </links>
  <actions>
    <action rel="cookbook_import_preview"/>
    <action rel="cookbook_import"/>
    <action rel="refetch"/>
    <action rel="resolve"/>
  </actions>
  <name>cookbook_repo_3347459063</name>
  <source>git://host42502.com/repo11346.git</source>
  <asset_counts>
    <cookbooks>1</cookbooks>
  </asset_counts>
</repository>

create

Creates a Repository.

The following types of inputs are supported for the credential fields:

Type Format Example(s)
Text string text:<value> text:-----BEGIN RSA PRIVATE KEY-----
text:secret
Credential value cred:<value> cred:my ssh key
cred:svn_1_password

URLs
POST /api/repositories
HTTP response code
201 Created
Location
Href of the created Repository

Required roles

Parameters

name required type values regexp blank? description
repository yes Hash * * no
repository[asset_paths] no Hash * * no
repository[asset_paths][cookbooks] no Array * * yes The cookbook paths for the repository
repository[auto_import] no String true, false * no Whether cookbooks should automatically be imported upon repository creation.
repository[commit_reference] no String * * yes The revision for the repository
repository[credentials] no Hash * * no
repository[credentials][password] no String * (cred:.+|text:.*) no The password, or credential, for the repository (only valid for svn or download repositories).
repository[credentials][ssh_key] no String * (cred:.+|text:.*) no The SSH key, or credential, for the repository (only valid for git repositories).
repository[credentials][username] no String * (cred:.+|text:.*) no The user name, or credential, for the repository (only valid for svn or download repositories).
repository[description] no String * * yes The description for the repository.
repository[name] yes String * * no The repository name.
repository[source] yes String * * no The URL for the repository.
repository[source_type] yes String git, svn, download * no The source type for the repository.

update

Updates a specified Repository.

The following types of inputs are supported for the credential fields:

Type Format Example(s)
Text string text:<value> text:-----BEGIN RSA PRIVATE KEY-----
text:secret
Credential value cred:<value> cred:my ssh key
cred:svn_1_password

URLs
PUT /api/repositories/:id
HTTP response code
204 No Content

Required roles

Parameters

name required type values regexp blank? description
repository yes Hash * * no
repository[asset_paths] no Hash * * no
repository[asset_paths][cookbooks] no Array * * yes The updated cookbook paths for the repository
repository[commit_reference] no String * * yes The updated commit reference (tag, branch, revision...) for the repository
repository[credentials] no Hash * * no
repository[credentials][password] no String * (cred:.+|text:.*) no The updated password, or credential, for the repository (only valid for svn or download repositories).
repository[credentials][ssh_key] no String * (cred:.+|text:.*) no The updated SSH key for the repository (only valid for git repositories).
repository[credentials][username] no String * (cred:.+|text:.*) no The updated user name, or credential, for the repository (only valid for svn or download repositories).
repository[description] no String * * yes The updated description for the repository.
repository[name] no String * * no The updated repository name.
repository[source] no String * * no The updated URL for the repository.
repository[source_type] no String git, svn, download * no The updated source type for the repository.

destroy

Deletes the specified Repositories.

URLs
DELETE /api/repositories/:id
HTTP response code
204 No Content

Required roles

cookbook_import

Performs a Cookbook import, which allows you to use the specified cookbooks in your design objects.

URLs
POST /api/repositories/:id/cookbook_import
HTTP response code
204 No Content

Required roles

Parameters

name required type values regexp blank? description
asset_hrefs yes Array * * no Hrefs of the assets that should be imported.
follow no String true, false * no A flag indicating whether imported cookbooks should be followed.
namespace no String primary, alternate * no The namespace to import into.
repository_commit_reference no String * * no Optional commit reference indicating last succeeded commit. Must match the Repository's fetch_status.succeeded_commit attribute or the import will not be performed.
with_dependencies no String true, false * no A flag indicating whether dependencies should automatically be imported.

cookbook_import_preview

Retrieves a preview of the effects of a Cookbook import.

NOTE: This action is for RightScale internal use only. The response is free-form JSON with no associated mediatype.

DO NOT USE, THIS ACTION IS SUBJECT TO CHANGE AT ANYTIME.

URLs
POST /api/repositories/:id/cookbook_import_preview
HTTP response code
200 OK
Content-type
application/vnd.rightscale.import_preview;type=collection

Required roles

Parameters

name required type values regexp blank? description
asset_hrefs yes Array * * no Hrefs of the assets that should be imported.
namespace yes String primary, alternate * no The namespace to import into.

refetch

Refetches all RepositoryAssets associated with the Repository. Note that a refetch simply updates RightScale's view of the contents of the repository. You must perform an import to use the assets in your design objects (or use the auto import parameter).

URLs
POST /api/repositories/:id/refetch
HTTP response code
204 No Content

Required roles

Parameters

name required type values regexp blank? description
auto_import no String true, false * no Whether cookbooks should automatically be imported after repositories are fetched.

resolve

Show a list of repositories that have imported cookbooks with the given names.

This operation returns a list of repositories that would later satisfy a call to the swap_repository action on a ServerTemplate.

URLs
POST /api/repositories/resolve
HTTP response code
200 OK
Content-type
application/vnd.rightscale.repository;type=collection

Required roles

Parameters

name required type values regexp blank? description
imported_cookbook_name no Array * * no A list of cookbook names that were imported by the repository.

Example Responses

Click on a format below to see an example response:

JSON XML
[{
  "id": "1",
  "source_type": "git",
  "created_at": "2023/10/09 11:06:02 +0000",
  "updated_at": "2023/10/09 11:06:02 +0000",
  "asset_paths": {
    "cookbooks": null
  },
  "fetch_status": {
  },
  "credentials": {
    "ssh_key": null
  },
  "read_only": false,
  "links": [
    {"rel":"self","href":"/api/repositories/1"},
    {"rel":"repository_assets","href":"/api/repositories/1/repository_assets"}
  ],
  "actions": [
    {
      "rel": "cookbook_import_preview"
    },
    {
      "rel": "cookbook_import"
    },
    {
      "rel": "refetch"
    },
    {
      "rel": "resolve"
    }
  ],
  "name": "cookbook_repo_3347459063",
  "source": "git://host42502.com/repo11346.git"
},{
  "id": "2",
  "source_type": "git",
  "created_at": "2023/10/09 11:06:03 +0000",
  "updated_at": "2023/10/09 11:06:03 +0000",
  "asset_paths": {
    "cookbooks": null
  },
  "fetch_status": {
  },
  "credentials": {
    "ssh_key": null
  },
  "read_only": false,
  "links": [
    {"rel":"self","href":"/api/repositories/2"},
    {"rel":"repository_assets","href":"/api/repositories/2/repository_assets"}
  ],
  "actions": [
    {
      "rel": "cookbook_import_preview"
    },
    {
      "rel": "cookbook_import"
    },
    {
      "rel": "refetch"
    },
    {
      "rel": "resolve"
    }
  ],
  "name": "cookbook_repo_781352256",
  "source": "git://host44270.com/repo7280.git"
}]
<?xml version="1.0" encoding="UTF-8"?>
<repositories>
  <repository>
    <id>1</id>
    <source_type>git</source_type>
    <created_at>2023/10/09 11:06:02 +0000</created_at>
    <updated_at>2023/10/09 11:06:02 +0000</updated_at>
    <asset_paths>
      <cookbooks/>
    </asset_paths>
    <fetch_status/>
    <credentials>
      <ssh_key/>
    </credentials>
    <read_only>false</read_only>
    <links>
      <link rel="self" href="/api/repositories/1"/>
      <link rel="repository_assets" href="/api/repositories/1/repository_assets"/>
    </links>
    <actions>
      <action rel="cookbook_import_preview"/>
      <action rel="cookbook_import"/>
      <action rel="refetch"/>
      <action rel="resolve"/>
    </actions>
    <name>cookbook_repo_3347459063</name>
    <source>git://host42502.com/repo11346.git</source>
  </repository>
  <repository>
    <id>2</id>
    <source_type>git</source_type>
    <created_at>2023/10/09 11:06:03 +0000</created_at>
    <updated_at>2023/10/09 11:06:03 +0000</updated_at>
    <asset_paths>
      <cookbooks/>
    </asset_paths>
    <fetch_status/>
    <credentials>
      <ssh_key/>
    </credentials>
    <read_only>false</read_only>
    <links>
      <link rel="self" href="/api/repositories/2"/>
      <link rel="repository_assets" href="/api/repositories/2/repository_assets"/>
    </links>
    <actions>
      <action rel="cookbook_import_preview"/>
      <action rel="cookbook_import"/>
      <action rel="refetch"/>
      <action rel="resolve"/>
    </actions>
    <name>cookbook_repo_781352256</name>
    <source>git://host44270.com/repo7280.git</source>
  </repository>
</repositories>