Skip to content

Latest commit

 

History

History
825 lines (625 loc) · 27.3 KB

orgs-nac-portals.md

File metadata and controls

825 lines (625 loc) · 27.3 KB

Orgs NAC Portals

orgsNACPortals := client.OrgsNACPortals()

Class Name

OrgsNACPortals

Methods

Create Org Nac Portal

Create Org NAC Portal

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

Parameters

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

Response Type

models.NacPortal

Example Usage

ctx := context.Background()

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

body := models.NacPortal{
    AccessType:             models.ToPointer(models.NacPortalAccessTypeEnum("wireless")),
    CertExpireTime:         models.ToPointer(365),
    EapType:                models.ToPointer(models.NacPortalEapTypeEnum("wpa2")),
    Name:                   models.ToPointer("get-wifi"),
    Ssid:                   models.ToPointer("Corp"),
}

apiResponse, err := orgsNACPortals.CreateOrgNacPortal(ctx, orgId, &body)
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)

{
  "access_type": "wireless",
  "cert_expire_time": 365,
  "enable_telemetry": true,
  "expiry_notification_time": 2,
  "name": "get-wifi",
  "notify_expiry": true,
  "ssid": "Corp",
  "sso": {
    "idp_cert": "-----BEGIN CERTIFICATE-----\nMIIFZjCCA06gAwIBAgIIP61/1qm/uDowDQYJKoZIhvcNAQELBQE\n-----END CERTIFICATE-----",
    "idp_sign_algo": "sha256",
    "idp_sso_url": "https://yourorg.onelogin.com/trust/saml2/http-post/sso/138130",
    "issuer": "https://app.onelogin.com/saml/metadata/138130",
    "nameid_format": "email",
    "sso_role_matching": [
      {
        "assigned": "user",
        "match": "Student"
      }
    ],
    "use_sso_role_for_cert": true
  }
}

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 Nac Portal

Delete Org NAC Portal

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

Parameters

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

Response Type

``

Example Usage

ctx := context.Background()

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

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

resp, err := orgsNACPortals.DeleteOrgNacPortal(ctx, orgId, nacportalId)
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

Delete Org Nac Portal Image

Delete background image for NAC Portal

If image is not uploaded or is deleted, NAC Portal will use default image.

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

Parameters

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

Response Type

``

Example Usage

ctx := context.Background()

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

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

resp, err := orgsNACPortals.DeleteOrgNacPortalImage(ctx, orgId, nacportalId)
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

Download Org Nac Portal Saml Metadata

Download Org NAC Portal SAML Metdata

Example of metadata.xml:

<?xml version="1.0" encoding="UTF-8"?><md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" entityID="https://api.mist.com/api/v1/saml/5hdF5g/login" validUntil="2027-10-12T21:59:01Z" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    <md:SPSSODescriptor AuthnRequestsSigned="false" WantAssertionsSigned="true" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
        <md:SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://api.mist.com/api/v1/saml/5hdF5g/logout" />
        <md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</md:NameIDFormat>
        <md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://api.mist.com/api/v1/saml/5hdF5g/login" index="0" isDefault="true"/>
        <md:AttributeConsumingService index="0">
            <md:ServiceName xml:lang="en-US">Mist</md:ServiceName>
            <md:RequestedAttribute Name="Role" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" isRequired="true"/>
            <md:RequestedAttribute Name="FirstName" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" isRequired="false"/>
            <md:RequestedAttribute Name="LastName" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" isRequired="false"/>
        </md:AttributeConsumingService>
    </md:SPSSODescriptor>
</md:EntityDescriptor>
DownloadOrgNacPortalSamlMetadata(
    ctx context.Context,
    orgId uuid.UUID,
    nacportalId uuid.UUID) (
    models.ApiResponse[[]byte],
    error)

Parameters

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

Response Type

[]byte

Example Usage

ctx := context.Background()

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

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

apiResponse, err := orgsNACPortals.DownloadOrgNacPortalSamlMetadata(ctx, orgId, nacportalId)
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

Get Org Nac Portal

Get Org NAC Portal

GetOrgNacPortal(
    ctx context.Context,
    orgId uuid.UUID,
    nacportalId uuid.UUID) (
    models.ApiResponse[models.NacPortal],
    error)

Parameters

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

Response Type

