Skip to content

Latest commit

 

History

History
785 lines (508 loc) · 24 KB

VersionAPI.md

File metadata and controls

785 lines (508 loc) · 24 KB

VersionAPI

Note

All URIs are relative to https://api.fastly.com

Method HTTP request Description
ActivateServiceVersion PUT /service/{service_id}/version/{version_id}/activate Activate a service version
ActivateServiceVersionEnvironment PUT /service/{service_id}/version/{version_id}/activate/{environment_name} Activate a service version on the specified environment
CloneServiceVersion PUT /service/{service_id}/version/{version_id}/clone Clone a service version
CreateServiceVersion POST /service/{service_id}/version Create a service version
DeactivateServiceVersion PUT /service/{service_id}/version/{version_id}/deactivate Deactivate a service version
DeactivateServiceVersionEnvironment PUT /service/{service_id}/version/{version_id}/deactivate/{environment_name} Deactivate a service version on an environment
GetServiceVersion GET /service/{service_id}/version/{version_id} Get a version of a service
ListServiceVersions GET /service/{service_id}/version List versions of a service
LockServiceVersion PUT /service/{service_id}/version/{version_id}/lock Lock a service version
UpdateServiceVersion PUT /service/{service_id}/version/{version_id} Update a service version
ValidateServiceVersion GET /service/{service_id}/version/{version_id}/validate Validate a service version

ActivateServiceVersion

Activate a service version

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VersionAPI.ActivateServiceVersion(ctx, serviceID, versionID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VersionAPI.ActivateServiceVersion`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `ActivateServiceVersion`: VersionResponse
    fmt.Fprintf(os.Stdout, "Response from `VersionAPI.ActivateServiceVersion`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.

Other Parameters

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

Name Type Description Notes

Return type

VersionResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

ActivateServiceVersionEnvironment

Activate a service version on the specified environment

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.
    environmentName := openapiclient.environment_name("staging") // EnvironmentName | 

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VersionAPI.ActivateServiceVersionEnvironment(ctx, serviceID, versionID, environmentName).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VersionAPI.ActivateServiceVersionEnvironment`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `ActivateServiceVersionEnvironment`: VersionResponse
    fmt.Fprintf(os.Stdout, "Response from `VersionAPI.ActivateServiceVersionEnvironment`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.
environmentName EnvironmentName

Other Parameters

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

Name Type Description Notes

Return type

VersionResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

CloneServiceVersion

Clone a service version

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VersionAPI.CloneServiceVersion(ctx, serviceID, versionID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VersionAPI.CloneServiceVersion`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `CloneServiceVersion`: Version
    fmt.Fprintf(os.Stdout, "Response from `VersionAPI.CloneServiceVersion`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.

Other Parameters

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

Name Type Description Notes

Return type

Version

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

CreateServiceVersion

Create a service version

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VersionAPI.CreateServiceVersion(ctx, serviceID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VersionAPI.CreateServiceVersion`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `CreateServiceVersion`: VersionCreateResponse
    fmt.Fprintf(os.Stdout, "Response from `VersionAPI.CreateServiceVersion`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.

Other Parameters

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

Name Type Description Notes

Return type

VersionCreateResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

DeactivateServiceVersion

Deactivate a service version

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VersionAPI.DeactivateServiceVersion(ctx, serviceID, versionID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VersionAPI.DeactivateServiceVersion`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `DeactivateServiceVersion`: VersionResponse
    fmt.Fprintf(os.Stdout, "Response from `VersionAPI.DeactivateServiceVersion`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.

Other Parameters

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

Name Type Description Notes

Return type

VersionResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

DeactivateServiceVersionEnvironment

Deactivate a service version on an environment

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.
    environmentName := openapiclient.environment_name("staging") // EnvironmentName | 

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VersionAPI.DeactivateServiceVersionEnvironment(ctx, serviceID, versionID, environmentName).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VersionAPI.DeactivateServiceVersionEnvironment`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `DeactivateServiceVersionEnvironment`: VersionResponse
    fmt.Fprintf(os.Stdout, "Response from `VersionAPI.DeactivateServiceVersionEnvironment`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.
environmentName EnvironmentName

Other Parameters

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

Name Type Description Notes

Return type

VersionResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

GetServiceVersion

Get a version of a service

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VersionAPI.GetServiceVersion(ctx, serviceID, versionID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VersionAPI.GetServiceVersion`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetServiceVersion`: VersionResponse
    fmt.Fprintf(os.Stdout, "Response from `VersionAPI.GetServiceVersion`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.

Other Parameters

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

Name Type Description Notes

Return type

VersionResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

ListServiceVersions

List versions of a service

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VersionAPI.ListServiceVersions(ctx, serviceID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VersionAPI.ListServiceVersions`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `ListServiceVersions`: []VersionResponse
    fmt.Fprintf(os.Stdout, "Response from `VersionAPI.ListServiceVersions`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.

Other Parameters

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

Name Type Description Notes

Return type

[]VersionResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

LockServiceVersion

Lock a service version

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VersionAPI.LockServiceVersion(ctx, serviceID, versionID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VersionAPI.LockServiceVersion`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `LockServiceVersion`: Version
    fmt.Fprintf(os.Stdout, "Response from `VersionAPI.LockServiceVersion`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.

Other Parameters

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

Name Type Description Notes

Return type

Version

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

UpdateServiceVersion

Update a service version

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.
    active := true // bool | Whether this is the active version or not. (optional) (default to false)
    comment := "comment_example" // string | A freeform descriptive note. (optional)
    deployed := true // bool | Unused at this time. (optional)
    locked := true // bool | Whether this version is locked or not. Objects can not be added or edited on locked versions. (optional) (default to false)
    number := int32(56) // int32 | The number of this version. (optional)
    staging := true // bool | Unused at this time. (optional) (default to false)
    testing := true // bool | Unused at this time. (optional) (default to false)

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VersionAPI.UpdateServiceVersion(ctx, serviceID, versionID).Active(active).Comment(comment).Deployed(deployed).Locked(locked).Number(number).Staging(staging).Testing(testing).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VersionAPI.UpdateServiceVersion`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `UpdateServiceVersion`: VersionResponse
    fmt.Fprintf(os.Stdout, "Response from `VersionAPI.UpdateServiceVersion`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.

Other Parameters

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

Name Type Description Notes
active bool Whether this is the active version or not. [default to false] comment

Return type

VersionResponse

Authorization

API Token

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json

Back to top | Back to API list | Back to README

ValidateServiceVersion

Validate a service version

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.VersionAPI.ValidateServiceVersion(ctx, serviceID, versionID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `VersionAPI.ValidateServiceVersion`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `ValidateServiceVersion`: InlineResponse200
    fmt.Fprintf(os.Stdout, "Response from `VersionAPI.ValidateServiceVersion`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.

Other Parameters

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

Name Type Description Notes

Return type

InlineResponse200

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README