Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ knitreadme.sh
^.*\.Rproj$
^\.Rproj\.user$
^\.github.?
^LICENSE\.md$
^README\.Rmd$
^cran-comments\.md$
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
.Rproj.user
.Rhistory
.RData
aws.s3.Rproj
aws.lambda.Rproj
9 changes: 3 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ matrix:
dist: trusty
sudo: required
env: DRAT_DEPLOY=true
- os: osx
osx_image: xcode9.2
- os: osx
osx_image: xcode7.3
r_build_args: "--no-build-vignettes"
r_check_args: "--ignore-vignettes --no-examples"
# Travis is currently broken for macos R so disable
# - os: osx
# osx_image: xcode9.2
r_packages:
- covr
- drat
Expand Down
23 changes: 15 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
Package: aws.lambda
Type: Package
Title: AWS Lambda Client Package
Version: 0.1.6
Date: 2017-07-01
Authors@R: c(person("Thomas J.", "Leeper", role = c("aut"),
Version: 0.2.0
Authors@R: c(
person("Thomas J.", "Leeper", role = c("aut"),
email = "thosjleeper@gmail.com",
comment = c(ORCID = "0000-0003-4097-6326")))
Maintainer: ORPHANED
Description: A simple client package for the Amazon Web Services ('AWS') Lambda 'API' <https://aws.amazon.com/lambda/>.
License: GPL (>= 2)
comment = c(ORCID = "0000-0003-4097-6326")),
person("Jon", "Harmon", role = c("ctb", "cre"),
email = "jonthegeek@gmail.com",
comment = c(ORCID = "0000-0003-4781-4346"))
)
Description: A simple client package for the Amazon Web Services ('AWS') Lambda
API <https://aws.amazon.com/lambda/>.
Encoding: UTF-8
LazyData: true
Depends: R (>= 3.4)
License: GPL-3
Imports:
utils,
httr,
Expand All @@ -21,4 +28,4 @@ Suggests:
aws.iam
URL: https://github.com/cloudyr/aws.lambda
BugReports: https://github.com/cloudyr/aws.lambda/issues
RoxygenNote: 6.0.1
RoxygenNote: 7.1.0
595 changes: 595 additions & 0 deletions LICENSE.md

Large diffs are not rendered by default.

16 changes: 13 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,22 @@ export(list_function_aliases)
export(list_function_versions)
export(list_functions)
export(make_function_version)
export(publish_function_version)
export(update_function)
export(update_function_alias)
import(httr)
export(update_function_code)
export(update_function_config)
importFrom(aws.signature,locate_credentials)
importFrom(aws.signature,signature_v4_auth)
importFrom(base64enc,base64encode)
importFrom(jsonlite,fromJSON)
importFrom(httr,DELETE)
importFrom(httr,GET)
importFrom(httr,POST)
importFrom(httr,PUT)
importFrom(httr,add_headers)
importFrom(httr,content)
importFrom(httr,headers)
importFrom(httr,http_error)
importFrom(httr,stop_for_status)
importFrom(jsonlite,toJSON)
importFrom(utils,str)
importFrom(utils,zip)
17 changes: 12 additions & 5 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
# CHANGES TO aws.lambda 0.1.6
# aws.lambda 0.1.6.9000

* New maintainer (@jonthegeek).
* Updated license to GPL-3.
* Deprecated `update_function()` in favor of `update_function_code()` and `update_function_config()`.
* Deprecated `make_function_version()` in favor of `publish_function_version()`.

# aws.lambda 0.1.6

* Change `get_account()` to `get_lambda_account()` to avoid namespace conflict with **aws.iam.**

# CHANGES TO aws.lambda 0.1.4
# aws.lambda 0.1.4

* Bump **aws.signature** dependency to 0.3.4.

# CHANGES TO aws.lambda 0.1.3
# aws.lambda 0.1.3

* Rename alias-related functions to avoid namespace clash with aws.iam.

# CHANGES TO aws.lambda 0.1.2
# aws.lambda 0.1.2

* Update code and documentation.

# CHANGES TO aws.lambda 0.1.1
# aws.lambda 0.1.1

