%% WARNING: DO NOT EDIT, AUTO-GENERATED CODE! %% See https://github.com/aws-beam/aws-codegen for more details. %% @doc AWS CodeArtifact is a fully managed artifact repository compatible %% with language-native package managers and build tools such as npm, Apache %% Maven, NuGet, and pip. %% %% You can use CodeArtifact to share packages with development teams and pull %% packages. Packages can be pulled from both public and CodeArtifact %% repositories. You can also create an upstream relationship between a %% CodeArtifact repository and another repository, which effectively merges %% their contents from the point of view of a package manager client. %% %% AWS CodeArtifact Components %% %% Use the information in this guide to help you work with the following %% CodeArtifact components: %% %% CodeArtifact supports these operations: %% %% -module(aws_codeartifact). -export([associate_external_connection/2, associate_external_connection/3, copy_package_versions/2, copy_package_versions/3, create_domain/2, create_domain/3, create_repository/2, create_repository/3, delete_domain/2, delete_domain/3, delete_domain_permissions_policy/2, delete_domain_permissions_policy/3, delete_package_versions/2, delete_package_versions/3, delete_repository/2, delete_repository/3, delete_repository_permissions_policy/2, delete_repository_permissions_policy/3, describe_domain/2, describe_domain/4, describe_domain/5, describe_package_version/6, describe_package_version/8, describe_package_version/9, describe_repository/3, describe_repository/5, describe_repository/6, disassociate_external_connection/2, disassociate_external_connection/3, dispose_package_versions/2, dispose_package_versions/3, get_authorization_token/2, get_authorization_token/3, get_domain_permissions_policy/2, get_domain_permissions_policy/4, get_domain_permissions_policy/5, get_package_version_asset/7, get_package_version_asset/9, get_package_version_asset/10, get_package_version_readme/6, get_package_version_readme/8, get_package_version_readme/9, get_repository_endpoint/4, get_repository_endpoint/6, get_repository_endpoint/7, get_repository_permissions_policy/3, get_repository_permissions_policy/5, get_repository_permissions_policy/6, list_domains/2, list_domains/3, list_package_version_assets/2, list_package_version_assets/3, list_package_version_dependencies/2, list_package_version_dependencies/3, list_package_versions/2, list_package_versions/3, list_packages/2, list_packages/3, list_repositories/2, list_repositories/3, list_repositories_in_domain/2, list_repositories_in_domain/3, list_tags_for_resource/2, list_tags_for_resource/3, put_domain_permissions_policy/2, put_domain_permissions_policy/3, put_repository_permissions_policy/2, put_repository_permissions_policy/3, tag_resource/2, tag_resource/3, untag_resource/2, untag_resource/3, update_package_versions_status/2, update_package_versions_status/3, update_repository/2, update_repository/3]). -include_lib("hackney/include/hackney_lib.hrl"). %%==================================================================== %% API %%==================================================================== %% @doc Adds an existing external connection to a repository. %% %% One external connection is allowed per repository. %% %% A repository can have one or more upstream repositories, or an external %% connection. associate_external_connection(Client, Input) -> associate_external_connection(Client, Input, []). associate_external_connection(Client, Input0, Options0) -> Method = post, Path = ["/v1/repository/external-connection"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>}, {<<"external-connection">>, <<"externalConnection">>}, {<<"repository">>, <<"repository">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Copies package versions from one repository to another repository in %% the same domain. %% %% You must specify `versions' or `versionRevisions'. You cannot specify %% both. copy_package_versions(Client, Input) -> copy_package_versions(Client, Input, []). copy_package_versions(Client, Input0, Options0) -> Method = post, Path = ["/v1/package/versions/copy"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"destination-repository">>, <<"destinationRepository">>}, {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>}, {<<"format">>, <<"format">>}, {<<"namespace">>, <<"namespace">>}, {<<"package">>, <<"package">>}, {<<"source-repository">>, <<"sourceRepository">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Creates a domain. %% %% CodeArtifact domains make it easier to manage multiple repositories across %% an organization. You can use a domain to apply permissions across many %% repositories owned by different AWS accounts. An asset is stored only once %% in a domain, even if it's in multiple repositories. %% %% Although you can have multiple domains, we recommend a single production %% domain that contains all published artifacts so that your development %% teams can find and share packages. You can use a second pre-production %% domain to test changes to the production domain configuration. create_domain(Client, Input) -> create_domain(Client, Input, []). create_domain(Client, Input0, Options0) -> Method = post, Path = ["/v1/domain"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"domain">>, <<"domain">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Creates a repository. create_repository(Client, Input) -> create_repository(Client, Input, []). create_repository(Client, Input0, Options0) -> Method = post, Path = ["/v1/repository"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>}, {<<"repository">>, <<"repository">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Deletes a domain. %% %% You cannot delete a domain that contains repositories. If you want to %% delete a domain with repositories, first delete its repositories. delete_domain(Client, Input) -> delete_domain(Client, Input, []). delete_domain(Client, Input0, Options0) -> Method = delete, Path = ["/v1/domain"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Deletes the resource policy set on a domain. delete_domain_permissions_policy(Client, Input) -> delete_domain_permissions_policy(Client, Input, []). delete_domain_permissions_policy(Client, Input0, Options0) -> Method = delete, Path = ["/v1/domain/permissions/policy"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>}, {<<"policy-revision">>, <<"policyRevision">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Deletes one or more versions of a package. %% %% A deleted package version cannot be restored in your repository. If you %% want to remove a package version from your repository and be able to %% restore it later, set its status to `Archived'. Archived packages cannot %% be downloaded from a repository and don't show up with list package APIs %% (for example, ` ListackageVersions '), but you can restore them using ` %% UpdatePackageVersionsStatus '. delete_package_versions(Client, Input) -> delete_package_versions(Client, Input, []). delete_package_versions(Client, Input0, Options0) -> Method = post, Path = ["/v1/package/versions/delete"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>}, {<<"format">>, <<"format">>}, {<<"namespace">>, <<"namespace">>}, {<<"package">>, <<"package">>}, {<<"repository">>, <<"repository">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Deletes a repository. delete_repository(Client, Input) -> delete_repository(Client, Input, []). delete_repository(Client, Input0, Options0) -> Method = delete, Path = ["/v1/repository"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>}, {<<"repository">>, <<"repository">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Deletes the resource policy that is set on a repository. %% %% After a resource policy is deleted, the permissions allowed and denied by %% the deleted policy are removed. The effect of deleting a resource policy %% might not be immediate. %% %% Use `DeleteRepositoryPermissionsPolicy' with caution. After a policy is %% deleted, AWS users, roles, and accounts lose permissions to perform the %% repository actions granted by the deleted policy. delete_repository_permissions_policy(Client, Input) -> delete_repository_permissions_policy(Client, Input, []). delete_repository_permissions_policy(Client, Input0, Options0) -> Method = delete, Path = ["/v1/repository/permissions/policies"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>}, {<<"policy-revision">>, <<"policyRevision">>}, {<<"repository">>, <<"repository">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Returns a `DomainDescription' object that contains information about %% the requested domain. describe_domain(Client, Domain) when is_map(Client) -> describe_domain(Client, Domain, #{}, #{}). describe_domain(Client, Domain, QueryMap, HeadersMap) when is_map(Client), is_map(QueryMap), is_map(HeadersMap) -> describe_domain(Client, Domain, QueryMap, HeadersMap, []). describe_domain(Client, Domain, QueryMap, HeadersMap, Options0) when is_map(Client), is_map(QueryMap), is_map(HeadersMap), is_list(Options0) -> Path = ["/v1/domain"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Query0_ = [ {<<"domain">>, Domain}, {<<"domain-owner">>, maps:get(<<"domain-owner">>, QueryMap, undefined)} ], Query_ = [H || {_, V} = H <- Query0_, V =/= undefined], request(Client, get, Path, Query_, Headers, undefined, Options, SuccessStatusCode). %% @doc Returns a `PackageVersionDescription' object that contains %% information about the requested package version. describe_package_version(Client, Domain, Format, Package, PackageVersion, Repository) when is_map(Client) -> describe_package_version(Client, Domain, Format, Package, PackageVersion, Repository, #{}, #{}). describe_package_version(Client, Domain, Format, Package, PackageVersion, Repository, QueryMap, HeadersMap) when is_map(Client), is_map(QueryMap), is_map(HeadersMap) -> describe_package_version(Client, Domain, Format, Package, PackageVersion, Repository, QueryMap, HeadersMap, []). describe_package_version(Client, Domain, Format, Package, PackageVersion, Repository, QueryMap, HeadersMap, Options0) when is_map(Client), is_map(QueryMap), is_map(HeadersMap), is_list(Options0) -> Path = ["/v1/package/version"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Query0_ = [ {<<"domain">>, Domain}, {<<"domain-owner">>, maps:get(<<"domain-owner">>, QueryMap, undefined)}, {<<"format">>, Format}, {<<"namespace">>, maps:get(<<"namespace">>, QueryMap, undefined)}, {<<"package">>, Package}, {<<"version">>, PackageVersion}, {<<"repository">>, Repository} ], Query_ = [H || {_, V} = H <- Query0_, V =/= undefined], request(Client, get, Path, Query_, Headers, undefined, Options, SuccessStatusCode). %% @doc Returns a `RepositoryDescription' object that contains detailed %% information about the requested repository. describe_repository(Client, Domain, Repository) when is_map(Client) -> describe_repository(Client, Domain, Repository, #{}, #{}). describe_repository(Client, Domain, Repository, QueryMap, HeadersMap) when is_map(Client), is_map(QueryMap), is_map(HeadersMap) -> describe_repository(Client, Domain, Repository, QueryMap, HeadersMap, []). describe_repository(Client, Domain, Repository, QueryMap, HeadersMap, Options0) when is_map(Client), is_map(QueryMap), is_map(HeadersMap), is_list(Options0) -> Path = ["/v1/repository"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Query0_ = [ {<<"domain">>, Domain}, {<<"domain-owner">>, maps:get(<<"domain-owner">>, QueryMap, undefined)}, {<<"repository">>, Repository} ], Query_ = [H || {_, V} = H <- Query0_, V =/= undefined], request(Client, get, Path, Query_, Headers, undefined, Options, SuccessStatusCode). %% @doc Removes an existing external connection from a repository. disassociate_external_connection(Client, Input) -> disassociate_external_connection(Client, Input, []). disassociate_external_connection(Client, Input0, Options0) -> Method = delete, Path = ["/v1/repository/external-connection"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>}, {<<"external-connection">>, <<"externalConnection">>}, {<<"repository">>, <<"repository">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Deletes the assets in package versions and sets the package versions' %% status to `Disposed'. %% %% A disposed package version cannot be restored in your repository because %% its assets are deleted. %% %% To view all disposed package versions in a repository, use %% `ListPackageVersions' and set the `status' parameter to `Disposed'. %% %% To view information about a disposed package version, use %% `DescribePackageVersion' .. dispose_package_versions(Client, Input) -> dispose_package_versions(Client, Input, []). dispose_package_versions(Client, Input0, Options0) -> Method = post, Path = ["/v1/package/versions/dispose"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>}, {<<"format">>, <<"format">>}, {<<"namespace">>, <<"namespace">>}, {<<"package">>, <<"package">>}, {<<"repository">>, <<"repository">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Generates a temporary authorization token for accessing repositories %% in the domain. %% %% This API requires the `codeartifact:GetAuthorizationToken' and %% `sts:GetServiceBearerToken' permissions. For more information about %% authorization tokens, see AWS CodeArtifact authentication and tokens. %% %% CodeArtifact authorization tokens are valid for a period of 12 hours when %% created with the `login' command. You can call `login' periodically to %% refresh the token. When you create an authorization token with the %% `GetAuthorizationToken' API, you can set a custom authorization period, up %% to a maximum of 12 hours, with the `durationSeconds' parameter. %% %% The authorization period begins after `login' or `GetAuthorizationToken' %% is called. If `login' or `GetAuthorizationToken' is called while assuming %% a role, the token lifetime is independent of the maximum session duration %% of the role. For example, if you call `sts assume-role' and specify a %% session duration of 15 minutes, then generate a CodeArtifact authorization %% token, the token will be valid for the full authorization period even %% though this is longer than the 15-minute session duration. %% %% See Using IAM Roles for more information on controlling session duration. get_authorization_token(Client, Input) -> get_authorization_token(Client, Input, []). get_authorization_token(Client, Input0, Options0) -> Method = post, Path = ["/v1/authorization-token"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>}, {<<"duration">>, <<"durationSeconds">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Returns the resource policy attached to the specified domain. %% %% The policy is a resource-based policy, not an identity-based policy. For %% more information, see Identity-based policies and resource-based policies %% in the AWS Identity and Access Management User Guide. get_domain_permissions_policy(Client, Domain) when is_map(Client) -> get_domain_permissions_policy(Client, Domain, #{}, #{}). get_domain_permissions_policy(Client, Domain, QueryMap, HeadersMap) when is_map(Client), is_map(QueryMap), is_map(HeadersMap) -> get_domain_permissions_policy(Client, Domain, QueryMap, HeadersMap, []). get_domain_permissions_policy(Client, Domain, QueryMap, HeadersMap, Options0) when is_map(Client), is_map(QueryMap), is_map(HeadersMap), is_list(Options0) -> Path = ["/v1/domain/permissions/policy"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Query0_ = [ {<<"domain">>, Domain}, {<<"domain-owner">>, maps:get(<<"domain-owner">>, QueryMap, undefined)} ], Query_ = [H || {_, V} = H <- Query0_, V =/= undefined], request(Client, get, Path, Query_, Headers, undefined, Options, SuccessStatusCode). %% @doc Returns an asset (or file) that is in a package. %% %% For example, for a Maven package version, use `GetPackageVersionAsset' to %% download a `JAR' file, a `POM' file, or any other assets in the package %% version. get_package_version_asset(Client, Asset, Domain, Format, Package, PackageVersion, Repository) when is_map(Client) -> get_package_version_asset(Client, Asset, Domain, Format, Package, PackageVersion, Repository, #{}, #{}). get_package_version_asset(Client, Asset, Domain, Format, Package, PackageVersion, Repository, QueryMap, HeadersMap) when is_map(Client), is_map(QueryMap), is_map(HeadersMap) -> get_package_version_asset(Client, Asset, Domain, Format, Package, PackageVersion, Repository, QueryMap, HeadersMap, []). get_package_version_asset(Client, Asset, Domain, Format, Package, PackageVersion, Repository, QueryMap, HeadersMap, Options0) when is_map(Client), is_map(QueryMap), is_map(HeadersMap), is_list(Options0) -> Path = ["/v1/package/version/asset"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Query0_ = [ {<<"asset">>, Asset}, {<<"domain">>, Domain}, {<<"domain-owner">>, maps:get(<<"domain-owner">>, QueryMap, undefined)}, {<<"format">>, Format}, {<<"namespace">>, maps:get(<<"namespace">>, QueryMap, undefined)}, {<<"package">>, Package}, {<<"version">>, PackageVersion}, {<<"revision">>, maps:get(<<"revision">>, QueryMap, undefined)}, {<<"repository">>, Repository} ], Query_ = [H || {_, V} = H <- Query0_, V =/= undefined], case request(Client, get, Path, Query_, Headers, undefined, Options, SuccessStatusCode) of {ok, Body0, {_, ResponseHeaders, _} = Response} -> ResponseHeadersParams = [ {<<"X-AssetName">>, <<"assetName">>}, {<<"X-PackageVersion">>, <<"packageVersion">>}, {<<"X-PackageVersionRevision">>, <<"packageVersionRevision">>} ], FoldFun = fun({Name_, Key_}, Acc_) -> case lists:keyfind(Name_, 1, ResponseHeaders) of false -> Acc_; {_, Value_} -> Acc_#{Key_ => Value_} end end, Body = lists:foldl(FoldFun, Body0, ResponseHeadersParams), {ok, Body, Response}; Result -> Result end. %% @doc Gets the readme file or descriptive text for a package version. %% %% For packages that do not contain a readme file, CodeArtifact extracts a %% description from a metadata file. For example, from the `' %% element in the `pom.xml' file of a Maven package. %% %% The returned text might contain formatting. For example, it might contain %% formatting for Markdown or reStructuredText. get_package_version_readme(Client, Domain, Format, Package, PackageVersion, Repository) when is_map(Client) -> get_package_version_readme(Client, Domain, Format, Package, PackageVersion, Repository, #{}, #{}). get_package_version_readme(Client, Domain, Format, Package, PackageVersion, Repository, QueryMap, HeadersMap) when is_map(Client), is_map(QueryMap), is_map(HeadersMap) -> get_package_version_readme(Client, Domain, Format, Package, PackageVersion, Repository, QueryMap, HeadersMap, []). get_package_version_readme(Client, Domain, Format, Package, PackageVersion, Repository, QueryMap, HeadersMap, Options0) when is_map(Client), is_map(QueryMap), is_map(HeadersMap), is_list(Options0) -> Path = ["/v1/package/version/readme"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Query0_ = [ {<<"domain">>, Domain}, {<<"domain-owner">>, maps:get(<<"domain-owner">>, QueryMap, undefined)}, {<<"format">>, Format}, {<<"namespace">>, maps:get(<<"namespace">>, QueryMap, undefined)}, {<<"package">>, Package}, {<<"version">>, PackageVersion}, {<<"repository">>, Repository} ], Query_ = [H || {_, V} = H <- Query0_, V =/= undefined], request(Client, get, Path, Query_, Headers, undefined, Options, SuccessStatusCode). %% @doc Returns the endpoint of a repository for a specific package format. %% %% A repository has one endpoint for each package format: %% %% get_repository_endpoint(Client, Domain, Format, Repository) when is_map(Client) -> get_repository_endpoint(Client, Domain, Format, Repository, #{}, #{}). get_repository_endpoint(Client, Domain, Format, Repository, QueryMap, HeadersMap) when is_map(Client), is_map(QueryMap), is_map(HeadersMap) -> get_repository_endpoint(Client, Domain, Format, Repository, QueryMap, HeadersMap, []). get_repository_endpoint(Client, Domain, Format, Repository, QueryMap, HeadersMap, Options0) when is_map(Client), is_map(QueryMap), is_map(HeadersMap), is_list(Options0) -> Path = ["/v1/repository/endpoint"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Query0_ = [ {<<"domain">>, Domain}, {<<"domain-owner">>, maps:get(<<"domain-owner">>, QueryMap, undefined)}, {<<"format">>, Format}, {<<"repository">>, Repository} ], Query_ = [H || {_, V} = H <- Query0_, V =/= undefined], request(Client, get, Path, Query_, Headers, undefined, Options, SuccessStatusCode). %% @doc Returns the resource policy that is set on a repository. get_repository_permissions_policy(Client, Domain, Repository) when is_map(Client) -> get_repository_permissions_policy(Client, Domain, Repository, #{}, #{}). get_repository_permissions_policy(Client, Domain, Repository, QueryMap, HeadersMap) when is_map(Client), is_map(QueryMap), is_map(HeadersMap) -> get_repository_permissions_policy(Client, Domain, Repository, QueryMap, HeadersMap, []). get_repository_permissions_policy(Client, Domain, Repository, QueryMap, HeadersMap, Options0) when is_map(Client), is_map(QueryMap), is_map(HeadersMap), is_list(Options0) -> Path = ["/v1/repository/permissions/policy"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Query0_ = [ {<<"domain">>, Domain}, {<<"domain-owner">>, maps:get(<<"domain-owner">>, QueryMap, undefined)}, {<<"repository">>, Repository} ], Query_ = [H || {_, V} = H <- Query0_, V =/= undefined], request(Client, get, Path, Query_, Headers, undefined, Options, SuccessStatusCode). %% @doc Returns a list of ` DomainSummary ' objects for all domains owned by %% the AWS account that makes this call. %% %% Each returned `DomainSummary' object contains information about a domain. list_domains(Client, Input) -> list_domains(Client, Input, []). list_domains(Client, Input0, Options0) -> Method = post, Path = ["/v1/domains"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, Query_ = [], Input = Input1, request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Returns a list of `AssetSummary' objects for assets in a package %% version. list_package_version_assets(Client, Input) -> list_package_version_assets(Client, Input, []). list_package_version_assets(Client, Input0, Options0) -> Method = post, Path = ["/v1/package/version/assets"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>}, {<<"format">>, <<"format">>}, {<<"max-results">>, <<"maxResults">>}, {<<"namespace">>, <<"namespace">>}, {<<"next-token">>, <<"nextToken">>}, {<<"package">>, <<"package">>}, {<<"version">>, <<"packageVersion">>}, {<<"repository">>, <<"repository">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Returns the direct dependencies for a package version. %% %% The dependencies are returned as `PackageDependency' objects. CodeArtifact %% extracts the dependencies for a package version from the metadata file for %% the package format (for example, the `package.json' file for npm packages %% and the `pom.xml' file for Maven). Any package version dependencies that %% are not listed in the configuration file are not returned. list_package_version_dependencies(Client, Input) -> list_package_version_dependencies(Client, Input, []). list_package_version_dependencies(Client, Input0, Options0) -> Method = post, Path = ["/v1/package/version/dependencies"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>}, {<<"format">>, <<"format">>}, {<<"namespace">>, <<"namespace">>}, {<<"next-token">>, <<"nextToken">>}, {<<"package">>, <<"package">>}, {<<"version">>, <<"packageVersion">>}, {<<"repository">>, <<"repository">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Returns a list of `PackageVersionSummary' objects for package %% versions in a repository that match the request parameters. list_package_versions(Client, Input) -> list_package_versions(Client, Input, []). list_package_versions(Client, Input0, Options0) -> Method = post, Path = ["/v1/package/versions"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>}, {<<"format">>, <<"format">>}, {<<"max-results">>, <<"maxResults">>}, {<<"namespace">>, <<"namespace">>}, {<<"next-token">>, <<"nextToken">>}, {<<"package">>, <<"package">>}, {<<"repository">>, <<"repository">>}, {<<"sortBy">>, <<"sortBy">>}, {<<"status">>, <<"status">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Returns a list of `PackageSummary' objects for packages in a %% repository that match the request parameters. list_packages(Client, Input) -> list_packages(Client, Input, []). list_packages(Client, Input0, Options0) -> Method = post, Path = ["/v1/packages"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>}, {<<"format">>, <<"format">>}, {<<"max-results">>, <<"maxResults">>}, {<<"namespace">>, <<"namespace">>}, {<<"next-token">>, <<"nextToken">>}, {<<"package-prefix">>, <<"packagePrefix">>}, {<<"repository">>, <<"repository">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Returns a list of `RepositorySummary' objects. %% %% Each `RepositorySummary' contains information about a repository in the %% specified AWS account and that matches the input parameters. list_repositories(Client, Input) -> list_repositories(Client, Input, []). list_repositories(Client, Input0, Options0) -> Method = post, Path = ["/v1/repositories"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"max-results">>, <<"maxResults">>}, {<<"next-token">>, <<"nextToken">>}, {<<"repository-prefix">>, <<"repositoryPrefix">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Returns a list of `RepositorySummary' objects. %% %% Each `RepositorySummary' contains information about a repository in the %% specified domain and that matches the input parameters. list_repositories_in_domain(Client, Input) -> list_repositories_in_domain(Client, Input, []). list_repositories_in_domain(Client, Input0, Options0) -> Method = post, Path = ["/v1/domain/repositories"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"administrator-account">>, <<"administratorAccount">>}, {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>}, {<<"max-results">>, <<"maxResults">>}, {<<"next-token">>, <<"nextToken">>}, {<<"repository-prefix">>, <<"repositoryPrefix">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Gets information about AWS tags for a specified Amazon Resource Name %% (ARN) in AWS CodeArtifact. list_tags_for_resource(Client, Input) -> list_tags_for_resource(Client, Input, []). list_tags_for_resource(Client, Input0, Options0) -> Method = post, Path = ["/v1/tags"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"resourceArn">>, <<"resourceArn">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Sets a resource policy on a domain that specifies permissions to %% access it. %% %% When you call `PutDomainPermissionsPolicy', the resource policy on the %% domain is ignored when evaluting permissions. This ensures that the owner %% of a domain cannot lock themselves out of the domain, which would prevent %% them from being able to update the resource policy. put_domain_permissions_policy(Client, Input) -> put_domain_permissions_policy(Client, Input, []). put_domain_permissions_policy(Client, Input0, Options0) -> Method = put, Path = ["/v1/domain/permissions/policy"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, Query_ = [], Input = Input1, request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Sets the resource policy on a repository that specifies permissions %% to access it. %% %% When you call `PutRepositoryPermissionsPolicy', the resource policy on the %% repository is ignored when evaluting permissions. This ensures that the %% owner of a repository cannot lock themselves out of the repository, which %% would prevent them from being able to update the resource policy. put_repository_permissions_policy(Client, Input) -> put_repository_permissions_policy(Client, Input, []). put_repository_permissions_policy(Client, Input0, Options0) -> Method = put, Path = ["/v1/repository/permissions/policy"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>}, {<<"repository">>, <<"repository">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Adds or updates tags for a resource in AWS CodeArtifact. tag_resource(Client, Input) -> tag_resource(Client, Input, []). tag_resource(Client, Input0, Options0) -> Method = post, Path = ["/v1/tag"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"resourceArn">>, <<"resourceArn">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Removes tags from a resource in AWS CodeArtifact. untag_resource(Client, Input) -> untag_resource(Client, Input, []). untag_resource(Client, Input0, Options0) -> Method = post, Path = ["/v1/untag"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"resourceArn">>, <<"resourceArn">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Updates the status of one or more versions of a package. update_package_versions_status(Client, Input) -> update_package_versions_status(Client, Input, []). update_package_versions_status(Client, Input0, Options0) -> Method = post, Path = ["/v1/package/versions/update_status"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>}, {<<"format">>, <<"format">>}, {<<"namespace">>, <<"namespace">>}, {<<"package">>, <<"package">>}, {<<"repository">>, <<"repository">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %% @doc Update the properties of a repository. update_repository(Client, Input) -> update_repository(Client, Input, []). update_repository(Client, Input0, Options0) -> Method = put, Path = ["/v1/repository"], SuccessStatusCode = undefined, Options = [{send_body_as_binary, false}, {receive_body_as_binary, false} | Options0], Headers = [], Input1 = Input0, QueryMapping = [ {<<"domain">>, <<"domain">>}, {<<"domain-owner">>, <<"domainOwner">>}, {<<"repository">>, <<"repository">>} ], {Query_, Input} = aws_request:build_headers(QueryMapping, Input1), request(Client, Method, Path, Query_, Headers, Input, Options, SuccessStatusCode). %%==================================================================== %% Internal functions %%==================================================================== -spec request(aws_client:aws_client(), atom(), iolist(), list(), list(), map() | undefined, list(), pos_integer() | undefined) -> {ok, Result, {integer(), list(), hackney:client()}} | {error, Error, {integer(), list(), hackney:client()}} | {error, term()} when Result :: map(), Error :: map(). request(Client, Method, Path, Query, Headers0, Input, Options, SuccessStatusCode) -> Client1 = Client#{service => <<"codeartifact">>}, Host = build_host(<<"codeartifact">>, Client1), URL0 = build_url(Host, Path, Client1), URL = aws_request:add_query(URL0, Query), AdditionalHeaders = [ {<<"Host">>, Host} , {<<"Content-Type">>, <<"application/x-amz-json-1.1">>} ], Headers1 = aws_request:add_headers(AdditionalHeaders, Headers0), Payload = case proplists:get_value(send_body_as_binary, Options) of true -> maps:get(<<"Body">>, Input, <<"">>); false -> encode_payload(Input) end, MethodBin = aws_request:method_to_binary(Method), SignedHeaders = aws_request:sign_request(Client1, MethodBin, URL, Headers1, Payload), Response = hackney:request(Method, URL, SignedHeaders, Payload, Options), DecodeBody = not proplists:get_value(receive_body_as_binary, Options), handle_response(Response, SuccessStatusCode, DecodeBody). handle_response({ok, StatusCode, ResponseHeaders, Client}, SuccessStatusCode, DecodeBody) when StatusCode =:= 200; StatusCode =:= 202; StatusCode =:= 204; StatusCode =:= SuccessStatusCode -> case hackney:body(Client) of {ok, <<>>} when StatusCode =:= 200; StatusCode =:= SuccessStatusCode -> {ok, #{}, {StatusCode, ResponseHeaders, Client}}; {ok, Body} -> Result = case DecodeBody of true -> jsx:decode(Body); false -> #{<<"Body">> => Body} end, {ok, Result, {StatusCode, ResponseHeaders, Client}} end; handle_response({ok, StatusCode, ResponseHeaders, Client}, _, _DecodeBody) -> {ok, Body} = hackney:body(Client), Error = jsx:decode(Body), {error, Error, {StatusCode, ResponseHeaders, Client}}; handle_response({error, Reason}, _, _DecodeBody) -> {error, Reason}. build_host(_EndpointPrefix, #{region := <<"local">>, endpoint := Endpoint}) -> Endpoint; build_host(_EndpointPrefix, #{region := <<"local">>}) -> <<"localhost">>; build_host(EndpointPrefix, #{region := Region, endpoint := Endpoint}) -> aws_util:binary_join([EndpointPrefix, Region, Endpoint], <<".">>). build_url(Host, Path0, Client) -> Proto = maps:get(proto, Client), Path = erlang:iolist_to_binary(Path0), Port = maps:get(port, Client), aws_util:binary_join([Proto, <<"://">>, Host, <<":">>, Port, Path], <<"">>). -spec encode_payload(undefined | map()) -> binary(). encode_payload(undefined) -> <<>>; encode_payload(Input) -> jsx:encode(Input).