Created
August 13, 2022 11:01
-
-
Save nturaga/e29f4e6462993356cbe63a9b5af76542 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setGeneric("cloud_cp", function(x, ...) standardGeneric("cloud_cp")) | |
cloud_rm <- function(x, ...) | |
UseMethod("cloud_rm") | |
cloud_rsync <- function(x, ...) | |
UseMethod("cloud_rsync") | |
## azure | |
setClass("Cloud") | |
AzureCloud <- setClass("AzureCloud", contains = "Cloud") | |
setMethod("cloud_cp", "AzureCloud", function(x, from, to, ...) { | |
## implement cp for Azure | |
} | |
google_cloud <- function() | |
structure(list(), class = c("gcloud", "cloud")) | |
cloud_cp.google_cloud <- function(x, from, to, ...) { | |
AnVIL::gsutil_cp(from, to, ...) | |
} | |
## package code | |
kube_run <- function(cloud_id, ...) { | |
cloud <- switch( | |
cloud_id, | |
azure = azure_cloud(), | |
google = google_cloud() | |
) | |
... | |
cloud_cp(cloud, ....) | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment