AmplifyGen3 / Client / get_file
get_file¶
- AmplifyGen3.Client.get_file(**kwargs)¶
Gets the contents of a file from a repository branch. Files can be up to 1 MiB. The AWS Management Console uses this operation when you create an app from a repository. To view files in detail, use your Git provider.
See also: AWS API Documentation
Request Syntax
response = client.get_file( Provider='GITHUB'|'GITLAB', Owner='string', RepositoryName='string', RepositoryPath='string', FilePath='string', Branch='string' )
- Parameters:
Provider (string) –
[REQUIRED]
The Git provider.
Owner (string) –
[REQUIRED]
The account that the Git connection is for. The value depends on the provider:
For GitHub, specify the user or organization name.
For GitLab, specify the user name.
To get this value, call ListGitConnections.
RepositoryName (string) – The name of the repository, which is the last segment of RepositoryPath.
RepositoryPath (string) –
[REQUIRED]
The full path of the repository in the Git provider, for example my-org/my-app. GitLab paths can include subgroups, for example my-group/subgroup/my-app. To get this value, call ListRepositories.
FilePath (string) –
[REQUIRED]
The path of the file, relative to the root of the repository, for example package.json.
Branch (string) –
[REQUIRED]
The name of the branch to read from.
- Return type:
dict
- Returns:
Response Syntax
{ 'FilePath': 'string', 'Content': b'bytes', 'Sha': 'string', 'Size': 123 }
Response Structure
(dict) –
FilePath (string) –
The path of the file that was returned.
Content (bytes) –
The contents of the file.
Sha (string) –
The Git object ID (blob SHA) of the file’s contents. It changes whenever the file’s contents change.
Size (integer) –
The size of the file, in bytes.
Exceptions