-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Download
resource
#622
Comments
Possible resource instance schema (non-exclusive) type: object
required: [sourceUri, targetFolder]
dependentRequired:
clientKeyPath: [clientCertPath]
properties:
sourceUri:
description: The URI to download the file from.
type: string
format: uri
writeOnly: true
targetDirectory:
description: The folder to download the file to.
type: string
format: directoryPath
targetFileName:
description: >-
The name of the file after downloading. Defaults to
the base name of the URI on the remote server.
type: string
checksum:
description: >-
Defines the checksum algorithm and value to validate
the downloaded file against, raising an error if the
checksums don't match.
type: object
minProperties: 1
maxProperties: 1
properties:
sha256: { type: string }
sha512: { type: string }
# others as appropriate
clientCertPath:
description: >-
Defines the path to the PEM-formatted certificate to
use for SSL client authentication. If the certificate
includes the key, the `clientKeyPath` property isn't
required. If the certificate doesn't include the key
and the `clientKeyPath` property isn't specified, the
resource raises an error.
type: string
format: filePath
writeOnly: true
clientKeyPath:
description: >-
Defines the path to the PEM-formatted file containing the
private key to use for SSL client authentication. This
property requires the `clientCertPath` property. If the
certificate specified by the `clientCertPath` property
includes the key, this property isn't required.
type: string
format: filePath
writeOnly: true
headers:
description: >-
Defines a set of custom HTTP headers for the HTTP request by
key-value for each property of this object.
type: object
writeOnly: true
httpAgent:
description: >-
Defines the user agent header to identify the HTTP request.
Defaults to `dsc-resource-download/1.0`.
type: string
default: dsc-resource-download
writeOnly: true
timeOutSeconds:
description: >-
Defines the timeout for the HTTP get operation in seconds.
Defaults to `600` seconds. A timeout of `0` disables the
timeout check.
type: integer
minimum: 0
maximum: 65535
default: 600
writeOnly: true
_clobber:
$ref: https://aka.ms/dsc/canonical_properties/clobber.json |
I think initially we just need sufficient and secure capability for known scenarios and not end up with |
I do think that this resource is a useful example of one that could benefit from Proposal: Extended Resources (#611) - especially for setting the attributes, mode, group, etc for the downloaded file, without requiring a user to specify a series of resources or fully reimplement the functionality of multiple resources in this one. Edit: It's also a resource that other resources would benefit from extending (e.g. specific handling for downloading and munging some file or just providing useful defaults/friendly interface over a specific download). For example, I might want to download, extract, and define the permissions/group for a file: resources:
- name: Get foo from archive
type: Microsoft.Dsc/Download
properties:
sourceUri: https://archive.tailspintoys.com/foo.tar.gz
targetDirectory: /opt/tools
expand: true
mode: 0755
group: myGroup I think the MVP for this resource does not include convenience features like expanding archives or managing the file permissions/attributes/etc, only the download operation. Any improvements can be iteratively delivered (and those resources themselves don't exist yet). |
100% agree that expanding an archive makes sense without the need to use a separate resource since it would be pretty common operation. This probably also means by default if expanded the archive file is deleted (we can add a property to explicitly preserve it if there's a real use case for that). Then there's the question of whether we need to validate the hash of the file (which would have been the responsibility of a
I wonder if perhaps one way to reconcile the overlap between |
Summary of the new feature / enhancement
A resource that allows downloading file(s) from web. Would need security aspects including authn and maybe even validating the server. Proxy might be needed as well.
Proposed technical implementation details (optional)
No response
The text was updated successfully, but these errors were encountered: