Skip to content

Latest commit

 

History

History
544 lines (346 loc) · 14.1 KB

IamRolesAPI.md

File metadata and controls

544 lines (346 loc) · 14.1 KB

IamRolesAPI

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

AddRolePermissions

Add permissions to a role

Example

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)
}

Path Parameters

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

Other Parameters

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

Return type

map[string]any

Authorization

API Token

HTTP request headers

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

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

CreateARole

Create a role

Example

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)
}

Path Parameters

Other Parameters

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

Return type

map[string]any

Authorization

API Token

HTTP request headers

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

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

DeleteARole

Delete a role

Example

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)
    }
}

Path Parameters

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

Other Parameters

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

Name Type Description Notes

Return type

(empty response body)

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

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

GetARole

Get a role

Example

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)
}

Path Parameters

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

Other Parameters

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

Name Type Description Notes

Return type

map[string]any

Authorization

API Token

HTTP request headers

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

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

ListRolePermissions

List permissions in a role

Example

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)
}

Path Parameters

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

Other Parameters

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

Name Type Description Notes

Return type

map[string]any

Authorization

API Token

HTTP request headers

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

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

ListRoles

List roles

Example

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)
}

Path Parameters

Other Parameters

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

Return type

map[string]any

Authorization

API Token

HTTP request headers

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

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

RemoveRolePermissions

Remove permissions from a role

Example

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)
    }
}

Path Parameters

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

Other Parameters

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

Return type

(empty response body)

Authorization

API Token

HTTP request headers

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

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

UpdateARole

Update a role

Example

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)
}

Path Parameters

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

Other Parameters

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

Return type

map[string]any

Authorization

API Token

HTTP request headers

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

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