Skip to content

Latest commit

 

History

History
333 lines (248 loc) · 10.3 KB

orgs-service-policies.md

File metadata and controls

333 lines (248 loc) · 10.3 KB

Orgs Service Policies

orgsServicePolicies := client.OrgsServicePolicies()

Class Name

OrgsServicePolicies

Methods

Create Org Service Policy

Create Org Serrvice Policy

CreateOrgServicePolicy(
    ctx context.Context,
    orgId uuid.UUID,
    body *models.OrgServicePolicy) (
    models.ApiResponse[models.OrgServicePolicy],
    error)

Parameters

Parameter Type Tags Description
orgId uuid.UUID Template, Required -
body *models.OrgServicePolicy Body, Optional -

Response Type

models.OrgServicePolicy

Example Usage

ctx := context.Background()

orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

body := models.OrgServicePolicy{
    Action:               models.ToPointer(models.AllowDenyEnum("allow")),
    Name:                 models.ToPointer("string"),
    Services:             []string{
        "string",
    },
    Tenants:              []string{
        "string",
    },
}

apiResponse, err := orgsServicePolicies.CreateOrgServicePolicy(ctx, orgId, &body)
if err != nil {
    log.Fatalln(err)
} else {
    // Printing the result and response
    fmt.Println(apiResponse.Data)
    fmt.Println(apiResponse.Response.StatusCode)
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

Delete Org Service Policy

Delete Org Service Policuy

DeleteOrgServicePolicy(
    ctx context.Context,
    orgId uuid.UUID,
    servicepolicyId uuid.UUID) (
    http.Response,
    error)

Parameters

Parameter Type Tags Description
orgId uuid.UUID Template, Required -
servicepolicyId uuid.UUID Template, Required -

Response Type

``

Example Usage

ctx := context.Background()

orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

servicepolicyId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

resp, err := orgsServicePolicies.DeleteOrgServicePolicy(ctx, orgId, servicepolicyId)
if err != nil {
    log.Fatalln(err)
} else {
    fmt.Println(resp.StatusCode)
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

Get Org Service Policy

Get Org Service Policy Details

GetOrgServicePolicy(
    ctx context.Context,
    orgId uuid.UUID,
    servicepolicyId uuid.UUID) (
    models.ApiResponse[models.OrgServicePolicy],
    error)

Parameters

Parameter Type Tags Description
orgId uuid.UUID Template, Required -
servicepolicyId uuid.UUID Template, Required -

Response Type

models.OrgServicePolicy

Example Usage

ctx := context.Background()

orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

servicepolicyId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

apiResponse, err := orgsServicePolicies.GetOrgServicePolicy(ctx, orgId, servicepolicyId)
if err != nil {
    log.Fatalln(err)
} else {
    // Printing the result and response
    fmt.Println(apiResponse.Data)
    fmt.Println(apiResponse.Response.StatusCode)
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

List Org Service Policies

Get List of Org Service Policies

ListOrgServicePolicies(
    ctx context.Context,
    orgId uuid.UUID,
    limit *int,
    page *int) (
    models.ApiResponse[[]models.OrgServicePolicy],
    error)

Parameters

Parameter Type Tags Description
orgId uuid.UUID Template, Required -
limit *int Query, Optional Default: 100
Constraints: >= 0
page *int Query, Optional Default: 1
Constraints: >= 1

Response Type

[]models.OrgServicePolicy

Example Usage

ctx := context.Background()

orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

limit := 100

page := 1

apiResponse, err := orgsServicePolicies.ListOrgServicePolicies(ctx, orgId, &limit, &page)
if err != nil {
    log.Fatalln(err)
} else {
    // Printing the result and response
    fmt.Println(apiResponse.Data)
    fmt.Println(apiResponse.Response.StatusCode)
}

Example Response (as JSON)

[
  {
    "action": "allow",
    "created_time": 0,
    "id": "string",
    "modified_time": 0,
    "name": "string",
    "org_id": "string",
    "services": [
      "string"
    ],
    "tenants": [
      "string"
    ]
  }
]

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

Update Org Service Policy

Update Org Serrvice Policy

UpdateOrgServicePolicy(
    ctx context.Context,
    orgId uuid.UUID,
    servicepolicyId uuid.UUID,
    body *models.OrgServicePolicy) (
    models.ApiResponse[models.OrgServicePolicy],
    error)

Parameters

Parameter Type Tags Description
orgId uuid.UUID Template, Required -
servicepolicyId uuid.UUID Template, Required -
body *models.OrgServicePolicy Body, Optional -

Response Type

models.OrgServicePolicy

Example Usage

ctx := context.Background()

orgId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

servicepolicyId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

body := models.OrgServicePolicy{
    Action:               models.ToPointer(models.AllowDenyEnum("allow")),
    Name:                 models.ToPointer("string"),
    Services:             []string{
        "string",
    },
    Tenants:              []string{
        "string",
    },
}

apiResponse, err := orgsServicePolicies.UpdateOrgServicePolicy(ctx, orgId, servicepolicyId, &body)
if err != nil {
    log.Fatalln(err)
} else {
    // Printing the result and response
    fmt.Println(apiResponse.Data)
    fmt.Println(apiResponse.Response.StatusCode)
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException