diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000000..e69de29bb2 diff --git a/CNAME b/CNAME new file mode 100644 index 0000000000..4307d5835c --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +go.anx.io diff --git a/chroma/style.css b/chroma/style.css new file mode 100644 index 0000000000..b275a7e4f6 --- /dev/null +++ b/chroma/style.css @@ -0,0 +1,87 @@ +/* Background */ .bg { ; -moz-tab-size: 4; -o-tab-size: 4; tab-size: 4 } +/* PreWrapper */ .chroma { ; -moz-tab-size: 4; -o-tab-size: 4; tab-size: 4; } +/* LineNumbers targeted by URL anchor */ .chroma .ln:target { background-color: #e5e5e5 } +/* LineNumbersTable targeted by URL anchor */ .chroma .lnt:target { background-color: #e5e5e5 } +/* Other */ .chroma .x { } +/* Error */ .chroma .err { } +/* CodeLine */ .chroma .cl { } +/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; } +/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; } +/* LineHighlight */ .chroma .hl { background-color: #e5e5e5 } +/* LineNumbersTable */ .chroma .lnt { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f } +/* LineNumbers */ .chroma .ln { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f } +/* Line */ .chroma .line { display: flex; } +/* Keyword */ .chroma .k { color: #008000; font-weight: bold } +/* KeywordConstant */ .chroma .kc { color: #008000; font-weight: bold } +/* KeywordDeclaration */ .chroma .kd { color: #008000; font-weight: bold } +/* KeywordNamespace */ .chroma .kn { color: #008000; font-weight: bold } +/* KeywordPseudo */ .chroma .kp { color: #008000 } +/* KeywordReserved */ .chroma .kr { color: #008000; font-weight: bold } +/* KeywordType */ .chroma .kt { color: #b00040 } +/* Name */ .chroma .n { } +/* NameAttribute */ .chroma .na { color: #7d9029 } +/* NameBuiltin */ .chroma .nb { color: #008000 } +/* NameBuiltinPseudo */ .chroma .bp { } +/* NameClass */ .chroma .nc { color: #0000ff; font-weight: bold } +/* NameConstant */ .chroma .no { color: #880000 } +/* NameDecorator */ .chroma .nd { color: #aa22ff } +/* NameEntity */ .chroma .ni { color: #999999; font-weight: bold } +/* NameException */ .chroma .ne { color: #d2413a; font-weight: bold } +/* NameFunction */ .chroma .nf { color: #0000ff } +/* NameFunctionMagic */ .chroma .fm { } +/* NameLabel */ .chroma .nl { color: #a0a000 } +/* NameNamespace */ .chroma .nn { color: #0000ff; font-weight: bold } +/* NameOther */ .chroma .nx { } +/* NameProperty */ .chroma .py { } +/* NameTag */ .chroma .nt { color: #008000; font-weight: bold } +/* NameVariable */ .chroma .nv { color: #19177c } +/* NameVariableClass */ .chroma .vc { } +/* NameVariableGlobal */ .chroma .vg { } +/* NameVariableInstance */ .chroma .vi { } +/* NameVariableMagic */ .chroma .vm { } +/* Literal */ .chroma .l { } +/* LiteralDate */ .chroma .ld { } +/* LiteralString */ .chroma .s { color: #ba2121 } +/* LiteralStringAffix */ .chroma .sa { color: #ba2121 } +/* LiteralStringBacktick */ .chroma .sb { color: #ba2121 } +/* LiteralStringChar */ .chroma .sc { color: #ba2121 } +/* LiteralStringDelimiter */ .chroma .dl { color: #ba2121 } +/* LiteralStringDoc */ .chroma .sd { color: #ba2121; font-style: italic } +/* LiteralStringDouble */ .chroma .s2 { color: #ba2121 } +/* LiteralStringEscape */ .chroma .se { color: #bb6622; font-weight: bold } +/* LiteralStringHeredoc */ .chroma .sh { color: #ba2121 } +/* LiteralStringInterpol */ .chroma .si { color: #bb6688; font-weight: bold } +/* LiteralStringOther */ .chroma .sx { color: #008000 } +/* LiteralStringRegex */ .chroma .sr { color: #bb6688 } +/* LiteralStringSingle */ .chroma .s1 { color: #ba2121 } +/* LiteralStringSymbol */ .chroma .ss { color: #19177c } +/* LiteralNumber */ .chroma .m { color: #666666 } +/* LiteralNumberBin */ .chroma .mb { color: #666666 } +/* LiteralNumberFloat */ .chroma .mf { color: #666666 } +/* LiteralNumberHex */ .chroma .mh { color: #666666 } +/* LiteralNumberInteger */ .chroma .mi { color: #666666 } +/* LiteralNumberIntegerLong */ .chroma .il { color: #666666 } +/* LiteralNumberOct */ .chroma .mo { color: #666666 } +/* Operator */ .chroma .o { color: #666666 } +/* OperatorWord */ .chroma .ow { color: #aa22ff; font-weight: bold } +/* Punctuation */ .chroma .p { } +/* Comment */ .chroma .c { color: #408080; font-style: italic } +/* CommentHashbang */ .chroma .ch { color: #408080; font-style: italic } +/* CommentMultiline */ .chroma .cm { color: #408080; font-style: italic } +/* CommentSingle */ .chroma .c1 { color: #408080; font-style: italic } +/* CommentSpecial */ .chroma .cs { color: #408080; font-style: italic } +/* CommentPreproc */ .chroma .cp { color: #bc7a00 } +/* CommentPreprocFile */ .chroma .cpf { color: #bc7a00 } +/* Generic */ .chroma .g { } +/* GenericDeleted */ .chroma .gd { color: #a00000 } +/* GenericEmph */ .chroma .ge { font-style: italic } +/* GenericError */ .chroma .gr { color: #ff0000 } +/* GenericHeading */ .chroma .gh { color: #000080; font-weight: bold } +/* GenericInserted */ .chroma .gi { color: #00a000 } +/* GenericOutput */ .chroma .go { color: #888888 } +/* GenericPrompt */ .chroma .gp { color: #000080; font-weight: bold } +/* GenericStrong */ .chroma .gs { font-weight: bold } +/* GenericSubheading */ .chroma .gu { color: #800080; font-weight: bold } +/* GenericTraceback */ .chroma .gt { color: #0044dd } +/* GenericUnderline */ .chroma .gl { text-decoration: underline } +/* TextWhitespace */ .chroma .w { color: #bbbbbb } diff --git a/e5e/README.md/index.html b/e5e/README.md/index.html new file mode 100644 index 0000000000..17809ec512 --- /dev/null +++ b/e5e/README.md/index.html @@ -0,0 +1,136 @@ + + + + go.anx.io/e5e - go-e5e + + + + + + + + + +
+

go.anx.io/e5e


+ + + + The highest tagged major version is v2. + +
+
+

go-e5e

+

PkgGoDev +Build Status +codecov +Go Report Card

+

go-e5e is a support library to help Go developers build Anexia e5e functions.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u go.anx.io/e5e
+

Getting started

+
 1package main
+ 2
+ 3import (
+ 4	"runtime"
+ 5	
+ 6	"go.anx.io/e5e"
+ 7)
+ 8
+ 9type SumEventData struct {
+10	A int `json:"a"`
+11	B int `json:"b"`
+12}
+13
+14type SumEvent struct {
+15	e5e.Event
+16	Data SumEventData `json:"data,omitempty"`
+17}
+18
+19// Using a custom `e5e.Context` class is optional and only needed to access the `Data` attribute on the
+20// context. This attribute may be used to get the return value of an authorizer function, for example. If access
+21// to the `Data` attribute is not needed, the `e5e.Context` type can be used on the entrypoint directly.
+22
+23type SumContextData struct {
+24	AuthKey string `json:"auth_key"`
+25}
+26
+27type SumContext struct {
+28	e5e.Context
+29	Data SumContextData `json:"data,omitempty"`
+30}
+31
+32type entrypoints struct{}
+33
+34func (f *entrypoints) MyEntrypoint(event SumEvent, context SumContext) (e5e.Result, error) {
+35	return e5e.Result{
+36		Status: 200,
+37		ResponseHeaders: map[string]string{
+38			"x-custom-response-header": "This is a custom response header",
+39		},
+40		Data: map[string]interface{}{
+41			"sum": event.Data.A + event.Data.B,
+42			"version": runtime.Version(),
+43		},
+44	}, nil
+45}
+46
+47func main() {
+48	e5e.Start(&entrypoints{})
+49}
+

List of developers

+ + +
+ + + \ No newline at end of file diff --git a/e5e/README.md@v1.2.0/index.html b/e5e/README.md@v1.2.0/index.html new file mode 100644 index 0000000000..3db5f4e09a --- /dev/null +++ b/e5e/README.md@v1.2.0/index.html @@ -0,0 +1,123 @@ + + + + go.anx.io/e5e - go-e5e + + + + + + + + + +
+

go.anx.io/e5e


+ + + + The highest tagged major version is v2. + +
+
+

go-e5e

+

PkgGoDev +Build Status +codecov +Go Report Card

+

go-e5e is a support library to help Go developers build Anexia e5e functions.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u go.anx.io/e5e
+

Getting started

+
 1package main
+ 2
+ 3import (
+ 4	"runtime"
+ 5	
+ 6	"go.anx.io/e5e"
+ 7)
+ 8
+ 9type SumData struct {
+10	A int `json:"a"`
+11	B int `json:"b"`
+12}
+13
+14type SumEvent struct {
+15	e5e.Event
+16	Data SumData `json:"data"`
+17}
+18
+19type entrypoints struct{}
+20
+21func (f *entrypoints) MyEntrypoint(event SumEvent, context e5e.Context) (e5e.Result, error) {
+22	return e5e.Result{
+23		Status: 200,
+24		ResponseHeaders: map[string]string{
+25			"x-custom-response-header": "This is a custom response header",
+26		},
+27		Data: map[string]interface{}{
+28			"sum": event.Data.A + event.Data.B,
+29			"version": runtime.Version(),
+30		},
+31	}, nil
+32}
+33
+34func main() {
+35	e5e.Start(&entrypoints{})
+36}
+

List of developers

+ + +
+ + + \ No newline at end of file diff --git a/e5e/README.md@v1.2.1/index.html b/e5e/README.md@v1.2.1/index.html new file mode 100644 index 0000000000..17809ec512 --- /dev/null +++ b/e5e/README.md@v1.2.1/index.html @@ -0,0 +1,136 @@ + + + + go.anx.io/e5e - go-e5e + + + + + + + + + +
+

go.anx.io/e5e


+ + + + The highest tagged major version is v2. + +
+
+

go-e5e

+

PkgGoDev +Build Status +codecov +Go Report Card

+

go-e5e is a support library to help Go developers build Anexia e5e functions.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u go.anx.io/e5e
+

Getting started

+
 1package main
+ 2
+ 3import (
+ 4	"runtime"
+ 5	
+ 6	"go.anx.io/e5e"
+ 7)
+ 8
+ 9type SumEventData struct {
+10	A int `json:"a"`
+11	B int `json:"b"`
+12}
+13
+14type SumEvent struct {
+15	e5e.Event
+16	Data SumEventData `json:"data,omitempty"`
+17}
+18
+19// Using a custom `e5e.Context` class is optional and only needed to access the `Data` attribute on the
+20// context. This attribute may be used to get the return value of an authorizer function, for example. If access
+21// to the `Data` attribute is not needed, the `e5e.Context` type can be used on the entrypoint directly.
+22
+23type SumContextData struct {
+24	AuthKey string `json:"auth_key"`
+25}
+26
+27type SumContext struct {
+28	e5e.Context
+29	Data SumContextData `json:"data,omitempty"`
+30}
+31
+32type entrypoints struct{}
+33
+34func (f *entrypoints) MyEntrypoint(event SumEvent, context SumContext) (e5e.Result, error) {
+35	return e5e.Result{
+36		Status: 200,
+37		ResponseHeaders: map[string]string{
+38			"x-custom-response-header": "This is a custom response header",
+39		},
+40		Data: map[string]interface{}{
+41			"sum": event.Data.A + event.Data.B,
+42			"version": runtime.Version(),
+43		},
+44	}, nil
+45}
+46
+47func main() {
+48	e5e.Start(&entrypoints{})
+49}
+

List of developers

+ + +
+ + + \ No newline at end of file diff --git a/e5e/index.html b/e5e/index.html new file mode 100644 index 0000000000..17809ec512 --- /dev/null +++ b/e5e/index.html @@ -0,0 +1,136 @@ + + + + go.anx.io/e5e - go-e5e + + + + + + + + + +
+

go.anx.io/e5e


+ + + + The highest tagged major version is v2. + +
+
+

go-e5e

+

PkgGoDev +Build Status +codecov +Go Report Card

+

go-e5e is a support library to help Go developers build Anexia e5e functions.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u go.anx.io/e5e
+

Getting started

+
 1package main
+ 2
+ 3import (
+ 4	"runtime"
+ 5	
+ 6	"go.anx.io/e5e"
+ 7)
+ 8
+ 9type SumEventData struct {
+10	A int `json:"a"`
+11	B int `json:"b"`
+12}
+13
+14type SumEvent struct {
+15	e5e.Event
+16	Data SumEventData `json:"data,omitempty"`
+17}
+18
+19// Using a custom `e5e.Context` class is optional and only needed to access the `Data` attribute on the
+20// context. This attribute may be used to get the return value of an authorizer function, for example. If access
+21// to the `Data` attribute is not needed, the `e5e.Context` type can be used on the entrypoint directly.
+22
+23type SumContextData struct {
+24	AuthKey string `json:"auth_key"`
+25}
+26
+27type SumContext struct {
+28	e5e.Context
+29	Data SumContextData `json:"data,omitempty"`
+30}
+31
+32type entrypoints struct{}
+33
+34func (f *entrypoints) MyEntrypoint(event SumEvent, context SumContext) (e5e.Result, error) {
+35	return e5e.Result{
+36		Status: 200,
+37		ResponseHeaders: map[string]string{
+38			"x-custom-response-header": "This is a custom response header",
+39		},
+40		Data: map[string]interface{}{
+41			"sum": event.Data.A + event.Data.B,
+42			"version": runtime.Version(),
+43		},
+44	}, nil
+45}
+46
+47func main() {
+48	e5e.Start(&entrypoints{})
+49}
+

List of developers

+ + +
+ + + \ No newline at end of file diff --git a/e5e/v2/README.md/index.html b/e5e/v2/README.md/index.html new file mode 100644 index 0000000000..3670a3e244 --- /dev/null +++ b/e5e/v2/README.md/index.html @@ -0,0 +1,119 @@ + + + + go.anx.io/e5e/v2 - go-e5e + + + + + + + + + +
+

go.anx.io/e5e/v2


+ + +
+
+

go-e5e

+

PkgGoDev +Build Status +codecov +Go Report Card

+

go-e5e is a support library to help Go developers build Anexia e5e functions.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u go.anx.io/e5e/v2
+

Getting started

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	
+ 6	"go.anx.io/e5e/v2"
+ 7)
+ 8
+ 9type SumData struct {
+10	A int `json:"a"`
+11	B int `json:"b"`
+12}
+13
+14func Sum(ctx context.Context, r e5e.Request[SumData, any]) (*e5e.Result, error) {
+15	result := r.Data().A + r.Data().B
+16	return &e5e.Result{
+17		Status: 200,
+18		ResponseHeaders: map[string]string{
+19			"x-custom-response-header": "This is a custom response header",
+20		},
+21		Data: result,
+22	}, nil
+23}
+24
+25func main() {
+26	e5e.AddHandlerFunc("Sum", Sum)
+27	e5e.Start(context.Background())
+28}
+29
+

