Skip to content

Latest commit

 

History

History
221 lines (176 loc) · 10.2 KB

README.md

File metadata and controls

221 lines (176 loc) · 10.2 KB

Go API client for ionoscloud

Overview

Container Registry service enables IONOS clients to manage docker and OCI compliant registries for use by their managed Kubernetes clusters. Use a Container Registry to ensure you have a privately accessed registry to efficiently support image pulls.

Changelog

1.1.0

  • Added new endpoints for Repositories
  • Added new endpoints for Artifacts
  • Added new endpoints for Vulnerabilities
  • Added registry vulnerabilityScanning feature

1.2.0

  • Added registry apiSubnetAllowList

1.2.1

  • Amended apiSubnetAllowList Regex

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.2.1
  • Package version: 1.3.1
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import ionoscloud "github.com/ionos-cloud/sdk-go-container-registry"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), ionoscloud.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), ionoscloud.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

Documentation for API Endpoints

All URIs are relative to https://api.ionos.com/containerregistries

Class Method HTTP request Description
ArtifactsApi RegistriesArtifactsGet Get /registries/{registryId}/artifacts Retrieve all Artifacts by Registry
ArtifactsApi RegistriesRepositoriesArtifactsFindByDigest Get /registries/{registryId}/repositories/{repositoryName}/artifacts/{digest} Retrieve Artifact
ArtifactsApi RegistriesRepositoriesArtifactsGet Get /registries/{registryId}/repositories/{repositoryName}/artifacts Retrieve all Artifacts by Repository
ArtifactsApi RegistriesRepositoriesArtifactsVulnerabilitiesGet Get /registries/{registryId}/repositories/{repositoryName}/artifacts/{digest}/vulnerabilities Retrieve all Vulnerabilities
LocationsApi LocationsGet Get /locations Get container registry locations
NamesApi NamesCheckUsage Head /names/{name} Get container registry name availability
RegistriesApi RegistriesDelete Delete /registries/{registryId} Delete registry
RegistriesApi RegistriesFindById Get /registries/{registryId} Get a registry
RegistriesApi RegistriesGet Get /registries List all container registries
RegistriesApi RegistriesPatch Patch /registries/{registryId} Update the properties of a registry
RegistriesApi RegistriesPost Post /registries Create container registry
RegistriesApi RegistriesPut Put /registries/{registryId} Create or replace a container registry
RepositoriesApi RegistriesRepositoriesDelete Delete /registries/{registryId}/repositories/{repositoryName} Delete repository
RepositoriesApi RegistriesRepositoriesFindByName Get /registries/{registryId}/repositories/{repositoryName} Retrieve Repository
RepositoriesApi RegistriesRepositoriesGet Get /registries/{registryId}/repositories Retrieve all Repositories
TokensApi RegistriesTokensDelete Delete /registries/{registryId}/tokens/{tokenId} Delete token
TokensApi RegistriesTokensFindById Get /registries/{registryId}/tokens/{tokenId} Get token information
TokensApi RegistriesTokensGet Get /registries/{registryId}/tokens List all tokens for the container registry
TokensApi RegistriesTokensPatch Patch /registries/{registryId}/tokens/{tokenId} Update token
TokensApi RegistriesTokensPost Post /registries/{registryId}/tokens Create token
TokensApi RegistriesTokensPut Put /registries/{registryId}/tokens/{tokenId} Create or replace token
VulnerabilitiesApi VulnerabilitiesFindByID Get /vulnerabilities/{vulnerabilityId} Retrieve Vulnerability

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

basicAuth

  • Type: HTTP basic authentication

Example

auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
    UserName: "username",
    Password: "password",
})
r, err := client.Service.Operation(auth, args)

tokenAuth

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: Authorization and passed in as the auth context for each request.

Example

auth := context.WithValue(
		context.Background(),
		sw.ContextAPIKeys,
		map[string]sw.APIKey{
			"Authorization": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]