Skip to content

get_file async

get_file(
    repository_name: RepositoryName,
    file_path: Path,
    *,
    config_overrides: Optional[AsyncCodeCommitClientConfig] = None,
    commit_specifier: Optional[CommitName] = None,
) -> GetFileOutput

Returns the base-64 encoded contents of a specified file and its metadata.

Parameters:

  • repository_name (RepositoryName) –

    The name of the repository that contains the file.

  • commit_specifier (Optional[CommitName], default: None ) –

    The fully quaified reference that identifies the commit that contains the file. For example, you can specify a full commit ID, a tag, a branch name, or a reference such as refs/heads/main. If none is provided, the head commit is used.

  • file_path (Path) –

    The fully qualified path to the file, including the full name and extension of the file. For example, /examples/file.md is the fully qualified path to a file named file.md in a folder named examples.

Raises:

Source code in docs_src/capo_codecommit/_services/async_code_commit.py
async def get_file(
    self,
    repository_name: "capo_codecommit.types.repository_name.RepositoryName",
    file_path: "capo_codecommit.types.path.Path",
    *,
    config_overrides: Optional[AsyncCodeCommitClientConfig] = None,
    commit_specifier: Optional[
        "capo_codecommit.types.commit_name.CommitName"
    ] = None,
) -> "capo_codecommit.types.get_file_output.GetFileOutput":
    """<p>Returns the base-64 encoded contents of a specified file and its metadata.</p>

    Args:
        repository_name: <p>The name of the repository that contains the file.</p>
        commit_specifier: <p>The fully quaified reference that identifies the commit that contains the file. For example, you can specify a full commit ID, a tag, a branch name, or a reference such as refs/heads/main. If none is provided, the head commit is used.</p>
        file_path: <p>The fully qualified path to the file, including the full name and extension of the file. For example, /examples/file.md is the fully qualified path to a file named file.md in a folder named examples.</p>

    Raises:
        capo_codecommit.errors.commit_does_not_exist_exception.CommitDoesNotExistException: <p>The specified commit does not exist or no commit was specified, and the specified repository has no default branch.</p>
        capo_codecommit.errors.encryption_integrity_checks_failed_exception.EncryptionIntegrityChecksFailedException: <p>An encryption integrity check failed.</p>
        capo_codecommit.errors.encryption_key_access_denied_exception.EncryptionKeyAccessDeniedException: <p>An encryption key could not be accessed.</p>
        capo_codecommit.errors.encryption_key_disabled_exception.EncryptionKeyDisabledException: <p>The encryption key is disabled.</p>
        capo_codecommit.errors.encryption_key_not_found_exception.EncryptionKeyNotFoundException: <p>No encryption key was found.</p>
        capo_codecommit.errors.encryption_key_unavailable_exception.EncryptionKeyUnavailableException: <p>The encryption key is not available.</p>
        capo_codecommit.errors.file_does_not_exist_exception.FileDoesNotExistException: <p>The specified file does not exist. Verify that you have used the correct file name, full path, and extension.</p>
        capo_codecommit.errors.file_too_large_exception.FileTooLargeException: <p>The specified file exceeds the file size limit for CodeCommit. For more information about limits in CodeCommit, see <a href="https://docs.aws.amazon.com/codecommit/latest/userguide/limits.html">Quotas</a> in the <i>CodeCommit User Guide</i>.</p>
        capo_codecommit.errors.invalid_commit_exception.InvalidCommitException: <p>The specified commit is not valid.</p>
        capo_codecommit.errors.invalid_path_exception.InvalidPathException: <p>The specified path is not valid.</p>
        capo_codecommit.errors.invalid_repository_name_exception.InvalidRepositoryNameException: <p>A specified repository name is not valid.</p> <note> <p>This exception occurs only when a specified repository name is not valid. Other exceptions occur when a required repository parameter is missing, or when a specified repository does not exist.</p> </note>
        capo_codecommit.errors.path_required_exception.PathRequiredException: <p>The folderPath for a location cannot be null.</p>
        capo_codecommit.errors.repository_does_not_exist_exception.RepositoryDoesNotExistException: <p>The specified repository does not exist.</p>
        capo_codecommit.errors.repository_name_required_exception.RepositoryNameRequiredException: <p>A repository name is required, but was not specified.</p>
        capo_codecommit.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_codecommit.types.get_file_input.GetFileInput]",
    ) -> AsyncOperationResponse[
        "capo_codecommit.types.get_file_output.GetFileOutput"
    ]:
        import capo_codecommit._operations.code_commit_20150413.get_file

        (
            output,
            http_response,
        ) = await capo_codecommit._operations.code_commit_20150413.get_file.async_get_file(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetFile")
    )
    input_: capo_codecommit.types.get_file_input.GetFileInput = {
        "repository_name": repository_name,
        "file_path": file_path,
    }
    if commit_specifier is not None:
        input_["commit_specifier"] = commit_specifier

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output