List of developers

+ + + + + +
+ + + \ No newline at end of file diff --git a/e5e/v2/README.md@chore/SIANXSVC-1214-replace-codecov/index.html b/e5e/v2/README.md@chore/SIANXSVC-1214-replace-codecov/index.html new file mode 100644 index 0000000000..646d05110c --- /dev/null +++ b/e5e/v2/README.md@chore/SIANXSVC-1214-replace-codecov/index.html @@ -0,0 +1,119 @@ + + + + go.anx.io/e5e/v2 - go-e5e + + + + + + + + + +
+

go.anx.io/e5e/v2


+ + +
+
+

go-e5e

+

PkgGoDev +Build Status +Test Coverage +Go Report Card

+

go-e5e is a support library to help Go developers build Anexia e5e functions.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u go.anx.io/e5e/v2
+

Getting started

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	
+ 6	"go.anx.io/e5e/v2"
+ 7)
+ 8
+ 9type SumData struct {
+10	A int `json:"a"`
+11	B int `json:"b"`
+12}
+13
+14func Sum(ctx context.Context, r e5e.Request[SumData, any]) (*e5e.Result, error) {
+15	result := r.Data().A + r.Data().B
+16	return &e5e.Result{
+17		Status: 200,
+18		ResponseHeaders: map[string]string{
+19			"x-custom-response-header": "This is a custom response header",
+20		},
+21		Data: result,
+22	}, nil
+23}
+24
+25func main() {
+26	e5e.AddHandlerFunc("Sum", Sum)
+27	e5e.Start(context.Background())
+28}
+29
+

List of developers

+ + + + + +
+ + + \ No newline at end of file diff --git a/e5e/v2/README.md@main/index.html b/e5e/v2/README.md@main/index.html new file mode 100644 index 0000000000..557b718171 --- /dev/null +++ b/e5e/v2/README.md@main/index.html @@ -0,0 +1,119 @@ + + + + go.anx.io/e5e/v2 - go-e5e + + + + + + + + + +
+

go.anx.io/e5e/v2


+ + +
+
+

go-e5e

+

PkgGoDev +Build Status +Test Coverage +Go Report Card

+

go-e5e is a support library to help Go developers build Anexia e5e functions.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u go.anx.io/e5e/v2
+

Getting started

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	
+ 6	"go.anx.io/e5e/v2"
+ 7)
+ 8
+ 9type SumData struct {
+10	A int `json:"a"`
+11	B int `json:"b"`
+12}
+13
+14func Sum(ctx context.Context, r e5e.Request[SumData, any]) (*e5e.Result, error) {
+15	result := r.Data().A + r.Data().B
+16	return &e5e.Result{
+17		Status: 200,
+18		ResponseHeaders: map[string]string{
+19			"x-custom-response-header": "This is a custom response header",
+20		},
+21		Data: result,
+22	}, nil
+23}
+24
+25func main() {
+26	e5e.AddHandlerFunc("Sum", Sum)
+27	e5e.Start(context.Background())
+28}
+29
+