models.NacPortal

Example Usage

ctx := context.Background()

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

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

apiResponse, err := orgsNACPortals.GetOrgNacPortal(ctx, orgId, nacportalId)
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)

{
  "access_type": "wireless",
  "cert_expire_time": 365,
  "enable_telemetry": true,
  "expiry_notification_time": 2,
  "name": "get-wifi",
  "notify_expiry": true,
  "ssid": "Corp",
  "sso": {
    "idp_cert": "-----BEGIN CERTIFICATE-----\nMIIFZjCCA06gAwIBAgIIP61/1qm/uDowDQYJKoZIhvcNAQELBQE\n-----END CERTIFICATE-----",
    "idp_sign_algo": "sha256",
    "idp_sso_url": "https://yourorg.onelogin.com/trust/saml2/http-post/sso/138130",
    "issuer": "https://app.onelogin.com/saml/metadata/138130",
    "nameid_format": "email",
    "sso_role_matching": [
      {
        "assigned": "user",
        "match": "Student"
      }
    ],
    "use_sso_role_for_cert": true
  }
}

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 Nac Portal Saml Metadata

Get Org NAC Portal SAML Metadata

GetOrgNacPortalSamlMetadata(
    ctx context.Context,
    orgId uuid.UUID,
    nacportalId uuid.UUID) (
    models.ApiResponse[models.SamlMetadata],
    error)

Parameters

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

Response Type

models.SamlMetadata

Example Usage

ctx := context.Background()

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

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

apiResponse, err := orgsNACPortals.GetOrgNacPortalSamlMetadata(ctx, orgId, nacportalId)
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)

{
  "acs_url": "https://api.mist.com/api/v1/saml/llDfa13f/login",
  "entity_id": "https://api.mist.com/api/v1/saml/llDfa13f/login",
  "logout_url": "https://api.mist.com/api/v1/saml/llDfa13f/logout",
  "metadata": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><md:EntityDescriptor xmlns:md=\"urn:oasis:names:tc:SAML:2.0:metadata\" entityID=\"https://api.mist.com/api/v1/saml/llDfa13f/login\" validUntil=\"2027-10-12T21:59:01Z\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\"><md:SPSSODescriptor AuthnRequestsSigned=\"false\" WantAssertionsSigned=\"true\" protocolSupportEnumeration=\"urn:oasis:names:tc:SAML:2.0:protocol\"><md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</md:NameIDFormat><md:AssertionConsumerService Binding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST\" Location=\"https://api.mist.com/api/v1/saml/llDfa13f/login\" index=\"0\" isDefault=\"true\"/></md:SPSSODescriptor></md:EntityDescriptor>"
}

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 Nac Portal Sso Latest Failures

Get List of Org NAC Portal SSO Latest Failures

ListOrgNacPortalSsoLatestFailures(
    ctx context.Context,
    orgId uuid.UUID,
    nacportalId uuid.UUID,
    start *int,
    end *int,
    duration *string,
    limit *int,
    page *int) (
    models.ApiResponse[models.ResponseSsoFailureSearch],
    error)

Parameters

Parameter Type Tags Description
orgId uuid.UUID Template, Required -
nacportalId uuid.UUID Template, Required -
start *int Query, Optional start datetime, can be epoch or relative time like -1d, -1w; -1d if not specified
end *int Query, Optional end datetime, can be epoch or relative time like -1d, -2h; now if not specified
duration *string Query, Optional duration like 7d, 2w
Default: "1d"
limit *int Query, Optional Default: 100
Constraints: >= 0
page *int Query, Optional Default: 1
Constraints: >= 1

Response Type

models.ResponseSsoFailureSearch

Example Usage

ctx := context.Background()

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

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





duration := "10m"

limit := 100

page := 1

apiResponse, err := orgsNACPortals.ListOrgNacPortalSsoLatestFailures(ctx, orgId, nacportalId, nil, nil, &duration, &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)

{
  "results": [
    {
      "detail": "string",
      "saml_assertion_xml": "string",
      "timestamp": 0
    }
  ]
}

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 Nac Portals

List Org NAC Portals

