Note
All URIs are relative to https://api.fastly.com
Method | HTTP request | Description |
---|---|---|
CreateUser | POST /user |
Create a user |
DeleteUser | DELETE /user/{user_id} |
Delete a user |
GetCurrentUser | GET /current_user |
Get the current user |
GetUser | GET /user/{user_id} |
Get a user |
RequestPasswordReset | POST /user/{user_login}/password/request_reset |
Request a password reset |
UpdateUser | PUT /user/{user_id} |
Update a user |
UpdateUserPassword | POST /current_user/password |
Update the user's password |
Create a user
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
login := "login_example" // string | (optional)
name := "name_example" // string | The real life name of the user. (optional)
limitServices := true // bool | Indicates that the user has limited access to the customer's services. (optional)
locked := true // bool | Indicates whether the is account is locked for editing or not. (optional)
requireNewPassword := true // bool | Indicates if a new password is required at next login. (optional)
role := openapiclient.role_user("user") // RoleUser | (optional)
twoFactorAuthEnabled := true // bool | Indicates if 2FA is enabled on the user. (optional)
twoFactorSetupRequired := true // bool | Indicates if 2FA is required by the user's customer account. (optional)
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.UserAPI.CreateUser(ctx).Login(login).Name(name).LimitServices(limitServices).Locked(locked).RequireNewPassword(requireNewPassword).Role(role).TwoFactorAuthEnabled(twoFactorAuthEnabled).TwoFactorSetupRequired(twoFactorSetupRequired).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserAPI.CreateUser`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateUser`: UserResponse
fmt.Fprintf(os.Stdout, "Response from `UserAPI.CreateUser`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiCreateUserRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
login | string | name |
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
Back to top | Back to API list | Back to README
Delete a user
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
userID := "userId_example" // string | Alphanumeric string identifying the user.
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.UserAPI.DeleteUser(ctx, userID).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserAPI.DeleteUser`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DeleteUser`: InlineResponse200
fmt.Fprintf(os.Stdout, "Response from `UserAPI.DeleteUser`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
userID | string | Alphanumeric string identifying the user. |
Other parameters are passed through a pointer to a apiDeleteUserRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/json
Back to top | Back to API list | Back to README
Get the current user
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.UserAPI.GetCurrentUser(ctx).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserAPI.GetCurrentUser`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetCurrentUser`: UserResponse
fmt.Fprintf(os.Stdout, "Response from `UserAPI.GetCurrentUser`: %v\n", resp)
}
This endpoint does not need any parameter.
Other parameters are passed through a pointer to a apiGetCurrentUserRequest struct via the builder pattern
- Content-Type: Not defined
- Accept: application/json
Back to top | Back to API list | Back to README
Get a user
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
userID := "userId_example" // string | Alphanumeric string identifying the user.
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.UserAPI.GetUser(ctx, userID).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserAPI.GetUser`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetUser`: UserResponse
fmt.Fprintf(os.Stdout, "Response from `UserAPI.GetUser`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
userID | string | Alphanumeric string identifying the user. |
Other parameters are passed through a pointer to a apiGetUserRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/json
Back to top | Back to API list | Back to README
Request a password reset
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
userLogin := "userLogin_example" // string | The login associated with the user (typically, an email address).
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.UserAPI.RequestPasswordReset(ctx, userLogin).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserAPI.RequestPasswordReset`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `RequestPasswordReset`: InlineResponse200
fmt.Fprintf(os.Stdout, "Response from `UserAPI.RequestPasswordReset`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
userLogin | string | The login associated with the user (typically, an email address). |
Other parameters are passed through a pointer to a apiRequestPasswordResetRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/json
Back to top | Back to API list | Back to README
Update a user
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
userID := "userId_example" // string | Alphanumeric string identifying the user.
login := "login_example" // string | (optional)
name := "name_example" // string | The real life name of the user. (optional)
limitServices := true // bool | Indicates that the user has limited access to the customer's services. (optional)
locked := true // bool | Indicates whether the is account is locked for editing or not. (optional)
requireNewPassword := true // bool | Indicates if a new password is required at next login. (optional)
role := openapiclient.role_user("user") // RoleUser | (optional)
twoFactorAuthEnabled := true // bool | Indicates if 2FA is enabled on the user. (optional)
twoFactorSetupRequired := true // bool | Indicates if 2FA is required by the user's customer account. (optional)
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.UserAPI.UpdateUser(ctx, userID).Login(login).Name(name).LimitServices(limitServices).Locked(locked).RequireNewPassword(requireNewPassword).Role(role).TwoFactorAuthEnabled(twoFactorAuthEnabled).TwoFactorSetupRequired(twoFactorSetupRequired).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserAPI.UpdateUser`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UpdateUser`: UserResponse
fmt.Fprintf(os.Stdout, "Response from `UserAPI.UpdateUser`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
userID | string | Alphanumeric string identifying the user. |
Other parameters are passed through a pointer to a apiUpdateUserRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
login | string | name |
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
Back to top | Back to API list | Back to README
Update the user's password
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
oldPassword := "oldPassword_example" // string | The user's current password. (optional)
newPassword := "newPassword_example" // string | The user's new password. (optional)
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.UserAPI.UpdateUserPassword(ctx).OldPassword(oldPassword).NewPassword(newPassword).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserAPI.UpdateUserPassword`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UpdateUserPassword`: UserResponse
fmt.Fprintf(os.Stdout, "Response from `UserAPI.UpdateUserPassword`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiUpdateUserPasswordRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
oldPassword | string | The user's current password. | newPassword |
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json