List of developers

+ + + + + +
+ + + \ No newline at end of file diff --git a/e5e/v2/README.md@v2.0.0/index.html b/e5e/v2/README.md@v2.0.0/index.html new file mode 100644 index 0000000000..9bb6479fab --- /dev/null +++ b/e5e/v2/README.md@v2.0.0/index.html @@ -0,0 +1,119 @@ + + + + go.anx.io/e5e/v2 - go-e5e + + + + + + + + + +
+

go.anx.io/e5e/v2


+ + +
+
+

go-e5e

+

PkgGoDev +Build Status +codecov +Go Report Card

+

go-e5e is a support library to help Go developers build Anexia e5e functions.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u go.anx.io/e5e/v2
+

Getting started

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	
+ 6	"go.anx.io/e5e/v2"
+ 7)
+ 8
+ 9type SumData struct {
+10	A int `json:"a"`
+11	B int `json:"b"`
+12}
+13
+14func Sum(ctx context.Context, r e5e.Request[SumData, any]) (*e5e.Result, error) {
+15	result := r.Data().A + r.Data().B
+16	return &e5e.Result{
+17		Status: 200,
+18		ResponseHeaders: map[string]string{
+19			"x-custom-response-header": "This is a custom response header",
+20		},
+21		Data: result,
+22	}, nil
+23}
+24
+25func main() {
+26	e5e.AddHandlerFunc("Sum", Sum)
+27	e5e.Start(context.Background())
+28}
+29
+

List of developers

+ + + + + +
+ + + \ No newline at end of file diff --git a/e5e/v2/README.md@v2.0.1/index.html b/e5e/v2/README.md@v2.0.1/index.html new file mode 100644 index 0000000000..0a829da6ad --- /dev/null +++ b/e5e/v2/README.md@v2.0.1/index.html @@ -0,0 +1,119 @@ + + + + go.anx.io/e5e/v2 - go-e5e + + + + + + + + + +
+

go.anx.io/e5e/v2


+ + +
+
+

go-e5e

+

PkgGoDev +Build Status +codecov +Go Report Card

+

go-e5e is a support library to help Go developers build Anexia e5e functions.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u go.anx.io/e5e/v2
+

Getting started

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	
+ 6	"go.anx.io/e5e/v2"
+ 7)
+ 8
+ 9type SumData struct {
+10	A int `json:"a"`
+11	B int `json:"b"`
+12}
+13
+14func Sum(ctx context.Context, r e5e.Request[SumData, any]) (*e5e.Result, error) {
+15	result := r.Data().A + r.Data().B
+16	return &e5e.Result{
+17		Status: 200,
+18		ResponseHeaders: map[string]string{
+19			"x-custom-response-header": "This is a custom response header",
+20		},
+21		Data: result,
+22	}, nil
+23}
+24
+25func main() {
+26	e5e.AddHandlerFunc("Sum", Sum)
+27	e5e.Start(context.Background())
+28}
+29
+

List of developers

+ + + + + +
+ + + \ No newline at end of file diff --git a/e5e/v2/README.md@v2.1.0/index.html b/e5e/v2/README.md@v2.1.0/index.html new file mode 100644 index 0000000000..3670a3e244 --- /dev/null +++ b/e5e/v2/README.md@v2.1.0/index.html @@ -0,0 +1,119 @@ + + + + go.anx.io/e5e/v2 - go-e5e + + + + + + + + + +
+

go.anx.io/e5e/v2


+ + +
+
+

go-e5e

+

PkgGoDev +Build Status +codecov +Go Report Card

+

go-e5e is a support library to help Go developers build Anexia e5e functions.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u go.anx.io/e5e/v2
+

Getting started

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	
+ 6	"go.anx.io/e5e/v2"
+ 7)
+ 8
+ 9type SumData struct {
+10	A int `json:"a"`
+11	B int `json:"b"`
+12}
+13
+14func Sum(ctx context.Context, r e5e.Request[SumData, any]) (*e5e.Result, error) {
+15	result := r.Data().A + r.Data().B
+16	return &e5e.Result{
+17		Status: 200,
+18		ResponseHeaders: map[string]string{
+19			"x-custom-response-header": "This is a custom response header",
+20		},
+21		Data: result,
+22	}, nil
+23}
+24
+25func main() {
+26	e5e.AddHandlerFunc("Sum", Sum)
+27	e5e.Start(context.Background())
+28}
+29
+

List of developers

+ + + + + +
+ + + \ No newline at end of file diff --git a/e5e/v2/index.html b/e5e/v2/index.html new file mode 100644 index 0000000000..3670a3e244 --- /dev/null +++ b/e5e/v2/index.html @@ -0,0 +1,119 @@ + + + + go.anx.io/e5e/v2 - go-e5e + + + + + + + + + +
+

go.anx.io/e5e/v2


+ + +
+
+

go-e5e

+

PkgGoDev +Build Status +codecov +Go Report Card

+

go-e5e is a support library to help Go developers build Anexia e5e functions.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u go.anx.io/e5e/v2
+

Getting started

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	
+ 6	"go.anx.io/e5e/v2"
+ 7)
+ 8
+ 9type SumData struct {
+10	A int `json:"a"`
+11	B int `json:"b"`
+12}
+13
+14func Sum(ctx context.Context, r e5e.Request[SumData, any]) (*e5e.Result, error) {
+15	result := r.Data().A + r.Data().B
+16	return &e5e.Result{
+17		Status: 200,
+18		ResponseHeaders: map[string]string{
+19			"x-custom-response-header": "This is a custom response header",
+20		},
+21		Data: result,
+22	}, nil
+23}
+24
+25func main() {
+26	e5e.AddHandlerFunc("Sum", Sum)
+27	e5e.Start(context.Background())
+28}
+29
+

List of developers

+ + + + + +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md/index.html b/go-anxcloud/README.md/index.html new file mode 100644 index 0000000000..06208f93e1 --- /dev/null +++ b/go-anxcloud/README.md/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@SYSENG-1670/make-vm-nics-updatable/index.html b/go-anxcloud/README.md@SYSENG-1670/make-vm-nics-updatable/index.html new file mode 100644 index 0000000000..f46298ef0e --- /dev/null +++ b/go-anxcloud/README.md@SYSENG-1670/make-vm-nics-updatable/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@SYSENG-1741/index.html b/go-anxcloud/README.md@SYSENG-1741/index.html new file mode 100644 index 0000000000..112a3f6af3 --- /dev/null +++ b/go-anxcloud/README.md@SYSENG-1741/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@SYSENG-1749/named-template-latest-fallback/index.html b/go-anxcloud/README.md@SYSENG-1749/named-template-latest-fallback/index.html new file mode 100644 index 0000000000..14be89ee94 --- /dev/null +++ b/go-anxcloud/README.md@SYSENG-1749/named-template-latest-fallback/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@add-ipam-reserve-specific/index.html b/go-anxcloud/README.md@add-ipam-reserve-specific/index.html new file mode 100644 index 0000000000..70c9194ae4 --- /dev/null +++ b/go-anxcloud/README.md@add-ipam-reserve-specific/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@decode-prefix-vlans/index.html b/go-anxcloud/README.md@decode-prefix-vlans/index.html new file mode 100644 index 0000000000..b412165144 --- /dev/null +++ b/go-anxcloud/README.md@decode-prefix-vlans/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@github-actions-refactor-2/index.html b/go-anxcloud/README.md@github-actions-refactor-2/index.html new file mode 100644 index 0000000000..8731a992ac --- /dev/null +++ b/go-anxcloud/README.md@github-actions-refactor-2/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@joster/change-ouxpzmnsrxxq/index.html b/go-anxcloud/README.md@joster/change-ouxpzmnsrxxq/index.html new file mode 100644 index 0000000000..dc6be2a20b --- /dev/null +++ b/go-anxcloud/README.md@joster/change-ouxpzmnsrxxq/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@lbaasv2-cs/index.html b/go-anxcloud/README.md@lbaasv2-cs/index.html new file mode 100644 index 0000000000..96919be3ce --- /dev/null +++ b/go-anxcloud/README.md@lbaasv2-cs/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@main/index.html b/go-anxcloud/README.md@main/index.html new file mode 100644 index 0000000000..656edb58e4 --- /dev/null +++ b/go-anxcloud/README.md@main/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@mgmt-bindings/index.html b/go-anxcloud/README.md@mgmt-bindings/index.html new file mode 100644 index 0000000000..5920d34fe3 --- /dev/null +++ b/go-anxcloud/README.md@mgmt-bindings/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@migrate-test-resources/index.html b/go-anxcloud/README.md@migrate-test-resources/index.html new file mode 100644 index 0000000000..293d7f8b80 --- /dev/null +++ b/go-anxcloud/README.md@migrate-test-resources/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@prepare-release-v0.6.3/index.html b/go-anxcloud/README.md@prepare-release-v0.6.3/index.html new file mode 100644 index 0000000000..c7b3732231 --- /dev/null +++ b/go-anxcloud/README.md@prepare-release-v0.6.3/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@prepare-release-v0.6.4/index.html b/go-anxcloud/README.md@prepare-release-v0.6.4/index.html new file mode 100644 index 0000000000..9a10d4e5e4 --- /dev/null +++ b/go-anxcloud/README.md@prepare-release-v0.6.4/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@syseng-1210/wip-deepcopy-generator/index.html b/go-anxcloud/README.md@syseng-1210/wip-deepcopy-generator/index.html new file mode 100644 index 0000000000..04074e5266 --- /dev/null +++ b/go-anxcloud/README.md@syseng-1210/wip-deepcopy-generator/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@syseng-1358/automatic-resource-tagging-2/index.html b/go-anxcloud/README.md@syseng-1358/automatic-resource-tagging-2/index.html new file mode 100644 index 0000000000..d3dadae0fd --- /dev/null +++ b/go-anxcloud/README.md@syseng-1358/automatic-resource-tagging-2/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@syseng-728/cancel-object-channel/index.html b/go-anxcloud/README.md@syseng-728/cancel-object-channel/index.html new file mode 100644 index 0000000000..c528a85c76 --- /dev/null +++ b/go-anxcloud/README.md@syseng-728/cancel-object-channel/index.html @@ -0,0 +1,313 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@syseng-923/ipam-generic-client/index.html b/go-anxcloud/README.md@syseng-923/ipam-generic-client/index.html new file mode 100644 index 0000000000..d27259e683 --- /dev/null +++ b/go-anxcloud/README.md@syseng-923/ipam-generic-client/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.1.0/index.html b/go-anxcloud/README.md@v0.1.0/index.html new file mode 100644 index 0000000000..5d4ca09b82 --- /dev/null +++ b/go-anxcloud/README.md@v0.1.0/index.html @@ -0,0 +1,248 @@ + + + + go.anx.io/go-anxcloud - anxcloud + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