ListOrgNacPortals(
    ctx context.Context,
    orgId uuid.UUID,
    limit *int,
    page *int) (
    models.ApiResponse[[]models.NacPortal],
    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.NacPortal

Example Usage

ctx := context.Background()

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

limit := 100

page := 1

apiResponse, err := orgsNACPortals.ListOrgNacPortals(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)

[
  {
    "access_type": "wireless",
    "cert_expire_time": 365,
    "enable_telemetry": true,
    "expiry_notification_time": 2,
    "name": "get-wifi",
    "notify_expiry": true,
    "ssid": "Corp",
    "sso": {
      "idp_cert": "-----BEGIN CERTIFICATE-----\nMIIFZjCCA06gAwIBAgIIP61/1qm/uDowDQYJKoZIhvcNAQELBQE\n-----END CERTIFICATE-----",
      "idp_sign_algo": "sha256",
      "idp_sso_url": "https://yourorg.onelogin.com/trust/saml2/http-post/sso/138130",
      "issuer": "https://app.onelogin.com/saml/metadata/138130",
      "nameid_format": "email",
      "sso_role_matching": [
        {
          "assigned": "user",
          "match": "Student"
        }
      ],
      "use_sso_role_for_cert": true
    }
  }
]

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 Nac Portal

Update Org NAC Portal

UpdateOrgNacPortal(
    ctx context.Context,
    orgId uuid.UUID,
    nacportalId uuid.UUID,
    body *models.NacPortal) (
    models.ApiResponse[models.NacPortal],
    error)

Parameters

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

Response Type

models.NacPortal

Example Usage

ctx := context.Background()

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

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

body := models.NacPortal{
    AccessType:             models.ToPointer(models.NacPortalAccessTypeEnum("wireless")),
    CertExpireTime:         models.ToPointer(365),
    EapType:                models.ToPointer(models.NacPortalEapTypeEnum("wpa2")),
    Name:                   models.ToPointer("get-wifi"),
    Ssid:                   models.ToPointer("Corp"),
}

apiResponse, err := orgsNACPortals.UpdateOrgNacPortal(ctx, orgId, nacportalId, &body)
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)

{
  "access_type": "wireless",
  "cert_expire_time": 365,
  "enable_telemetry": true,
  "expiry_notification_time": 2,
  "name": "get-wifi",
  "notify_expiry": true,
  "ssid": "Corp",
  "sso": {
    "idp_cert": "-----BEGIN CERTIFICATE-----\nMIIFZjCCA06gAwIBAgIIP61/1qm/uDowDQYJKoZIhvcNAQELBQE\n-----END CERTIFICATE-----",
    "idp_sign_algo": "sha256",
    "idp_sso_url": "https://yourorg.onelogin.com/trust/saml2/http-post/sso/138130",
    "issuer": "https://app.onelogin.com/saml/metadata/138130",
    "nameid_format": "email",
    "sso_role_matching": [
      {
        "assigned": "user",
        "match": "Student"
      }
    ],
    "use_sso_role_for_cert": true
  }
}

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 Nac Portal Tempalte

Update Org NAC Portal Template

UpdateOrgNacPortalTempalte(
    ctx context.Context,
    orgId uuid.UUID,
    nacportalId uuid.UUID,
    body *models.NacPortalTemplate) (
    http.Response,
    error)

Parameters

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

Response Type

``

Example Usage

ctx := context.Background()

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

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

body := models.NacPortalTemplate{
    Alignment:            models.ToPointer(models.PortalTemplateAlignmentEnum("center")),
    Color:                models.ToPointer("#1074bc"),
    PoweredBy:            models.ToPointer(false),
}

resp, err := orgsNACPortals.UpdateOrgNacPortalTempalte(ctx, orgId, nacportalId, &body)
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

Upload Org Nac Portal Image

Upload background image for NAC Portal

UploadOrgNacPortalImage(
    ctx context.Context,
    orgId uuid.UUID,
    nacportalId uuid.UUID,
    file *models.FileWrapper,
    json *string) (
    http.Response,
    error)

Parameters

Parameter Type Tags Description
orgId uuid.UUID Template, Required -
nacportalId uuid.UUID Template, Required -
file *models.FileWrapper Form, Optional Binary file
json *string Form, Optional JSON string describing the upload

Response Type

``

Example Usage

ctx := context.Background()

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

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





resp, err := orgsNACPortals.UploadOrgNacPortalImage(ctx, orgId, nacportalId, nil, nil)
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