DistributionsApi

All URIs are relative to https://cdn.de-fra.ionos.com

Method
HTTP request
Description

Delete /distributions/{distributionId}

Delete Distribution

Get /distributions/{distributionId}

Retrieve Distribution

Get /distributions

Retrieve all Distributions

Post /distributions

Create Distribution

Put /distributions/{distributionId}

Ensure Distribution

DistributionsDelete

var result  = DistributionsDelete(ctx, distributionId)
                      .Execute()

Delete Distribution

Example

package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-cdn"
)

func main() {
    distributionId := "9ba15778-16c4-543c-8775-e52acf4853f5" // string | The ID (UUID) of the Distribution.

    configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := ionoscloud.NewAPIClient(configuration)
    resp, err := apiClient.DistributionsApi.DistributionsDelete(context.Background(), distributionId).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DistributionsApi.DistributionsDelete``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
}

Path Parameters

Name
Type
Description
Notes

ctx

context.Context

context for authentication, logging, cancellation, deadlines, tracing, etc.

distributionId

string

The ID (UUID) of the Distribution.

Other Parameters

Other parameters are passed through a pointer to an apiDistributionsDeleteRequest struct via the builder pattern

Return type

(empty response body)

HTTP request headers

  • Content-Type: Not defined

  • Accept: application/json

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "DistributionsApiService.DistributionsDelete" string. Similar rules for overriding default operation server index and variables apply by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
    "DistributionsApiService.DistributionsDelete": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
    "DistributionsApiService.DistributionsDelete": {
    "port": "8443",
},
})

DistributionsFindById

var result Distribution = DistributionsFindById(ctx, distributionId)
                      .Execute()

Retrieve Distribution

Example

package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-cdn"
)

func main() {
    distributionId := "9ba15778-16c4-543c-8775-e52acf4853f5" // string | The ID (UUID) of the Distribution.

    configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.DistributionsApi.DistributionsFindById(context.Background(), distributionId).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DistributionsApi.DistributionsFindById``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `DistributionsFindById`: Distribution
    fmt.Fprintf(os.Stdout, "Response from `DistributionsApi.DistributionsFindById`: %v\n", resource)
}

Path Parameters

Name
Type
Description
Notes

ctx

context.Context

context for authentication, logging, cancellation, deadlines, tracing, etc.

distributionId

string

The ID (UUID) of the Distribution.

Other Parameters

Other parameters are passed through a pointer to an apiDistributionsFindByIdRequest struct via the builder pattern

Return type

Distribution

HTTP request headers

  • Content-Type: Not defined

  • Accept: application/json

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "DistributionsApiService.DistributionsFindById" string. Similar rules for overriding default operation server index and variables apply by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
    "DistributionsApiService.DistributionsFindById": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
    "DistributionsApiService.DistributionsFindById": {
    "port": "8443",
},
})

DistributionsGet

var result Distributions = DistributionsGet(ctx)
                      .Offset(offset)
                      .Limit(limit)
                      .FilterDomain(filterDomain)
                      .FilterState(filterState)
                      .Execute()

Retrieve all Distributions

Example

package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-cdn"
)

func main() {
    offset := int32(0) // int32 | The first element (of the total list of elements) to include in the response. Use together with limit for pagination. (optional) (default to 0)
    limit := int32(100) // int32 | The maximum number of elements to return. Use together with offset for pagination. (optional) (default to 100)
    filterDomain := "example.com" // string | filters resources by domain. (optional)
    filterState := "AVAILABLE" // string | filters resources by state. (optional)

    configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.DistributionsApi.DistributionsGet(context.Background()).Offset(offset).Limit(limit).FilterDomain(filterDomain).FilterState(filterState).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DistributionsApi.DistributionsGet``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `DistributionsGet`: Distributions
    fmt.Fprintf(os.Stdout, "Response from `DistributionsApi.DistributionsGet`: %v\n", resource)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to an apiDistributionsGetRequest struct via the builder pattern

Name
Type
Description
Notes

offset

int32

The first element (of the total list of elements) to include in the response. Use together with limit for pagination.

[default to 0]

limit

int32

The maximum number of elements to return. Use together with offset for pagination.

[default to 100]

filterDomain

string

filters resources by domain.

filterState

string

filters resources by state.

Return type

Distributions

HTTP request headers

  • Content-Type: Not defined

  • Accept: application/json

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "DistributionsApiService.DistributionsGet" string. Similar rules for overriding default operation server index and variables apply by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
    "DistributionsApiService.DistributionsGet": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
    "DistributionsApiService.DistributionsGet": {
    "port": "8443",
},
})