anxcloud

+

go client for anexia engine

+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.2.0/index.html b/go-anxcloud/README.md@v0.2.0/index.html new file mode 100644 index 0000000000..4f3ff3cc6d --- /dev/null +++ b/go-anxcloud/README.md@v0.2.0/index.html @@ -0,0 +1,248 @@ + + + + go.anx.io/go-anxcloud - anxcloud + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

anxcloud

+

go client for anexia engine

+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.0/index.html b/go-anxcloud/README.md@v0.3.0/index.html new file mode 100644 index 0000000000..fd1f822be8 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.0/index.html @@ -0,0 +1,248 @@ + + + + go.anx.io/go-anxcloud - anxcloud + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

anxcloud

+

go client for anexia engine

+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.1/index.html b/go-anxcloud/README.md@v0.3.1/index.html new file mode 100644 index 0000000000..52818271f6 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.1/index.html @@ -0,0 +1,248 @@ + + + + go.anx.io/go-anxcloud - anxcloud + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

anxcloud

+

go client for anexia engine

+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.10/index.html b/go-anxcloud/README.md@v0.3.10/index.html new file mode 100644 index 0000000000..be1dc05489 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.10/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.11/index.html b/go-anxcloud/README.md@v0.3.11/index.html new file mode 100644 index 0000000000..7378db3af6 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.11/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.12/index.html b/go-anxcloud/README.md@v0.3.12/index.html new file mode 100644 index 0000000000..1d0f9652d4 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.12/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.13/index.html b/go-anxcloud/README.md@v0.3.13/index.html new file mode 100644 index 0000000000..a26fd529f9 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.13/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.14/index.html b/go-anxcloud/README.md@v0.3.14/index.html new file mode 100644 index 0000000000..b079a7140b --- /dev/null +++ b/go-anxcloud/README.md@v0.3.14/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.15/index.html b/go-anxcloud/README.md@v0.3.15/index.html new file mode 100644 index 0000000000..ee5f7727b4 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.15/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.16/index.html b/go-anxcloud/README.md@v0.3.16/index.html new file mode 100644 index 0000000000..c8ad9cb7c0 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.16/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.17/index.html b/go-anxcloud/README.md@v0.3.17/index.html new file mode 100644 index 0000000000..244ab69ba1 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.17/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.18/index.html b/go-anxcloud/README.md@v0.3.18/index.html new file mode 100644 index 0000000000..535851c7a4 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.18/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.19/index.html b/go-anxcloud/README.md@v0.3.19/index.html new file mode 100644 index 0000000000..6abbdcd751 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.19/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.2/index.html b/go-anxcloud/README.md@v0.3.2/index.html new file mode 100644 index 0000000000..b712baa623 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.2/index.html @@ -0,0 +1,248 @@ + + + + go.anx.io/go-anxcloud - anxcloud + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

anxcloud

+

go client for anexia engine

+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.20/index.html b/go-anxcloud/README.md@v0.3.20/index.html new file mode 100644 index 0000000000..d01aa6bfd3 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.20/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.21/index.html b/go-anxcloud/README.md@v0.3.21/index.html new file mode 100644 index 0000000000..38cd01a2ad --- /dev/null +++ b/go-anxcloud/README.md@v0.3.21/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.22/index.html b/go-anxcloud/README.md@v0.3.22/index.html new file mode 100644 index 0000000000..5cafd81433 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.22/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.23/index.html b/go-anxcloud/README.md@v0.3.23/index.html new file mode 100644 index 0000000000..1c636157f3 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.23/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.24/index.html b/go-anxcloud/README.md@v0.3.24/index.html new file mode 100644 index 0000000000..120ecd03e7 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.24/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.25/index.html b/go-anxcloud/README.md@v0.3.25/index.html new file mode 100644 index 0000000000..4caa24d130 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.25/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.26/index.html b/go-anxcloud/README.md@v0.3.26/index.html new file mode 100644 index 0000000000..92002e1a49 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.26/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.27/index.html b/go-anxcloud/README.md@v0.3.27/index.html new file mode 100644 index 0000000000..726730b4af --- /dev/null +++ b/go-anxcloud/README.md@v0.3.27/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.28/index.html b/go-anxcloud/README.md@v0.3.28/index.html new file mode 100644 index 0000000000..33e6f1d0ab --- /dev/null +++ b/go-anxcloud/README.md@v0.3.28/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.3/index.html b/go-anxcloud/README.md@v0.3.3/index.html new file mode 100644 index 0000000000..43ac01bbba --- /dev/null +++ b/go-anxcloud/README.md@v0.3.3/index.html @@ -0,0 +1,248 @@ + + + + go.anx.io/go-anxcloud - anxcloud + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

anxcloud

+

go client for anexia engine

+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.4/index.html b/go-anxcloud/README.md@v0.3.4/index.html new file mode 100644 index 0000000000..30733d74a9 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.4/index.html @@ -0,0 +1,248 @@ + + + + go.anx.io/go-anxcloud - anxcloud + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

anxcloud

+

go client for anexia engine

+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.5/index.html b/go-anxcloud/README.md@v0.3.5/index.html new file mode 100644 index 0000000000..600cb00677 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.5/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.6/index.html b/go-anxcloud/README.md@v0.3.6/index.html new file mode 100644 index 0000000000..7e7a9d2a64 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.6/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.7/index.html b/go-anxcloud/README.md@v0.3.7/index.html new file mode 100644 index 0000000000..456652bbc7 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.7/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.8/index.html b/go-anxcloud/README.md@v0.3.8/index.html new file mode 100644 index 0000000000..4f63c8cb16 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.8/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.3.9/index.html b/go-anxcloud/README.md@v0.3.9/index.html new file mode 100644 index 0000000000..4b25fa5b41 --- /dev/null +++ b/go-anxcloud/README.md@v0.3.9/index.html @@ -0,0 +1,312 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia multi purpose API.

+

Installing

+

To use the SDK, just add github.com/anexia-it/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the API. See here for more info. +I you crave for an example, take a look at the terraform provider for this project

+

Example

+

