Giter Club home page Giter Club logo

sdk-go-container-registry's Introduction

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

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.1.0
  • Package version: 1.1.0
  • 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]

sdk-go-container-registry's People

Contributors

cristiguranionos avatar ionoscloudsdk avatar mimihalescu avatar rmocanu-ionos avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

makkus183

sdk-go-container-registry's Issues

StorageUsage.properties.storageUsage.bytes increased max value of int32

Description

Expected behavior

Environment

GO version:

1.20.3

SDK version:

v1.0.0

OS:

macos 13.0.1

Configuration Files

How to Reproduce

Steps to reproduce the behavior:

  1. execute terraform plan -var 'env=stage'

Error and Debug Output

│ Error: error while fetching registry 01766bde-de1b-4683-9716-b02a8ce74277: json: cannot unmarshal number 6541787922 into Go struct field StorageUsage.properties.storageUsage.bytes of type int32
│ 
│   with ionoscloud_container_registry.main,
│   on main.tf line 72, in resource "ionoscloud_container_registry" "main":
│   72: resource "ionoscloud_container_registry" "main" {

Additional Notes

Problem showed after after a while. Probably the issue is that the Storage Size of the container registry increased and now exceeds int32 max value.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.