* Initial release.
6 changes: 3 additions & 3 deletions R/account.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#' @return A list.
#' @examples
#' \dontrun{
#' get_lambda_account()
#' get_lambda_account()
#' }
#' @export
get_lambda_account <- function(...) {
act <- paste0("/2016-08-19/account-settings")
lambdaHTTP(verb = "GET", action = act, ...)
act <- paste0("/2016-08-19/account-settings")
lambdaHTTP(verb = "GET", action = act, ...)
}
103 changes: 70 additions & 33 deletions R/aliases.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,100 @@
#' @description List, create, update, and delete function aliases
#' @template name
#' @param alias A character string specifying a function alias
#' @param description Optionally, a max 256-character description of the function for your own use.
#' @param version A character string specifying a function version
#' @param version A character string specifying a function version to associate
#' with this alias.
#' @param description Optionally, a max 256-character description of the
#' function for your own use.
#' @param marker A pagination marker from a previous request.
#' @param n An integer specifying the number of results to return.
#' @template dots
#' @return An object of class \dQuote{aws_lambda_function}.
#' @details \code{list_functions} lists all functions. \code{get_function} retrieves a specific function and \code{get_function_versions} retrieves all versions of that function. \code{get_function_configuration} returns the configuration details used when creating or updating the function. \code{delete_function} deletes a function, if you have permission to do so.
#' @details \code{create_function_alias} creates a new function alias for a
#' given version of a function. \code{update_function_alias} updates the
#' association between a function alias and the function version.
#' \code{list_function_aliases} lists all function aliases.
#' \code{get_function_alias} retrieves a specific function alias.
#' \code{delete_function_alias} deletes a function alias, but not the
#' associated function version.
#' @references
#' \href{http://docs.aws.amazon.com/lambda/latest/dg/API_GetAlias.html}{API Reference: GetAlias}
#' \href{http://docs.aws.amazon.com/lambda/latest/dg/API_CreateAlias.html}{API Reference: CreateAlias}
#' \href{http://docs.aws.amazon.com/lambda/latest/dg/API_UpdateAlias.html}{API Reference: UpdateAlias}
#' \href{http://docs.aws.amazon.com/lambda/latest/dg/API_DeleteAlias.html}{API Reference: DeleteAlias}
#' \href{http://docs.aws.amazon.com/lambda/latest/dg/API_ListAliases.html}{API Reference: ListAliases}
#' \href{https://docs.aws.amazon.com/lambda/latest/dg/API_GetAlias.html}{API
#' Reference: GetAlias}
#' \href{https://docs.aws.amazon.com/lambda/latest/dg/API_CreateAlias.html}{API
#' Reference: CreateAlias}
#' \href{https://docs.aws.amazon.com/lambda/latest/dg/API_UpdateAlias.html}{API
#' Reference: UpdateAlias}
#' \href{https://docs.aws.amazon.com/lambda/latest/dg/API_DeleteAlias.html}{API
#' Reference: DeleteAlias}
#' \href{https://docs.aws.amazon.com/lambda/latest/dg/API_ListAliases.html}{API
#' Reference: ListAliases}
#' @seealso \code{\link{create_function}}, \code{\link{list_functions}}
#' @export
create_function_alias <- function(name, alias, description, version, ...) {
name <- get_function_name(name)
act <- paste0("/2015-03-31/functions/", name, "/aliases")
b <- list(Description = description, FunctionVersion = version, Name = alias)
r <- lambdaHTTP(verb = "POST", action = act, body = b, ...)
return(r)
create_function_alias <- function(name, alias, version, description, ...) {
name <- get_function_name(name)
act <- paste0("/2015-03-31/functions/", name, "/aliases")
b <- list(FunctionVersion = version, Name = alias)
# Description is optional.
if (!missing(description)) {
b[["Description"]] <- description
}
r <- lambdaHTTP(verb = "POST", action = act, body = b, ...)
return(r)
}

#' @rdname alias
#' @export
update_function_alias <- function(name, alias, description, version, ...) {
name <- get_function_name(name)
act <- paste0("/2015-03-31/functions/", name, "/aliases/", alias)
b <- list(Description = description, FunctionVersion = version)
r <- lambdaHTTP(verb = "PUT", action = act, body = b, ...)
return(r)
update_function_alias <- function(name, alias, version, description, ...) {
name <- get_function_name(name)
act <- paste0("/2015-03-31/functions/", name, "/aliases/", alias)
b <- list()
if (!missing(version)) {
b[["FunctionVersion"]] <- version
}
if (!missing(description)) {
b[["Description"]] <- description
}
r <- lambdaHTTP(verb = "PUT", action = act, body = b, ...)
return(r)
}

#' @rdname alias
#' @export
delete_function_alias <- function(name, alias, ...) {
name <- get_function_name(name)
act <- paste0("/2015-03-31/functions/", name, "/aliases/", alias)
r <- lambdaHTTP(verb = "DELETE", action = act, ...)
return(r)
name <- get_function_name(name)
act <- paste0("/2015-03-31/functions/", name, "/aliases/", alias)
r <- lambdaHTTP(verb = "DELETE", action = act, ...)
return(r)
}

#' @rdname alias
#' @export
get_function_alias <- function(name, alias, ...) {
name <- get_function_name(name)
act <- paste0("/2015-03-31/functions/", name, "/aliases/", alias)
r <- lambdaHTTP(verb = "GET", action = act, ...)
return(r)
name <- get_function_name(name)
act <- paste0("/2015-03-31/functions/", name, "/aliases/", alias)
r <- lambdaHTTP(verb = "GET", action = act, ...)
return(r)
}

#' @rdname alias
#' @export
list_function_aliases <- function(name, version, marker, n, ...) {
name <- get_function_name(name)
act <- paste0("/2015-03-31/functions/", name, "/aliases")
query <- list(FunctionVersion = version, Marker = marker, MaxItems = n)
r <- lambdaHTTP(verb = "GET", action = act, query = query, ...)
return(r)
name <- get_function_name(name)
act <- paste0("/2015-03-31/functions/", name, "/aliases")
query <- list()
if (!missing(version)) {
warning(
"The AWS API erroneously returns an empty list when version is specified",
" if you only have one alias.",
"\n You may want to try again without specifying a version."
)
query[["FunctionVersion"]] <- version
}
if (!missing(marker)) {
query[["Marker"]] <- marker
}
if (!missing(n)) {
query[["MaxItems"]] <- n
}
r <- lambdaHTTP(verb = "GET", action = act, query = query, ...)
return(r)
}
Loading