The following code shows how to create a VM. To be able to do that you need to set the environment variable ANEXIA_TOKEN to your access token. +Afterwards you can run the following.

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "github.com/anexia-it/go-anxcloud/pkg"
+ 9	"github.com/anexia-it/go-anxcloud/pkg/client"
+10	"github.com/anexia-it/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client from environment variables, do not unset env afterwards.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.4.0/index.html b/go-anxcloud/README.md@v0.4.0/index.html new file mode 100644 index 0000000000..6614ed5103 --- /dev/null +++ b/go-anxcloud/README.md@v0.4.0/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.4.1/index.html b/go-anxcloud/README.md@v0.4.1/index.html new file mode 100644 index 0000000000..e08710ad5a --- /dev/null +++ b/go-anxcloud/README.md@v0.4.1/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.4.2/index.html b/go-anxcloud/README.md@v0.4.2/index.html new file mode 100644 index 0000000000..751c691f64 --- /dev/null +++ b/go-anxcloud/README.md@v0.4.2/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.4.3/index.html b/go-anxcloud/README.md@v0.4.3/index.html new file mode 100644 index 0000000000..85424acaa8 --- /dev/null +++ b/go-anxcloud/README.md@v0.4.3/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.4.4/index.html b/go-anxcloud/README.md@v0.4.4/index.html new file mode 100644 index 0000000000..7c809af6fb --- /dev/null +++ b/go-anxcloud/README.md@v0.4.4/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.4.5/index.html b/go-anxcloud/README.md@v0.4.5/index.html new file mode 100644 index 0000000000..d2bd80c36b --- /dev/null +++ b/go-anxcloud/README.md@v0.4.5/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.4.6/index.html b/go-anxcloud/README.md@v0.4.6/index.html new file mode 100644 index 0000000000..8205b54a8d --- /dev/null +++ b/go-anxcloud/README.md@v0.4.6/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.5.0/index.html b/go-anxcloud/README.md@v0.5.0/index.html new file mode 100644 index 0000000000..018f9491b4 --- /dev/null +++ b/go-anxcloud/README.md@v0.5.0/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.5.1/index.html b/go-anxcloud/README.md@v0.5.1/index.html new file mode 100644 index 0000000000..02301d4f46 --- /dev/null +++ b/go-anxcloud/README.md@v0.5.1/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.5.2/index.html b/go-anxcloud/README.md@v0.5.2/index.html new file mode 100644 index 0000000000..25675be53c --- /dev/null +++ b/go-anxcloud/README.md@v0.5.2/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.5.3/index.html b/go-anxcloud/README.md@v0.5.3/index.html new file mode 100644 index 0000000000..dd999a5ec4 --- /dev/null +++ b/go-anxcloud/README.md@v0.5.3/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.6.0/index.html b/go-anxcloud/README.md@v0.6.0/index.html new file mode 100644 index 0000000000..4bf2d1aae6 --- /dev/null +++ b/go-anxcloud/README.md@v0.6.0/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.6.1/index.html b/go-anxcloud/README.md@v0.6.1/index.html new file mode 100644 index 0000000000..c4a6273ca2 --- /dev/null +++ b/go-anxcloud/README.md@v0.6.1/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.6.2/index.html b/go-anxcloud/README.md@v0.6.2/index.html new file mode 100644 index 0000000000..7a0bb2dac1 --- /dev/null +++ b/go-anxcloud/README.md@v0.6.2/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.6.3/index.html b/go-anxcloud/README.md@v0.6.3/index.html new file mode 100644 index 0000000000..8b269e4bdf --- /dev/null +++ b/go-anxcloud/README.md@v0.6.3/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.6.4/index.html b/go-anxcloud/README.md@v0.6.4/index.html new file mode 100644 index 0000000000..0c3bab66b6 --- /dev/null +++ b/go-anxcloud/README.md@v0.6.4/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.7.0/index.html b/go-anxcloud/README.md@v0.7.0/index.html new file mode 100644 index 0000000000..db40cb46ae --- /dev/null +++ b/go-anxcloud/README.md@v0.7.0/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.7.1/index.html b/go-anxcloud/README.md@v0.7.1/index.html new file mode 100644 index 0000000000..c55b015379 --- /dev/null +++ b/go-anxcloud/README.md@v0.7.1/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/README.md@v0.7.2/index.html b/go-anxcloud/README.md@v0.7.2/index.html new file mode 100644 index 0000000000..06208f93e1 --- /dev/null +++ b/go-anxcloud/README.md@v0.7.2/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-anxcloud/index.html b/go-anxcloud/index.html new file mode 100644 index 0000000000..06208f93e1 --- /dev/null +++ b/go-anxcloud/index.html @@ -0,0 +1,373 @@ + + + + go.anx.io/go-anxcloud - Go Client for the Anexia API + + + + + + + + + +
+

go.anx.io/go-anxcloud


+ + +
+
+

Documentation +codecov

+

Go Client for the Anexia API

+

Go SDK for interacting with the Anexia Engine API.

+

Installing

+

To use the SDK, just add go.anx.io/go-anxcloud <version> to your Go module.

+

Getting started

+

Before using the SDK you should familiarize yourself with the Anexia Engine API.

+

The library is used in our terraform provider, check it out if you want some examples how to use it.

+

Example

+

Below is a short example using the new generic client in this package. Not all APIs can already be used with it, but we are working on that. +Find more examples in the docs (linked to docs for +main branch, not the latest (or any) release).

+
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"log"
+ 6
+ 7	"go.anx.io/go-anxcloud/pkg/api"
+ 8	apiTypes "go.anx.io/go-anxcloud/pkg/api/types"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10
+11	// apis usable with the generic client have their own package in a location analog to this
+12	lbaasv1 "go.anx.io/go-anxcloud/pkg/apis/lbaas/v1"
+13)
+14
+15func main() {
+16	apiClient, err := api.NewAPI(
+17		api.WithClientOptions(
+18			// Get auth token from ANEXIA_TOKEN environment variable.
+19			// The boolean parameter specifies if the environment variable should be unset.
+20			client.TokenFromEnv(false),
+21		),
+22	)
+23	if err != nil {
+24		log.Fatalf("Error creating ANX API client: %v", err)
+25	}
+26
+27	// let's list LBaaS backends of a known LoadBalancer
+28	frontend := lbaasv1.Frontend{
+29		LoadBalancer: &lbaasv1.LoadBalancer{Identifier: "285b954fdf2a449c8fdae01cc6074025"},
+30	}
+31
+32	var frontends apiTypes.ObjectChannel
+33	err = apiClient.List(context.TODO(), &frontend,
+34		// Listing can be done with either a page iterator or a channel, we use a channel here.
+35		api.ObjectChannel(&frontends),
+36
+37		// Most APIs only give a very small subset when listing resources, add this flag to
+38		// get all attributes, at the cost of doing lots of API requests.
+39		api.FullObjects(true),
+40	)
+41	if err != nil {
+42		log.Fatalf("Error listing backends for LoadBalancer '%v': %v", frontend.LoadBalancer.Identifier, err)
+43	}
+44
+45	for retriever := range frontends {
+46		// reinitialise frontend every loop to reset pointers and avoid potential overwriting of data in the next loop
+47		var frontend lbaasv1.Frontend
+48		if err := retriever(&frontend); err != nil {
+49			log.Fatalf("Error retrieving Frontend: %v", err)
+50		}
+51
+52		log.Printf("Got Frontend named '%v' with mode '%v'", frontend.Name, frontend.Mode)
+53	}
+54}
+

This new generic client will one day be the only client in go-anxcloud. The legacy API-specific clients are deprecated and will be removed in the +go-anxcloud release following the one with all APIs go-anxcloud supports usable with the generic client (so if the generic client in 0.5.0 supports +at least everything there is another client for in go-anxcloud, 0.6.0 will drop the API-specific clients).

+ +
 1package main
+ 2
+ 3import (
+ 4	"context"
+ 5	"fmt"
+ 6	"time"
+ 7
+ 8	anexia "go.anx.io/go-anxcloud/pkg"
+ 9	"go.anx.io/go-anxcloud/pkg/client"
+10	"go.anx.io/go-anxcloud/pkg/vsphere/provisioning/vm"
+11)
+12
+13func main() {
+14	vlan := "<ID of the VLAN the VM should have access to>"
+15	location := "<ID of the location the VM should be in>"
+16
+17	// Create client using the auth token in environment variable ANEXIA_TOKEN and do not unset the environment variable.
+18	c, err := client.New(client.AuthFromEnv(false))
+19	if err != nil {
+20		panic(fmt.Sprintf("could not create client: %v", err))
+21	}
+22
+23	// Get some API.
+24	provisioning := anexia.NewAPI(c).VSphere().Provisioning()
+25
+26	// Time out after 30 minutes. Yes it really takes that long sometimes.
+27	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+28	// Look for a free ip in the given VLAN. This IP is not reserved for you so better be quick.
+29	ips, err := provisioning.IPs().GetFree(ctx, location, vlan)
+30	defer cancel()
+31	if err != nil {
+32		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+33	}
+34	if len(ips) < 1 {
+35		panic(fmt.Sprintf("no IPs left for testing in vlan"))
+36	}
+37
+38	// Create a NIC for the VM and connect it to the VLAN.
+39	networkInterfaces := []vm.Network{{NICType: "vmxnet3", IPs: []string{ips[0].Identifier}, VLAN: vlan}}
+40	// Create the definition of the new VM. The ID you see here is Flatcar.
+41	definition := vm.NewAPI(c).NewDefinition(location, "template", "44b38284-6adb-430e-b4a4-1553e29f352f", "developersfirstvm", 2, 2048, 10, networkInterfaces)
+42	definition.SSH = "<your SSH pub key>"
+43
+44	// Provision the VM.
+45	provisionResponse, err := provisioning.VM().Provision(ctx, definition)
+46	if err != nil {
+47		panic(fmt.Sprintf("provisioning vm failed: %v", err))
+48	}
+49
+50	// Wait for the VM to be ready.
+51	_, err = provisioning.Progress().AwaitCompletion(ctx, provisionResponse.Identifier)
+52	if err != nil {
+53		panic(fmt.Sprintf("waiting for VM provisioning failed: %v", err))
+54	}
+55}
+
+ +
+ + + \ No newline at end of file diff --git a/go-cloudlog/README.md/index.html b/go-cloudlog/README.md/index.html new file mode 100644 index 0000000000..1b97f4a921 --- /dev/null +++ b/go-cloudlog/README.md/index.html @@ -0,0 +1,111 @@ + + + + go.anx.io/go-cloudlog - go-cloudlog + + + + + + + + + +
+

go.anx.io/go-cloudlog


+ + + + The highest tagged major version is v2. + +
+
+

go-cloudlog

+

GoDoc +Build Status +codecov +Go Report Card

+

go-cloudlog is a client library for Anexia CloudLog.

+

Currently it only provides to push events to CloudLog.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u github.com/anexia-it/go-cloudlog
+

Quickstart

+
 1package main
