# Scans # Results ## Get the Latest Scan Result `client.CloudforceOne.Scans.Results.Get(ctx, configID, query) (*ScanResultGetResponse, error)` **get** `/accounts/{account_id}/cloudforce-one/scans/results/{config_id}` Get the Latest Scan Result ### Parameters - `configID string` Defines the Config ID. - `query ScanResultGetParams` - `AccountID param.Field[string]` Defines the Account ID. ### Returns - `type ScanResultGetResponse struct{…}` - `OneOneOneOne []ScanResult` - `Number float64` - `Proto string` - `Status string` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/cloudforce_one" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) result, err := client.CloudforceOne.Scans.Results.Get( context.TODO(), "config_id", cloudforce_one.ScanResultGetParams{ AccountID: cloudflare.F("account_id"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", result.Number1.Number1.Number1.Number1) } ``` #### Response ```json { "errors": [ "string" ], "messages": [ "string" ], "result": { "1.1.1.1": [ { "number": 8080, "proto": "tcp", "status": "open" } ] }, "success": true } ``` ## Domain Types ### Scan Result - `type ScanResult struct{…}` - `Number float64` - `Proto string` - `Status string` # Config ## List Scan Configs `client.CloudforceOne.Scans.Config.List(ctx, query) (*SinglePage[ScanConfigListResponse], error)` **get** `/accounts/{account_id}/cloudforce-one/scans/config` List Scan Configs ### Parameters - `query ScanConfigListParams` - `AccountID param.Field[string]` Defines the Account ID. ### Returns - `type ScanConfigListResponse struct{…}` - `ID string` Defines the Config ID. - `AccountID string` - `Frequency float64` Defines the number of days between each scan (0 = One-off scan). - `IPs []string` Defines a list of IP addresses or CIDR blocks to scan. The maximum number of total IP addresses allowed is 5000. - `Ports []string` Defines a list of ports to scan. Valid values are:"default", "all", or a comma-separated list of ports or range of ports (e.g. ["1-80", "443"]). "default" scans the 100 most commonly open ports. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/cloudforce_one" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.CloudforceOne.Scans.Config.List(context.TODO(), cloudforce_one.ScanConfigListParams{ AccountID: cloudflare.F("account_id"), }) 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": "uuid", "account_id": "abcd1234abcd1234abcd1234abcd1234", "frequency": 7, "ips": [ "1.1.1.1", "2606:4700:4700::1111" ], "ports": [ "default" ] } ] } ``` ## Create a new Scan Config `client.CloudforceOne.Scans.Config.New(ctx, params) (*ScanConfigNewResponse, error)` **post** `/accounts/{account_id}/cloudforce-one/scans/config` Create a new Scan Config ### Parameters - `params ScanConfigNewParams` - `AccountID param.Field[string]` Path param: Defines the Account ID. - `IPs param.Field[[]string]` Body param: Defines a list of IP addresses or CIDR blocks to scan. The maximum number of total IP addresses allowed is 5000. - `Frequency param.Field[float64]` Body param: Defines the number of days between each scan (0 = One-off scan). - `Ports param.Field[[]string]` Body param: Defines a list of ports to scan. Valid values are:"default", "all", or a comma-separated list of ports or range of ports (e.g. ["1-80", "443"]). "default" scans the 100 most commonly open ports. ### Returns - `type ScanConfigNewResponse struct{…}` - `ID string` Defines the Config ID. - `AccountID string` - `Frequency float64` Defines the number of days between each scan (0 = One-off scan). - `IPs []string` Defines a list of IP addresses or CIDR blocks to scan. The maximum number of total IP addresses allowed is 5000. - `Ports []string` Defines a list of ports to scan. Valid values are:"default", "all", or a comma-separated list of ports or range of ports (e.g. ["1-80", "443"]). "default" scans the 100 most commonly open ports. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/cloudforce_one" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) config, err := client.CloudforceOne.Scans.Config.New(context.TODO(), cloudforce_one.ScanConfigNewParams{ AccountID: cloudflare.F("account_id"), IPs: cloudflare.F([]string{"1.1.1.1", "2606:4700:4700::1111"}), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", config.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": "uuid", "account_id": "abcd1234abcd1234abcd1234abcd1234", "frequency": 7, "ips": [ "1.1.1.1", "2606:4700:4700::1111" ], "ports": [ "default" ] } } ``` ## Update an existing Scan Config `client.CloudforceOne.Scans.Config.Edit(ctx, configID, params) (*ScanConfigEditResponse, error)` **patch** `/accounts/{account_id}/cloudforce-one/scans/config/{config_id}` Update an existing Scan Config ### Parameters - `configID string` Defines the Config ID. - `params ScanConfigEditParams` - `AccountID param.Field[string]` Path param: Defines the Account ID. - `Frequency param.Field[float64]` Body param: Defines the number of days between each scan (0 = One-off scan). - `IPs param.Field[[]string]` Body param: Defines a list of IP addresses or CIDR blocks to scan. The maximum number of total IP addresses allowed is 5000. - `Ports param.Field[[]string]` Body param: Defines a list of ports to scan. Valid values are:"default", "all", or a comma-separated list of ports or range of ports (e.g. ["1-80", "443"]). "default" scans the 100 most commonly open ports. ### Returns - `type ScanConfigEditResponse struct{…}` - `ID string` Defines the Config ID. - `AccountID string` - `Frequency float64` Defines the number of days between each scan (0 = One-off scan). - `IPs []string` Defines a list of IP addresses or CIDR blocks to scan. The maximum number of total IP addresses allowed is 5000. - `Ports []string` Defines a list of ports to scan. Valid values are:"default", "all", or a comma-separated list of ports or range of ports (e.g. ["1-80", "443"]). "default" scans the 100 most commonly open ports. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/cloudforce_one" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.CloudforceOne.Scans.Config.Edit( context.TODO(), "config_id", cloudforce_one.ScanConfigEditParams{ AccountID: cloudflare.F("account_id"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.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": "uuid", "account_id": "abcd1234abcd1234abcd1234abcd1234", "frequency": 7, "ips": [ "1.1.1.1", "2606:4700:4700::1111" ], "ports": [ "default" ] } } ``` ## Delete a Scan Config `client.CloudforceOne.Scans.Config.Delete(ctx, configID, body) (*ScanConfigDeleteResponse, error)` **delete** `/accounts/{account_id}/cloudforce-one/scans/config/{config_id}` Delete a Scan Config ### Parameters - `configID string` Defines the Config ID. - `body ScanConfigDeleteParams` - `AccountID param.Field[string]` Defines the Account ID. ### Returns - `type ScanConfigDeleteResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/cloudforce_one" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) config, err := client.CloudforceOne.Scans.Config.Delete( context.TODO(), "config_id", cloudforce_one.ScanConfigDeleteParams{ AccountID: cloudflare.F("account_id"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", config) } ``` #### Response ```json { "errors": [ "string" ], "messages": [ "string" ], "result": {}, "success": true } ```