Skip to content

Latest commit

 

History

History
364 lines (239 loc) · 14.5 KB

CustomerAPI.md

File metadata and controls

364 lines (239 loc) · 14.5 KB

CustomerAPI

Note

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

Method HTTP request Description
DeleteCustomer DELETE /customer/{customer_id} Delete a customer
GetCustomer GET /customer/{customer_id} Get a customer
GetLoggedInCustomer GET /current_customer Get the logged in customer
ListUsers GET /customer/{customer_id}/users List users
UpdateCustomer PUT /customer/{customer_id} Update a customer

DeleteCustomer

Delete a customer

Example

package main

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

func main() {
    customerID := "customerId_example" // string | Alphanumeric string identifying the customer.

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

Path Parameters

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

Other Parameters

Other parameters are passed through a pointer to a apiDeleteCustomerRequest 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

GetCustomer

Get a customer

Example

package main

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

func main() {
    customerID := "customerId_example" // string | Alphanumeric string identifying the customer.

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

Path Parameters

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

Other Parameters

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

Name Type Description Notes

Return type

CustomerResponse

Authorization

API Token

HTTP request headers

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

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

GetLoggedInCustomer

Get the logged in customer

Example

package main

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

func main() {

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

Path Parameters

This endpoint does not need any parameter.

Other Parameters

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

Return type

CustomerResponse

Authorization

API Token

HTTP request headers

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

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

ListUsers

List users

Example

package main

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

func main() {
    customerID := "customerId_example" // string | Alphanumeric string identifying the customer.

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

Path Parameters

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

Other Parameters

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

Name Type Description Notes

Return type

[]SchemasUserResponse

Authorization

API Token

HTTP request headers

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

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

UpdateCustomer

Update a customer

Example

package main

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

func main() {
    customerID := "customerId_example" // string | Alphanumeric string identifying the customer.
    billingContactID := "billingContactId_example" // string | The alphanumeric string representing the primary billing contact. (optional)
    billingNetworkType := "billingNetworkType_example" // string | Customer's current network revenue type. (optional)
    billingRef := "billingRef_example" // string | Used for adding purchased orders to customer's account. (optional)
    canConfigureWordpress := true // bool | Whether this customer can view or edit wordpress. (optional)
    canResetPasswords := true // bool | Whether this customer can reset passwords. (optional)
    canUploadVcl := true // bool | Whether this customer can upload VCL. (optional)
    force2fa := true // bool | Specifies whether 2FA is forced or not forced on the customer account. Logs out non-2FA users once 2FA is force enabled. (optional)
    forceSso := true // bool | Specifies whether SSO is forced or not forced on the customer account. (optional)
    hasAccountPanel := true // bool | Specifies whether the account has access or does not have access to the account panel. (optional)
    hasImprovedEvents := true // bool | Specifies whether the account has access or does not have access to the improved events. (optional)
    hasImprovedSslConfig := true // bool | Whether this customer can view or edit the SSL config. (optional)
    hasOpenstackLogging := true // bool | Specifies whether the account has enabled or not enabled openstack logging. (optional)
    hasPci := true // bool | Specifies whether the account can edit PCI for a service. (optional)
    hasPciPasswords := true // bool | Specifies whether PCI passwords are required for the account. (optional)
    ipWhitelist := "ipWhitelist_example" // string | The range of IP addresses authorized to access the customer account. (optional)
    legalContactID := "legalContactId_example" // string | The alphanumeric string identifying the account's legal contact. (optional)
    name := "name_example" // string | The name of the customer, generally the company name. (optional)
    ownerID := "ownerId_example" // string | The alphanumeric string identifying the account owner. (optional)
    phoneNumber := "phoneNumber_example" // string | The phone number associated with the account. (optional)
    postalAddress := "postalAddress_example" // string | The postal address associated with the account. (optional)
    pricingPlan := "pricingPlan_example" // string | The pricing plan this customer is under. (optional)
    pricingPlanID := "pricingPlanId_example" // string | The alphanumeric string identifying the pricing plan. (optional)
    securityContactID := "securityContactId_example" // string | The alphanumeric string identifying the account's security contact. (optional)
    technicalContactID := "technicalContactId_example" // string | The alphanumeric string identifying the account's technical contact. (optional)

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.CustomerAPI.UpdateCustomer(ctx, customerID).BillingContactID(billingContactID).BillingNetworkType(billingNetworkType).BillingRef(billingRef).CanConfigureWordpress(canConfigureWordpress).CanResetPasswords(canResetPasswords).CanUploadVcl(canUploadVcl).Force2fa(force2fa).ForceSso(forceSso).HasAccountPanel(hasAccountPanel).HasImprovedEvents(hasImprovedEvents).HasImprovedSslConfig(hasImprovedSslConfig).HasOpenstackLogging(hasOpenstackLogging).HasPci(hasPci).HasPciPasswords(hasPciPasswords).IPWhitelist(ipWhitelist).LegalContactID(legalContactID).Name(name).OwnerID(ownerID).PhoneNumber(phoneNumber).PostalAddress(postalAddress).PricingPlan(pricingPlan).PricingPlanID(pricingPlanID).SecurityContactID(securityContactID).TechnicalContactID(technicalContactID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `CustomerAPI.UpdateCustomer`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `UpdateCustomer`: CustomerResponse
    fmt.Fprintf(os.Stdout, "Response from `CustomerAPI.UpdateCustomer`: %v\n", resp)
}

Path Parameters

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

Other Parameters

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

Name Type Description Notes
billingContactID string The alphanumeric string representing the primary billing contact. billingNetworkType

Return type

CustomerResponse

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