+ 2
+ 3import cloudlog "github.com/anexia-it/go-cloudlog"
+ 4
+ 5func main() {
+ 6
+ 7  // Init CloudLog client
+ 8  client, err := cloudlog.NewCloudLog("index", "token")
+ 9  if err != nil {
+10    panic(err)
+11  }
+12
+13  // Push simple message
+14  client.PushEvent("My first CloudLog event")
+15
+16  // Push document as map
+17  logger.PushEvent(map[string]interface{}{
+18	"timestamp": time.Now(),
+19	"user":      "test",
+20	"severity":  1,
+21	"message":   "My first CloudLog event",
+22  })
+23
+24  // Push document as map
+25  type Document struct {
+26	Timestamp uint64 `cloudlog:"timestamp"`
+27	User      string `cloudlog:"user"`
+28	Severity  int    `cloudlog:"severity"`
+29	Message   string `cloudlog:"message"`
+30  }
+31  logger.PushEvent(&Document{
+32 	Timestamp: 1495171849463,
+33	User:      "test",
+34	Severity:  1,
+35	Message:   "My first CloudLog event",
+36  })
+37}
+
+
+ + + \ No newline at end of file diff --git a/go-cloudlog/README.md@v2.0.0/index.html b/go-cloudlog/README.md@v2.0.0/index.html new file mode 100644 index 0000000000..1b97f4a921 --- /dev/null +++ b/go-cloudlog/README.md@v2.0.0/index.html @@ -0,0 +1,111 @@ + + + + go.anx.io/go-cloudlog - go-cloudlog + + + + + + + + + +
+

go.anx.io/go-cloudlog


+ + + + The highest tagged major version is v2. + +
+
+

go-cloudlog

+

GoDoc +Build Status +codecov +Go Report Card

+

go-cloudlog is a client library for Anexia CloudLog.

+

Currently it only provides to push events to CloudLog.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u github.com/anexia-it/go-cloudlog
+

Quickstart

+
 1package main
+ 2
+ 3import cloudlog "github.com/anexia-it/go-cloudlog"
+ 4
+ 5func main() {
+ 6
+ 7  // Init CloudLog client
+ 8  client, err := cloudlog.NewCloudLog("index", "token")
+ 9  if err != nil {
+10    panic(err)
+11  }
+12
+13  // Push simple message
+14  client.PushEvent("My first CloudLog event")
+15
+16  // Push document as map
+17  logger.PushEvent(map[string]interface{}{
+18	"timestamp": time.Now(),
+19	"user":      "test",
+20	"severity":  1,
+21	"message":   "My first CloudLog event",
+22  })
+23
+24  // Push document as map
+25  type Document struct {
+26	Timestamp uint64 `cloudlog:"timestamp"`
+27	User      string `cloudlog:"user"`
+28	Severity  int    `cloudlog:"severity"`
+29	Message   string `cloudlog:"message"`
+30  }
+31  logger.PushEvent(&Document{
+32 	Timestamp: 1495171849463,
+33	User:      "test",
+34	Severity:  1,
+35	Message:   "My first CloudLog event",
+36  })
+37}
+
+
+ + + \ No newline at end of file diff --git a/go-cloudlog/index.html b/go-cloudlog/index.html new file mode 100644 index 0000000000..1b97f4a921 --- /dev/null +++ b/go-cloudlog/index.html @@ -0,0 +1,111 @@ + + + + go.anx.io/go-cloudlog - go-cloudlog + + + + + + + + + +
+

go.anx.io/go-cloudlog


+ + + + The highest tagged major version is v2. + +
+
+

go-cloudlog

+

GoDoc +Build Status +codecov +Go Report Card

+

go-cloudlog is a client library for Anexia CloudLog.

+

Currently it only provides to push events to CloudLog.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u github.com/anexia-it/go-cloudlog
+

Quickstart

+
 1package main
+ 2
+ 3import cloudlog "github.com/anexia-it/go-cloudlog"
+ 4
+ 5func main() {
+ 6
+ 7  // Init CloudLog client
+ 8  client, err := cloudlog.NewCloudLog("index", "token")
+ 9  if err != nil {
+10    panic(err)
+11  }
+12
+13  // Push simple message
+14  client.PushEvent("My first CloudLog event")
+15
+16  // Push document as map
+17  logger.PushEvent(map[string]interface{}{
+18	"timestamp": time.Now(),
+19	"user":      "test",
+20	"severity":  1,
+21	"message":   "My first CloudLog event",
+22  })
+23
+24  // Push document as map
+25  type Document struct {
+26	Timestamp uint64 `cloudlog:"timestamp"`
+27	User      string `cloudlog:"user"`
+28	Severity  int    `cloudlog:"severity"`
+29	Message   string `cloudlog:"message"`
+30  }
+31  logger.PushEvent(&Document{
+32 	Timestamp: 1495171849463,
+33	User:      "test",
+34	Severity:  1,
+35	Message:   "My first CloudLog event",
+36  })
+37}
+
+
+ + + \ No newline at end of file diff --git a/go-cloudlog/v2/README.md/index.html b/go-cloudlog/v2/README.md/index.html new file mode 100644 index 0000000000..08bf1cc112 --- /dev/null +++ b/go-cloudlog/v2/README.md/index.html @@ -0,0 +1,108 @@ + + + + go.anx.io/go-cloudlog/v2 - go-cloudlog + + + + + + + + + +
+

go.anx.io/go-cloudlog/v2


+ + +
+
+

go-cloudlog

+

GoDoc +Build Status +codecov +Go Report Card

+

go-cloudlog is a client library for Anexia CloudLog.

+

Currently it only provides to push events to CloudLog.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u github.com/anexia-it/go-cloudlog
+

Quickstart

+
 1package main
+ 2
+ 3import cloudlog "github.com/anexia-it/go-cloudlog"
+ 4
+ 5func main() {
+ 6
+ 7  // Init CloudLog client
+ 8  client, err := cloudlog.NewCloudLog("index", "token")
+ 9  if err != nil {
+10    panic(err)
+11  }
+12
+13  // Push simple message
+14  client.PushEvent("My first CloudLog event")
+15
+16  // Push document as map
+17  logger.PushEvent(map[string]interface{}{
+18	"timestamp": time.Now(),
+19	"user":      "test",
+20	"severity":  1,
+21	"message":   "My first CloudLog event",
+22  })
+23
+24  // Push document as map
+25  type Document struct {
+26	Timestamp uint64 `cloudlog:"timestamp"`
+27	User      string `cloudlog:"user"`
+28	Severity  int    `cloudlog:"severity"`
+29	Message   string `cloudlog:"message"`
+30  }
+31  logger.PushEvent(&Document{
+32 	Timestamp: 1495171849463,
+33	User:      "test",
+34	Severity:  1,
+35	Message:   "My first CloudLog event",
+36  })
+37}
+
+
+ + + \ No newline at end of file diff --git a/go-cloudlog/v2/README.md@master/index.html b/go-cloudlog/v2/README.md@master/index.html new file mode 100644 index 0000000000..caac436705 --- /dev/null +++ b/go-cloudlog/v2/README.md@master/index.html @@ -0,0 +1,107 @@ + + + + go.anx.io/go-cloudlog/v2 - go-cloudlog + + + + + + + + + +
+

go.anx.io/go-cloudlog/v2


+ + +
+
+

go-cloudlog

+

GoDoc +Build Status +codecov +Go Report Card

+

go-cloudlog is a client library for Anexia CloudLog.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u github.com/anexia-it/go-cloudlog
+

Quickstart

+
 1package main
+ 2
+ 3import cloudlog "github.com/anexia-it/go-cloudlog"
+ 4
+ 5func main() {
+ 6
+ 7  // Init CloudLog client
+ 8  client, err := cloudlog.NewCloudLog("index", "token")
+ 9  if err != nil {
+10    panic(err)
+11  }
+12
+13  // Push simple message
+14  client.PushEvent("My first CloudLog event")
+15
+16  // Push document as map
+17  logger.PushEvent(map[string]interface{}{
+18	"timestamp": time.Now(),
+19	"user":      "test",
+20	"severity":  1,
+21	"message":   "My first CloudLog event",
+22  })
+23
+24  // Push document as map
+25  type Document struct {
+26	Timestamp uint64 `cloudlog:"timestamp"`
+27	User      string `cloudlog:"user"`
+28	Severity  int    `cloudlog:"severity"`
+29	Message   string `cloudlog:"message"`
+30  }
+31  logger.PushEvent(&Document{
+32 	Timestamp: 1495171849463,
+33	User:      "test",
+34	Severity:  1,
+35	Message:   "My first CloudLog event",
+36  })
+37}
+
+
+ + + \ No newline at end of file diff --git a/go-cloudlog/v2/README.md@v2.0.1/index.html b/go-cloudlog/v2/README.md@v2.0.1/index.html new file mode 100644 index 0000000000..d11f889388 --- /dev/null +++ b/go-cloudlog/v2/README.md@v2.0.1/index.html @@ -0,0 +1,108 @@ + + + + go.anx.io/go-cloudlog/v2 - go-cloudlog + + + + + + + + + +
+

go.anx.io/go-cloudlog/v2


+ + +
+
+

go-cloudlog

+

GoDoc +Build Status +codecov +Go Report Card

+

go-cloudlog is a client library for Anexia CloudLog.

+

Currently it only provides to push events to CloudLog.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u github.com/anexia-it/go-cloudlog
+