DistributionsPost

var result Distribution = DistributionsPost(ctx)
                      .DistributionCreate(distributionCreate)
                      .Execute()

Create Distribution

Example

package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-cdn"
)

func main() {
    distributionCreate := *openapiclient.NewDistributionCreate(*openapiclient.NewDistributionProperties("example.com", []openapiclient.RoutingRule{*openapiclient.NewRoutingRule("http/https", "/api", *openapiclient.NewUpstream("server.example.com", true, true, "RateLimitClass_example", "SniMode_example"))})) // DistributionCreate | Distribution to create.

    configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.DistributionsApi.DistributionsPost(context.Background()).DistributionCreate(distributionCreate).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DistributionsApi.DistributionsPost``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `DistributionsPost`: Distribution
    fmt.Fprintf(os.Stdout, "Response from `DistributionsApi.DistributionsPost`: %v\n", resource)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to an apiDistributionsPostRequest struct via the builder pattern

Name
Type
Description
Notes

distributionCreate

Distribution to create.

Return type

Distribution

HTTP request headers

  • Content-Type: application/json

  • Accept: application/json

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "DistributionsApiService.DistributionsPost" string. Similar rules for overriding default operation server index and variables apply by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
    "DistributionsApiService.DistributionsPost": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
    "DistributionsApiService.DistributionsPost": {
    "port": "8443",
},
})

DistributionsPut

var result Distribution = DistributionsPut(ctx, distributionId)
                      .DistributionUpdate(distributionUpdate)
                      .Execute()

Ensure Distribution

Example

package main

import (
    "context"
    "fmt"
    "os"

    ionoscloud "github.com/ionos-cloud/sdk-go-cdn"
)

func main() {
    distributionId := "9ba15778-16c4-543c-8775-e52acf4853f5" // string | The ID (UUID) of the Distribution.
    distributionUpdate := *openapiclient.NewDistributionUpdate("9ba15778-16c4-543c-8775-e52acf4853f5", *openapiclient.NewDistributionProperties("example.com", []openapiclient.RoutingRule{*openapiclient.NewRoutingRule("http/https", "/api", *openapiclient.NewUpstream("server.example.com", true, true, "RateLimitClass_example", "SniMode_example"))})) // DistributionUpdate | update Distribution

    configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "HOST_URL")
    apiClient := ionoscloud.NewAPIClient(configuration)
    resource, resp, err := apiClient.DistributionsApi.DistributionsPut(context.Background(), distributionId).DistributionUpdate(distributionUpdate).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DistributionsApi.DistributionsPut``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
    }
    // response from `DistributionsPut`: Distribution
    fmt.Fprintf(os.Stdout, "Response from `DistributionsApi.DistributionsPut`: %v\n", resource)
}

Path Parameters

Name
Type
Description
Notes

ctx

context.Context

context for authentication, logging, cancellation, deadlines, tracing, etc.

distributionId

string

The ID (UUID) of the Distribution.

Other Parameters

Other parameters are passed through a pointer to an apiDistributionsPutRequest struct via the builder pattern

Name
Type
Description
Notes

distributionUpdate

update Distribution

Return type

Distribution

HTTP request headers

  • Content-Type: application/json

  • Accept: application/json

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "DistributionsApiService.DistributionsPut" string. Similar rules for overriding default operation server index and variables apply by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), {packageName}.ContextOperationServerIndices, map[string]int{
    "DistributionsApiService.DistributionsPut": 2,
})
ctx = context.WithValue(context.Background(), {packageName}.ContextOperationServerVariables, map[string]map[string]string{
    "DistributionsApiService.DistributionsPut": {
    "port": "8443",
},
})

Last updated