Skip to content

Latest commit

 

History

History
240 lines (174 loc) · 7.24 KB

orgs-jse.md

File metadata and controls

240 lines (174 loc) · 7.24 KB

Orgs JSE

orgsJSE := client.OrgsJSE()

Class Name

OrgsJSE

Methods

Delete Org Jsec Credential

Delete JSE credential

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

Parameters

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

Response Type

``

Example Usage

ctx := context.Background()

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

resp, err := orgsJSE.DeleteOrgJsecCredential(ctx, orgId)
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 Jse Info

Retrieves the list of JSE orgs associated with the account.

GetOrgJseInfo(
    ctx context.Context,
    orgId uuid.UUID) (
    models.ApiResponse[models.AccountJseInfo],
    error)

Parameters

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

Response Type

models.AccountJseInfo

Example Usage

ctx := context.Background()

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

apiResponse, err := orgsJSE.GetOrgJseInfo(ctx, orgId)
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)

{
  "cloud_name": "devcentral.juniperclouds.net",
  "org_names": [
    "Mist-Sys",
    "Mist-Eng"
  ]
}

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 Jsec Credential

Get Org JSE Credential

GetOrgJsecCredential(
    ctx context.Context,
    orgId uuid.UUID) (
    models.ApiResponse[models.AccountJseInfo],
    error)

Parameters

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

Response Type

models.AccountJseInfo

Example Usage

ctx := context.Background()

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

apiResponse, err := orgsJSE.GetOrgJsecCredential(ctx, orgId)
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

Setup Org Jsec Credential

in JSE UI:

  1. Create custom role with Read access to service_location and RW access to site and IPSec profile APIs.
  2. Create a user with the above custom role. - email: john@abc.com
  3. Activate the user in the JSE account.
  4. Create the service locations on the JSE account.
SetupOrgJsecCredential(
    ctx context.Context,
    orgId uuid.UUID,
    body *models.AccountJseConfig) (
    models.ApiResponse[models.AccountJseInfo],
    error)

Parameters

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

Response Type

models.AccountJseInfo

Example Usage

ctx := context.Background()

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

body := models.AccountJseConfig{
    CloudName:            models.ToPointer("devcentral.juniperclouds.net"),
    Password:             "foryoureyesonly",
    Username:             "john@abc.com",
}

apiResponse, err := orgsJSE.SetupOrgJsecCredential(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