Quickstart

+
 1package main
+ 2
+ 3import cloudlog "github.com/anexia-it/go-cloudlog"
+ 4
+ 5func main() {
+ 6
+ 7  // Init CloudLog client
+ 8  client, err := cloudlog.NewCloudLog("index", "token")
+ 9  if err != nil {
+10    panic(err)
+11  }
+12
+13  // Push simple message
+14  client.PushEvent("My first CloudLog event")
+15
+16  // Push document as map
+17  logger.PushEvent(map[string]interface{}{
+18	"timestamp": time.Now(),
+19	"user":      "test",
+20	"severity":  1,
+21	"message":   "My first CloudLog event",
+22  })
+23
+24  // Push document as map
+25  type Document struct {
+26	Timestamp uint64 `cloudlog:"timestamp"`
+27	User      string `cloudlog:"user"`
+28	Severity  int    `cloudlog:"severity"`
+29	Message   string `cloudlog:"message"`
+30  }
+31  logger.PushEvent(&Document{
+32 	Timestamp: 1495171849463,
+33	User:      "test",
+34	Severity:  1,
+35	Message:   "My first CloudLog event",
+36  })
+37}
+
+
+ + + \ No newline at end of file diff --git a/go-cloudlog/v2/README.md@v2.0.2/index.html b/go-cloudlog/v2/README.md@v2.0.2/index.html new file mode 100644 index 0000000000..08bf1cc112 --- /dev/null +++ b/go-cloudlog/v2/README.md@v2.0.2/index.html @@ -0,0 +1,108 @@ + + + + go.anx.io/go-cloudlog/v2 - go-cloudlog + + + + + + + + + +
+

go.anx.io/go-cloudlog/v2


+ + +
+
+

go-cloudlog

+

GoDoc +Build Status +codecov +Go Report Card

+

go-cloudlog is a client library for Anexia CloudLog.

+

Currently it only provides to push events to CloudLog.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u github.com/anexia-it/go-cloudlog
+

Quickstart

+
 1package main
+ 2
+ 3import cloudlog "github.com/anexia-it/go-cloudlog"
+ 4
+ 5func main() {
+ 6
+ 7  // Init CloudLog client
+ 8  client, err := cloudlog.NewCloudLog("index", "token")
+ 9  if err != nil {
+10    panic(err)
+11  }
+12
+13  // Push simple message
+14  client.PushEvent("My first CloudLog event")
+15
+16  // Push document as map
+17  logger.PushEvent(map[string]interface{}{
+18	"timestamp": time.Now(),
+19	"user":      "test",
+20	"severity":  1,
+21	"message":   "My first CloudLog event",
+22  })
+23
+24  // Push document as map
+25  type Document struct {
+26	Timestamp uint64 `cloudlog:"timestamp"`
+27	User      string `cloudlog:"user"`
+28	Severity  int    `cloudlog:"severity"`
+29	Message   string `cloudlog:"message"`
+30  }
+31  logger.PushEvent(&Document{
+32 	Timestamp: 1495171849463,
+33	User:      "test",
+34	Severity:  1,
+35	Message:   "My first CloudLog event",
+36  })
+37}
+
+
+ + + \ No newline at end of file diff --git a/go-cloudlog/v2/index.html b/go-cloudlog/v2/index.html new file mode 100644 index 0000000000..08bf1cc112 --- /dev/null +++ b/go-cloudlog/v2/index.html @@ -0,0 +1,108 @@ + + + + go.anx.io/go-cloudlog/v2 - go-cloudlog + + + + + + + + + +
+

go.anx.io/go-cloudlog/v2


+ + +
+
+

go-cloudlog

+

GoDoc +Build Status +codecov +Go Report Card

+

go-cloudlog is a client library for Anexia CloudLog.

+

Currently it only provides to push events to CloudLog.

+

Install

+

With a correctly configured Go toolchain:

+
1go get -u github.com/anexia-it/go-cloudlog
+

Quickstart

+
 1package main
+ 2
+ 3import cloudlog "github.com/anexia-it/go-cloudlog"
+ 4
+ 5func main() {
+ 6
+ 7  // Init CloudLog client
+ 8  client, err := cloudlog.NewCloudLog("index", "token")
+ 9  if err != nil {
+10    panic(err)
+11  }
+12
+13  // Push simple message
+14  client.PushEvent("My first CloudLog event")
+15
+16  // Push document as map
+17  logger.PushEvent(map[string]interface{}{
+18	"timestamp": time.Now(),
+19	"user":      "test",
+20	"severity":  1,
+21	"message":   "My first CloudLog event",
+22  })
+23
+24  // Push document as map
+25  type Document struct {
+26	Timestamp uint64 `cloudlog:"timestamp"`
+27	User      string `cloudlog:"user"`
+28	Severity  int    `cloudlog:"severity"`
+29	Message   string `cloudlog:"message"`
+30  }
+31  logger.PushEvent(&Document{
+32 	Timestamp: 1495171849463,
+33	User:      "test",
+34	Severity:  1,
+35	Message:   "My first CloudLog event",
+36  })
+37}
+
+
+ + + \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000000..3955ac8f2f --- /dev/null +++ b/index.html @@ -0,0 +1,65 @@ + + + + + go.anx.io - go packages by Anexia + + + + + + + + +
+

+ go.anx.io - go packages by Anexia +

+
+
+

Hello world!

+

This website lists a collection of our Go packages, making them available via our vanity URL.

+

There might be more packages not added to this website, looking at our GitHub +is a good way to find all of them (the link filters for things written in Go).

+ +
+

go.anx.io/go-anxcloud

+ + Go Client for the Anexia API + + +
+ +
+

go.anx.io/e5e

