# Lists ## List Zero Trust lists `client.ZeroTrust.Gateway.Lists.List(ctx, params) (*SinglePage[GatewayList], error)` **get** `/accounts/{account_id}/gateway/lists` Fetch all Zero Trust lists for an account. ### Parameters - `params GatewayListListParams` - `AccountID param.Field[string]` Path param - `Type param.Field[GatewayListListParamsType]` Query param: Specify the list type. - `const GatewayListListParamsTypeSerial GatewayListListParamsType = "SERIAL"` - `const GatewayListListParamsTypeURL GatewayListListParamsType = "URL"` - `const GatewayListListParamsTypeDomain GatewayListListParamsType = "DOMAIN"` - `const GatewayListListParamsTypeEmail GatewayListListParamsType = "EMAIL"` - `const GatewayListListParamsTypeIP GatewayListListParamsType = "IP"` - `const GatewayListListParamsTypeCategory GatewayListListParamsType = "CATEGORY"` - `const GatewayListListParamsTypeLocation GatewayListListParamsType = "LOCATION"` - `const GatewayListListParamsTypeDevice GatewayListListParamsType = "DEVICE"` ### Returns - `type GatewayList struct{…}` - `ID string` Identify the API resource with a UUID. - `Count float64` Indicate the number of items in the list. - `CreatedAt Time` - `Description string` Provide the list description. - `Items []GatewayItem` Provide the list items. - `CreatedAt Time` - `Description string` Provide the list item description (optional). - `Value string` Specify the item value. - `Name string` Specify the list name. - `Type GatewayListType` Specify the list type. - `const GatewayListTypeSerial GatewayListType = "SERIAL"` - `const GatewayListTypeURL GatewayListType = "URL"` - `const GatewayListTypeDomain GatewayListType = "DOMAIN"` - `const GatewayListTypeEmail GatewayListType = "EMAIL"` - `const GatewayListTypeIP GatewayListType = "IP"` - `const GatewayListTypeCategory GatewayListType = "CATEGORY"` - `const GatewayListTypeLocation GatewayListType = "LOCATION"` - `const GatewayListTypeDevice GatewayListType = "DEVICE"` - `UpdatedAt Time` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.ZeroTrust.Gateway.Lists.List(context.TODO(), zero_trust.GatewayListListParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "count": 20, "created_at": "2014-01-01T05:20:00.12345Z", "description": "The serial numbers for administrators", "items": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "Austin office IP", "value": "8GE8721REF" } ], "name": "Admin Serial Numbers", "type": "SERIAL", "updated_at": "2014-01-01T05:20:00.12345Z" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get Zero Trust list details `client.ZeroTrust.Gateway.Lists.Get(ctx, listID, query) (*GatewayList, error)` **get** `/accounts/{account_id}/gateway/lists/{list_id}` Fetch a single Zero Trust list. ### Parameters - `listID string` Identify the API resource with a UUID. - `query GatewayListGetParams` - `AccountID param.Field[string]` ### Returns - `type GatewayList struct{…}` - `ID string` Identify the API resource with a UUID. - `Count float64` Indicate the number of items in the list. - `CreatedAt Time` - `Description string` Provide the list description. - `Items []GatewayItem` Provide the list items. - `CreatedAt Time` - `Description string` Provide the list item description (optional). - `Value string` Specify the item value. - `Name string` Specify the list name. - `Type GatewayListType` Specify the list type. - `const GatewayListTypeSerial GatewayListType = "SERIAL"` - `const GatewayListTypeURL GatewayListType = "URL"` - `const GatewayListTypeDomain GatewayListType = "DOMAIN"` - `const GatewayListTypeEmail GatewayListType = "EMAIL"` - `const GatewayListTypeIP GatewayListType = "IP"` - `const GatewayListTypeCategory GatewayListType = "CATEGORY"` - `const GatewayListTypeLocation GatewayListType = "LOCATION"` - `const GatewayListTypeDevice GatewayListType = "DEVICE"` - `UpdatedAt Time` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) gatewayList, err := client.ZeroTrust.Gateway.Lists.Get( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.GatewayListGetParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", gatewayList.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "count": 20, "created_at": "2014-01-01T05:20:00.12345Z", "description": "The serial numbers for administrators", "items": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "Austin office IP", "value": "8GE8721REF" } ], "name": "Admin Serial Numbers", "type": "SERIAL", "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Create Zero Trust list `client.ZeroTrust.Gateway.Lists.New(ctx, params) (*GatewayListNewResponse, error)` **post** `/accounts/{account_id}/gateway/lists` Creates a new Zero Trust list. ### Parameters - `params GatewayListNewParams` - `AccountID param.Field[string]` Path param - `Name param.Field[string]` Body param: Specify the list name. - `Type param.Field[GatewayListNewParamsType]` Body param: Specify the list type. - `const GatewayListNewParamsTypeSerial GatewayListNewParamsType = "SERIAL"` - `const GatewayListNewParamsTypeURL GatewayListNewParamsType = "URL"` - `const GatewayListNewParamsTypeDomain GatewayListNewParamsType = "DOMAIN"` - `const GatewayListNewParamsTypeEmail GatewayListNewParamsType = "EMAIL"` - `const GatewayListNewParamsTypeIP GatewayListNewParamsType = "IP"` - `const GatewayListNewParamsTypeCategory GatewayListNewParamsType = "CATEGORY"` - `const GatewayListNewParamsTypeLocation GatewayListNewParamsType = "LOCATION"` - `const GatewayListNewParamsTypeDevice GatewayListNewParamsType = "DEVICE"` - `Description param.Field[string]` Body param: Provide the list description. - `Items param.Field[[]GatewayListNewParamsItem]` Body param: Add items to the list. - `Description string` Provide the list item description (optional). - `Value string` Specify the item value. ### Returns - `type GatewayListNewResponse struct{…}` - `ID string` Identify the API resource with a UUID. - `CreatedAt Time` - `Description string` Provide the list description. - `Items []GatewayItem` Provide the list items. - `CreatedAt Time` - `Description string` Provide the list item description (optional). - `Value string` Specify the item value. - `Name string` Specify the list name. - `Type GatewayListNewResponseType` Specify the list type. - `const GatewayListNewResponseTypeSerial GatewayListNewResponseType = "SERIAL"` - `const GatewayListNewResponseTypeURL GatewayListNewResponseType = "URL"` - `const GatewayListNewResponseTypeDomain GatewayListNewResponseType = "DOMAIN"` - `const GatewayListNewResponseTypeEmail GatewayListNewResponseType = "EMAIL"` - `const GatewayListNewResponseTypeIP GatewayListNewResponseType = "IP"` - `const GatewayListNewResponseTypeCategory GatewayListNewResponseType = "CATEGORY"` - `const GatewayListNewResponseTypeLocation GatewayListNewResponseType = "LOCATION"` - `const GatewayListNewResponseTypeDevice GatewayListNewResponseType = "DEVICE"` - `UpdatedAt Time` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) list, err := client.ZeroTrust.Gateway.Lists.New(context.TODO(), zero_trust.GatewayListNewParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), Name: cloudflare.F("Admin Serial Numbers"), Type: cloudflare.F(zero_trust.GatewayListNewParamsTypeSerial), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", list.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2014-01-01T05:20:00.12345Z", "description": "The serial numbers for administrators", "items": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "Austin office IP", "value": "8GE8721REF" } ], "name": "Admin Serial Numbers", "type": "SERIAL", "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Update Zero Trust list `client.ZeroTrust.Gateway.Lists.Update(ctx, listID, params) (*GatewayList, error)` **put** `/accounts/{account_id}/gateway/lists/{list_id}` Updates a configured Zero Trust list. Skips updating list items if not included in the payload. A non empty list items will overwrite the existing list. ### Parameters - `listID string` Identify the API resource with a UUID. - `params GatewayListUpdateParams` - `AccountID param.Field[string]` Path param - `Name param.Field[string]` Body param: Specify the list name. - `Description param.Field[string]` Body param: Provide the list description. - `Items param.Field[[]GatewayListUpdateParamsItem]` Body param: Add items to the list. - `Description string` Provide the list item description (optional). - `Value string` Specify the item value. ### Returns - `type GatewayList struct{…}` - `ID string` Identify the API resource with a UUID. - `Count float64` Indicate the number of items in the list. - `CreatedAt Time` - `Description string` Provide the list description. - `Items []GatewayItem` Provide the list items. - `CreatedAt Time` - `Description string` Provide the list item description (optional). - `Value string` Specify the item value. - `Name string` Specify the list name. - `Type GatewayListType` Specify the list type. - `const GatewayListTypeSerial GatewayListType = "SERIAL"` - `const GatewayListTypeURL GatewayListType = "URL"` - `const GatewayListTypeDomain GatewayListType = "DOMAIN"` - `const GatewayListTypeEmail GatewayListType = "EMAIL"` - `const GatewayListTypeIP GatewayListType = "IP"` - `const GatewayListTypeCategory GatewayListType = "CATEGORY"` - `const GatewayListTypeLocation GatewayListType = "LOCATION"` - `const GatewayListTypeDevice GatewayListType = "DEVICE"` - `UpdatedAt Time` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) gatewayList, err := client.ZeroTrust.Gateway.Lists.Update( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.GatewayListUpdateParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), Name: cloudflare.F("Admin Serial Numbers"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", gatewayList.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "count": 20, "created_at": "2014-01-01T05:20:00.12345Z", "description": "The serial numbers for administrators", "items": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "Austin office IP", "value": "8GE8721REF" } ], "name": "Admin Serial Numbers", "type": "SERIAL", "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Patch Zero Trust list. `client.ZeroTrust.Gateway.Lists.Edit(ctx, listID, params) (*GatewayList, error)` **patch** `/accounts/{account_id}/gateway/lists/{list_id}` Appends or removes an item from a configured Zero Trust list. ### Parameters - `listID string` Identify the API resource with a UUID. - `params GatewayListEditParams` - `AccountID param.Field[string]` Path param - `Append param.Field[[]GatewayListEditParamsAppend]` Body param: Add items to the list. - `Description string` Provide the list item description (optional). - `Value string` Specify the item value. - `Remove param.Field[[]string]` Body param: Lists of item values you want to remove. ### Returns - `type GatewayList struct{…}` - `ID string` Identify the API resource with a UUID. - `Count float64` Indicate the number of items in the list. - `CreatedAt Time` - `Description string` Provide the list description. - `Items []GatewayItem` Provide the list items. - `CreatedAt Time` - `Description string` Provide the list item description (optional). - `Value string` Specify the item value. - `Name string` Specify the list name. - `Type GatewayListType` Specify the list type. - `const GatewayListTypeSerial GatewayListType = "SERIAL"` - `const GatewayListTypeURL GatewayListType = "URL"` - `const GatewayListTypeDomain GatewayListType = "DOMAIN"` - `const GatewayListTypeEmail GatewayListType = "EMAIL"` - `const GatewayListTypeIP GatewayListType = "IP"` - `const GatewayListTypeCategory GatewayListType = "CATEGORY"` - `const GatewayListTypeLocation GatewayListType = "LOCATION"` - `const GatewayListTypeDevice GatewayListType = "DEVICE"` - `UpdatedAt Time` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) gatewayList, err := client.ZeroTrust.Gateway.Lists.Edit( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.GatewayListEditParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", gatewayList.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "count": 20, "created_at": "2014-01-01T05:20:00.12345Z", "description": "The serial numbers for administrators", "items": [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "Austin office IP", "value": "8GE8721REF" } ], "name": "Admin Serial Numbers", "type": "SERIAL", "updated_at": "2014-01-01T05:20:00.12345Z" } } ``` ## Delete Zero Trust list `client.ZeroTrust.Gateway.Lists.Delete(ctx, listID, body) (*GatewayListDeleteResponse, error)` **delete** `/accounts/{account_id}/gateway/lists/{list_id}` Deletes a Zero Trust list. ### Parameters - `listID string` Identify the API resource with a UUID. - `body GatewayListDeleteParams` - `AccountID param.Field[string]` ### Returns - `type GatewayListDeleteResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) list, err := client.ZeroTrust.Gateway.Lists.Delete( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.GatewayListDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", list) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": {} } ``` ## Domain Types ### Gateway Item - `type GatewayItem struct{…}` - `CreatedAt Time` - `Description string` Provide the list item description (optional). - `Value string` Specify the item value. ### Gateway List - `type GatewayList struct{…}` - `ID string` Identify the API resource with a UUID. - `Count float64` Indicate the number of items in the list. - `CreatedAt Time` - `Description string` Provide the list description. - `Items []GatewayItem` Provide the list items. - `CreatedAt Time` - `Description string` Provide the list item description (optional). - `Value string` Specify the item value. - `Name string` Specify the list name. - `Type GatewayListType` Specify the list type. - `const GatewayListTypeSerial GatewayListType = "SERIAL"` - `const GatewayListTypeURL GatewayListType = "URL"` - `const GatewayListTypeDomain GatewayListType = "DOMAIN"` - `const GatewayListTypeEmail GatewayListType = "EMAIL"` - `const GatewayListTypeIP GatewayListType = "IP"` - `const GatewayListTypeCategory GatewayListType = "CATEGORY"` - `const GatewayListTypeLocation GatewayListType = "LOCATION"` - `const GatewayListTypeDevice GatewayListType = "DEVICE"` - `UpdatedAt Time` # Items ## Get Zero Trust list items `client.ZeroTrust.Gateway.Lists.Items.List(ctx, listID, query) (*SinglePage[[]GatewayItem], error)` **get** `/accounts/{account_id}/gateway/lists/{list_id}/items` Fetch all items in a single Zero Trust list. ### Parameters - `listID string` Identify the API resource with a UUID. - `query GatewayListItemListParams` - `AccountID param.Field[string]` ### Returns - `type GatewayListItemListResponseEnvelopeResult []GatewayItem` Provide the list items. - `CreatedAt Time` - `Description string` Provide the list item description (optional). - `Value string` Specify the item value. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.ZeroTrust.Gateway.Lists.Items.List( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.GatewayListItemListParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ [ { "created_at": "2014-01-01T05:20:00.12345Z", "description": "Austin office IP", "value": "8GE8721REF" } ] ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ```