Note
All URIs are relative to https://api.fastly.com
Method | HTTP request | Description |
---|---|---|
AddRolePermissions | POST /roles/{role_id}/permissions |
Add permissions to a role |
CreateARole | POST /roles |
Create a role |
DeleteARole | DELETE /roles/{role_id} |
Delete a role |
GetARole | GET /roles/{role_id} |
Get a role |
ListRolePermissions | GET /roles/{role_id}/permissions |
List permissions in a role |
ListRoles | GET /roles |
List roles |
RemoveRolePermissions | DELETE /roles/{role_id}/permissions |
Remove permissions from a role |
UpdateARole | PATCH /roles/{role_id} |
Update a role |
Add permissions to a role
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
roleID := "roleId_example" // string | Alphanumeric string identifying the role.
requestBody := map[string]map[string]any{"key": map[string]any(123)} // map[string]map[string]any | (optional)
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.IamRolesAPI.AddRolePermissions(ctx, roleID).RequestBody(requestBody).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `IamRolesAPI.AddRolePermissions`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `AddRolePermissions`: map[string]any
fmt.Fprintf(os.Stdout, "Response from `IamRolesAPI.AddRolePermissions`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
roleID | string | Alphanumeric string identifying the role. |
Other parameters are passed through a pointer to a apiAddRolePermissionsRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
requestBody | map[string]map[string]any |
map[string]any
- Content-Type: application/json
- Accept: application/json
Back to top | Back to API list | Back to README
Create a role
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
requestBody := map[string]map[string]any{"key": map[string]any(123)} // map[string]map[string]any | (optional)
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.IamRolesAPI.CreateARole(ctx).RequestBody(requestBody).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `IamRolesAPI.CreateARole`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateARole`: map[string]any
fmt.Fprintf(os.Stdout, "Response from `IamRolesAPI.CreateARole`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiCreateARoleRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
requestBody | map[string]map[string]any |
map[string]any
- Content-Type: application/json
- Accept: application/json
Back to top | Back to API list | Back to README
Delete a role
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
roleID := "roleId_example" // string | Alphanumeric string identifying the role.
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.IamRolesAPI.DeleteARole(ctx, roleID).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `IamRolesAPI.DeleteARole`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
roleID | string | Alphanumeric string identifying the role. |
Other parameters are passed through a pointer to a apiDeleteARoleRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
(empty response body)
- Content-Type: Not defined
- Accept: Not defined
Back to top | Back to API list | Back to README
Get a role
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
roleID := "roleId_example" // string | Alphanumeric string identifying the role.
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.IamRolesAPI.GetARole(ctx, roleID).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `IamRolesAPI.GetARole`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetARole`: map[string]any
fmt.Fprintf(os.Stdout, "Response from `IamRolesAPI.GetARole`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
roleID | string | Alphanumeric string identifying the role. |
Other parameters are passed through a pointer to a apiGetARoleRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
map[string]any
- Content-Type: Not defined
- Accept: application/json
Back to top | Back to API list | Back to README
List permissions in a role
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
roleID := "roleId_example" // string | Alphanumeric string identifying the role.
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.IamRolesAPI.ListRolePermissions(ctx, roleID).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `IamRolesAPI.ListRolePermissions`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListRolePermissions`: map[string]any
fmt.Fprintf(os.Stdout, "Response from `IamRolesAPI.ListRolePermissions`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
roleID | string | Alphanumeric string identifying the role. |
Other parameters are passed through a pointer to a apiListRolePermissionsRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
map[string]any
- Content-Type: Not defined
- Accept: application/json
Back to top | Back to API list | Back to README
List roles
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
perPage := int32(20) // int32 | Number of records per page. (optional) (default to 20)
page := int32(1) // int32 | Current page. (optional)
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.IamRolesAPI.ListRoles(ctx).PerPage(perPage).Page(page).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `IamRolesAPI.ListRoles`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListRoles`: map[string]any
fmt.Fprintf(os.Stdout, "Response from `IamRolesAPI.ListRoles`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiListRolesRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
perPage | int32 | Number of records per page. | [default to 20] page |
map[string]any
- Content-Type: Not defined
- Accept: application/json
Back to top | Back to API list | Back to README
Remove permissions from a role
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
roleID := "roleId_example" // string | Alphanumeric string identifying the role.
requestBody := map[string]map[string]any{"key": map[string]any(123)} // map[string]map[string]any | (optional)
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.IamRolesAPI.RemoveRolePermissions(ctx, roleID).RequestBody(requestBody).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `IamRolesAPI.RemoveRolePermissions`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
roleID | string | Alphanumeric string identifying the role. |
Other parameters are passed through a pointer to a apiRemoveRolePermissionsRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
requestBody | map[string]map[string]any |
(empty response body)
- Content-Type: application/json
- Accept: Not defined
Back to top | Back to API list | Back to README
Update a role
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
roleID := "roleId_example" // string | Alphanumeric string identifying the role.
requestBody := map[string]map[string]any{"key": map[string]any(123)} // map[string]map[string]any | (optional)
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.IamRolesAPI.UpdateARole(ctx, roleID).RequestBody(requestBody).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `IamRolesAPI.UpdateARole`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UpdateARole`: map[string]any
fmt.Fprintf(os.Stdout, "Response from `IamRolesAPI.UpdateARole`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
roleID | string | Alphanumeric string identifying the role. |
Other parameters are passed through a pointer to a apiUpdateARoleRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
requestBody | map[string]map[string]any |
map[string]any
- Content-Type: application/json
- Accept: application/json