+ + Support library to help Go developers build Anexia e5e functions + + +
+
+
+ + + \ No newline at end of file diff --git a/static/Anexia_Logo_RGB.svg b/static/Anexia_Logo_RGB.svg new file mode 100644 index 0000000000..843cc251dd --- /dev/null +++ b/static/Anexia_Logo_RGB.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/fonts/fira-sans-v11-latin-700.eot b/static/fonts/fira-sans-v11-latin-700.eot new file mode 100644 index 0000000000..37b7a5e31f Binary files /dev/null and b/static/fonts/fira-sans-v11-latin-700.eot differ diff --git a/static/fonts/fira-sans-v11-latin-700.svg b/static/fonts/fira-sans-v11-latin-700.svg new file mode 100644 index 0000000000..eb522e3218 --- /dev/null +++ b/static/fonts/fira-sans-v11-latin-700.svg @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/static/fonts/fira-sans-v11-latin-700.ttf b/static/fonts/fira-sans-v11-latin-700.ttf new file mode 100644 index 0000000000..4227efcc7c Binary files /dev/null and b/static/fonts/fira-sans-v11-latin-700.ttf differ diff --git a/static/fonts/fira-sans-v11-latin-700.woff b/static/fonts/fira-sans-v11-latin-700.woff new file mode 100644 index 0000000000..7d310b00c4 Binary files /dev/null and b/static/fonts/fira-sans-v11-latin-700.woff differ diff --git a/static/fonts/fira-sans-v11-latin-700.woff2 b/static/fonts/fira-sans-v11-latin-700.woff2 new file mode 100644 index 0000000000..74096323d8 Binary files /dev/null and b/static/fonts/fira-sans-v11-latin-700.woff2 differ diff --git a/static/fonts/fira-sans-v11-latin-italic.eot b/static/fonts/fira-sans-v11-latin-italic.eot new file mode 100644 index 0000000000..59dc13a137 Binary files /dev/null and b/static/fonts/fira-sans-v11-latin-italic.eot differ diff --git a/static/fonts/fira-sans-v11-latin-italic.svg b/static/fonts/fira-sans-v11-latin-italic.svg new file mode 100644 index 0000000000..55ceba89b2 --- /dev/null +++ b/static/fonts/fira-sans-v11-latin-italic.svg @@ -0,0 +1,340 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/static/fonts/fira-sans-v11-latin-italic.ttf b/static/fonts/fira-sans-v11-latin-italic.ttf new file mode 100644 index 0000000000..3695261979 Binary files /dev/null and b/static/fonts/fira-sans-v11-latin-italic.ttf differ diff --git a/static/fonts/fira-sans-v11-latin-italic.woff b/static/fonts/fira-sans-v11-latin-italic.woff new file mode 100644 index 0000000000..7e1d9ef761 Binary files /dev/null and b/static/fonts/fira-sans-v11-latin-italic.woff differ diff --git a/static/fonts/fira-sans-v11-latin-italic.woff2 b/static/fonts/fira-sans-v11-latin-italic.woff2 new file mode 100644 index 0000000000..069b9402b0 Binary files /dev/null and b/static/fonts/fira-sans-v11-latin-italic.woff2 differ diff --git a/static/fonts/fira-sans-v11-latin-regular.eot b/static/fonts/fira-sans-v11-latin-regular.eot new file mode 100644 index 0000000000..b9cc18fb17 Binary files /dev/null and b/static/fonts/fira-sans-v11-latin-regular.eot differ diff --git a/static/fonts/fira-sans-v11-latin-regular.svg b/static/fonts/fira-sans-v11-latin-regular.svg new file mode 100644 index 0000000000..1e520978de --- /dev/null +++ b/static/fonts/fira-sans-v11-latin-regular.svg @@ -0,0 +1,330 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/static/fonts/fira-sans-v11-latin-regular.ttf b/static/fonts/fira-sans-v11-latin-regular.ttf new file mode 100644 index 0000000000..8ad68a6e72 Binary files /dev/null and b/static/fonts/fira-sans-v11-latin-regular.ttf differ diff --git a/static/fonts/fira-sans-v11-latin-regular.woff b/static/fonts/fira-sans-v11-latin-regular.woff new file mode 100644 index 0000000000..dfa72751e1 Binary files /dev/null and b/static/fonts/fira-sans-v11-latin-regular.woff differ diff --git a/static/fonts/fira-sans-v11-latin-regular.woff2 b/static/fonts/fira-sans-v11-latin-regular.woff2 new file mode 100644 index 0000000000..ad3d10e663 Binary files /dev/null and b/static/fonts/fira-sans-v11-latin-regular.woff2 differ diff --git a/static/style.css b/static/style.css new file mode 100644 index 0000000000..914f8d690e --- /dev/null +++ b/static/style.css @@ -0,0 +1,353 @@ +/* generated by https://google-webfonts-helper.herokuapp.com/fonts/fira-sans?subsets=latin */ +/* fira-sans-regular - latin */ +@font-face { + font-family: 'Fira Sans'; + font-style: normal; + font-weight: 400; + src: url('/static/fonts/fira-sans-v11-latin-regular.eot'); /* IE9 Compat Modes */ + src: local(''), + url('/static/fonts/fira-sans-v11-latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ + url('/static/fonts/fira-sans-v11-latin-regular.woff2') format('woff2'), /* Super Modern Browsers */ + url('/static/fonts/fira-sans-v11-latin-regular.woff') format('woff'), /* Modern Browsers */ + url('/static/fonts/fira-sans-v11-latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */ + url('/static/fonts/fira-sans-v11-latin-regular.svg#FiraSans') format('svg'); /* Legacy iOS */ +} +/* fira-sans-italic - latin */ +@font-face { + font-family: 'Fira Sans'; + font-style: italic; + font-weight: 400; + src: url('/static/fonts/fira-sans-v11-latin-italic.eot'); /* IE9 Compat Modes */ + src: local(''), + url('/static/fonts/fira-sans-v11-latin-italic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ + url('/static/fonts/fira-sans-v11-latin-italic.woff2') format('woff2'), /* Super Modern Browsers */ + url('/static/fonts/fira-sans-v11-latin-italic.woff') format('woff'), /* Modern Browsers */ + url('/static/fonts/fira-sans-v11-latin-italic.ttf') format('truetype'), /* Safari, Android, iOS */ + url('/static/fonts/fira-sans-v11-latin-italic.svg#FiraSans') format('svg'); /* Legacy iOS */ +} +/* fira-sans-700 - latin */ +@font-face { + font-family: 'Fira Sans'; + font-style: normal; + font-weight: 700; + src: url('/static/fonts/fira-sans-v11-latin-700.eot'); /* IE9 Compat Modes */ + src: local(''), + url('/static/fonts/fira-sans-v11-latin-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ + url('/static/fonts/fira-sans-v11-latin-700.woff2') format('woff2'), /* Super Modern Browsers */ + url('/static/fonts/fira-sans-v11-latin-700.woff') format('woff'), /* Modern Browsers */ + url('/static/fonts/fira-sans-v11-latin-700.ttf') format('truetype'), /* Safari, Android, iOS */ + url('/static/fonts/fira-sans-v11-latin-700.svg#FiraSans') format('svg'); /* Legacy iOS */ +} + +html { + padding: 0; + margin: 0; +} + +body { + font-family: 'Fira Sans', sans-serif; + font-size: 16px; + font-variant-numeric: lining-nums; + color: #696969; + background: #002d6e; + + max-width: 60em; + padding: 40px; + padding-top: 30px; + margin: auto; + + line-height: 1.2em; +} + +body.mainpage { + max-width: 500px; +} + +body > header { + background-image: url(Anexia_Logo_RGB.svg); + background-repeat: no-repeat; + background-size: auto 45px; + background-color: #002d6e; + color: white; + + min-height: calc(2em + 45px); + box-sizing: border-box; + padding-bottom: 2.5em; +} + +body > header h1 { + margin-top: 0; + margin-bottom: 0; + margin-left: 130px; + line-height: 45px; + + font-weight: 400; + font-size: 20px; +} + +body > header > nav { + display: flex; + gap: 20px; + + line-height: 1em; + padding-left: 0; + padding-right: 0; +} + +.outdatedVersionNotice { + display: inline-block; + margin-top: 1em; +} + +.outdatedVersionNotice:before { + content: '🛈'; +} + +body > header nav label { + display: inline-block; +} + +body > header nav a { + text-decoration: none; + border-bottom: 1px solid transparent; +} + +body > header nav a:hover { + border-bottom: 1px solid #77BC1F; +} + +body > header nav a.common { + margin-left: auto; + margin-right: 0; +} + +body > header nav > ul > li { + display: inline-block; +} + +div.dropdown { + display: inline-block; + position: relative; + height: 1em; +} + +.dropdown menu { + line-height: 1em; + width: max-content; + + display: inline-block; + position: absolute; + padding: 0; + margin: 0; + margin-left: 0.5em; + top: 0; + + transition: all 0.1s ease-in-out; +} + +.dropdown menu li { + display: none; + opacity: 0; + transition: all 0.1s ease-in-out; + margin-right: 0; + padding-left: 1.5em; + padding-right: 0.5em; + line-height: 1.25em; + bottom: 0; +} + +.dropdown menu:not(:hover):not(:focus-within) li { + padding-left: 0; +} + +.dropdown menu:hover li a, +.dropdown menu:focus-within li a { + color: #696969; + display: block; + width: 100%; + height: 100%; + padding-top: 0.25em; + padding-bottom: 0.25em; + box-sizing: border-box; + transition: all .1s ease-in-out; +} + +.dropdown menu:hover li:hover a, +.dropdown menu:focus-within li:hover a { + color: white; +} + +.dropdown menu:focus-within > li a, +.dropdown menu:hover > li a, +.dropdown menu:focus-within > li a:hover, +.dropdown menu:hover > li a:hover { + border-bottom: none; +} + +.dropdown menu li[aria-selected="true"] { + margin-top: 0; + line-height: 1em; +} + +.dropdown menu li[aria-selected="true"], +.dropdown menu:hover li, +.dropdown menu:focus-within li { + display: block; + opacity: 1; +} + +.dropdown menu:hover, +.dropdown menu:focus-within { + max-height: 15em; + overflow: auto; + + background: white; + color: #696969; + border: 1px solid #b5b5b5; + box-shadow: 0 6px 12px rgb(0 0 0 / 18%); +} + +.dropdown menu> li.header a { + color: #77BC1F; +} + +.dropdown menu:focus-within > li, +.dropdown menu:hover > li { + color: #696969; + transition: all .1s ease-in-out; +} + +.dropdown menu:focus-within > li:hover, +.dropdown menu:hover > li:hover { + color: white; + background-color: #77BC1F +} + +.dropdown menu:focus-within > li[aria-selected="true"] a:before, +.dropdown menu:hover > li[aria-selected="true"] a:before { + content: '\2713'; + display: inline-block; + width: 1em; + color: #77BC1F; + margin-left: -1em; +} + +.dropdown menu:focus-within > li[aria-selected="true"]:hover a:before, +.dropdown menu:hover > li[aria-selected="true"]:hover a:before { + color: white; +} + +.dropdown menu li.majorVersion { + font-weight: bold; + padding-left: 0.5em; +} + +body > main { + padding: 40px; + margin: auto; + background: white; + line-height: 1.5em; +} + +body > main img { + max-width: 100%; +} + +main h1, +main h2 { + color: #003ca6; + font-weight: 400; + text-transform: uppercase; +} + +main h1 { + font-size: 1.75em; +} + +main h2 { + font-size: 1.5em; +} + +main section h1, +main h3 { + color: #696969; + font-weight: 400; + margin-block-start: 0em; + margin-block-end: 0em; + font-size:20px; +} + +/* `p:first-child + h1` is special case for the common "badges on top of README.md" */ +main h1:not(:first-child, p:first-child + h1), +main h2:not(:first-child), +main h3:not(:first-child) { + margin-top: 2em; +} + +main h1:after, +main h2:after, +main h3:after { + content: '—'; + display: block; + margin-top: 0.5em; + margin-bottom: -0.25em; +} + +section.packages { + display: flex; + flex-wrap: wrap; + gap: 20px; +} + +section.packages article { + display: inline-block; + width: 100%; + flex: 0 1 100%; + box-sizing: border-box; + padding: 20px; + border: 1px solid #d7d7d7; +} + +section.packages article footer a { + text-transform: uppercase; + text-decoration: none; +} + +section.packages article footer a:after { + content: ' >'; +} + +section.packages article footer a:hover { + border-bottom: 1px solid #77BC1F; +} + +body > footer { + color: white; + font-size: 12px; + margin-bottom: 40px; + clear: both; +} + +body > footer .copyright { + float: right; +} + +hr { + margin-top: 1.25rem; + margin-bottom: 1.25rem; + background-color: #003ca6; + border: 0; + height: 1px; +} + +pre { + overflow: auto; +} + +a[href] { + color: #77BC1F; +} + +a.latestVersion { + font-style: italic; +}