Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

3337 rader
117 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package websecurityscanner provides access to the Web Security Scanner API.
  6. //
  7. // For product documentation, see: https://cloud.google.com/security-scanner/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/websecurityscanner/v1alpha"
  14. // ...
  15. // ctx := context.Background()
  16. // websecurityscannerService, err := websecurityscanner.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // websecurityscannerService, err := websecurityscanner.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // websecurityscannerService, err := websecurityscanner.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package websecurityscanner // import "google.golang.org/api/websecurityscanner/v1alpha"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "websecurityscanner:v1alpha"
  67. const apiName = "websecurityscanner"
  68. const apiVersion = "v1alpha"
  69. const basePath = "https://websecurityscanner.googleapis.com/"
  70. // OAuth2 scopes used by this API.
  71. const (
  72. // View and manage your data across Google Cloud Platform services
  73. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  74. )
  75. // NewService creates a new Service.
  76. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  77. scopesOption := option.WithScopes(
  78. "https://www.googleapis.com/auth/cloud-platform",
  79. )
  80. // NOTE: prepend, so we don't override user-specified scopes.
  81. opts = append([]option.ClientOption{scopesOption}, opts...)
  82. client, endpoint, err := htransport.NewClient(ctx, opts...)
  83. if err != nil {
  84. return nil, err
  85. }
  86. s, err := New(client)
  87. if err != nil {
  88. return nil, err
  89. }
  90. if endpoint != "" {
  91. s.BasePath = endpoint
  92. }
  93. return s, nil
  94. }
  95. // New creates a new Service. It uses the provided http.Client for requests.
  96. //
  97. // Deprecated: please use NewService instead.
  98. // To provide a custom HTTP client, use option.WithHTTPClient.
  99. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  100. func New(client *http.Client) (*Service, error) {
  101. if client == nil {
  102. return nil, errors.New("client is nil")
  103. }
  104. s := &Service{client: client, BasePath: basePath}
  105. s.Projects = NewProjectsService(s)
  106. return s, nil
  107. }
  108. type Service struct {
  109. client *http.Client
  110. BasePath string // API endpoint base URL
  111. UserAgent string // optional additional User-Agent fragment
  112. Projects *ProjectsService
  113. }
  114. func (s *Service) userAgent() string {
  115. if s.UserAgent == "" {
  116. return googleapi.UserAgent
  117. }
  118. return googleapi.UserAgent + " " + s.UserAgent
  119. }
  120. func NewProjectsService(s *Service) *ProjectsService {
  121. rs := &ProjectsService{s: s}
  122. rs.ScanConfigs = NewProjectsScanConfigsService(s)
  123. return rs
  124. }
  125. type ProjectsService struct {
  126. s *Service
  127. ScanConfigs *ProjectsScanConfigsService
  128. }
  129. func NewProjectsScanConfigsService(s *Service) *ProjectsScanConfigsService {
  130. rs := &ProjectsScanConfigsService{s: s}
  131. rs.ScanRuns = NewProjectsScanConfigsScanRunsService(s)
  132. return rs
  133. }
  134. type ProjectsScanConfigsService struct {
  135. s *Service
  136. ScanRuns *ProjectsScanConfigsScanRunsService
  137. }
  138. func NewProjectsScanConfigsScanRunsService(s *Service) *ProjectsScanConfigsScanRunsService {
  139. rs := &ProjectsScanConfigsScanRunsService{s: s}
  140. rs.CrawledUrls = NewProjectsScanConfigsScanRunsCrawledUrlsService(s)
  141. rs.FindingTypeStats = NewProjectsScanConfigsScanRunsFindingTypeStatsService(s)
  142. rs.Findings = NewProjectsScanConfigsScanRunsFindingsService(s)
  143. return rs
  144. }
  145. type ProjectsScanConfigsScanRunsService struct {
  146. s *Service
  147. CrawledUrls *ProjectsScanConfigsScanRunsCrawledUrlsService
  148. FindingTypeStats *ProjectsScanConfigsScanRunsFindingTypeStatsService
  149. Findings *ProjectsScanConfigsScanRunsFindingsService
  150. }
  151. func NewProjectsScanConfigsScanRunsCrawledUrlsService(s *Service) *ProjectsScanConfigsScanRunsCrawledUrlsService {
  152. rs := &ProjectsScanConfigsScanRunsCrawledUrlsService{s: s}
  153. return rs
  154. }
  155. type ProjectsScanConfigsScanRunsCrawledUrlsService struct {
  156. s *Service
  157. }
  158. func NewProjectsScanConfigsScanRunsFindingTypeStatsService(s *Service) *ProjectsScanConfigsScanRunsFindingTypeStatsService {
  159. rs := &ProjectsScanConfigsScanRunsFindingTypeStatsService{s: s}
  160. return rs
  161. }
  162. type ProjectsScanConfigsScanRunsFindingTypeStatsService struct {
  163. s *Service
  164. }
  165. func NewProjectsScanConfigsScanRunsFindingsService(s *Service) *ProjectsScanConfigsScanRunsFindingsService {
  166. rs := &ProjectsScanConfigsScanRunsFindingsService{s: s}
  167. return rs
  168. }
  169. type ProjectsScanConfigsScanRunsFindingsService struct {
  170. s *Service
  171. }
  172. // Authentication: Scan authentication configuration.
  173. type Authentication struct {
  174. // CustomAccount: Authentication using a custom account.
  175. CustomAccount *CustomAccount `json:"customAccount,omitempty"`
  176. // GoogleAccount: Authentication using a Google account.
  177. GoogleAccount *GoogleAccount `json:"googleAccount,omitempty"`
  178. // ForceSendFields is a list of field names (e.g. "CustomAccount") to
  179. // unconditionally include in API requests. By default, fields with
  180. // empty values are omitted from API requests. However, any non-pointer,
  181. // non-interface field appearing in ForceSendFields will be sent to the
  182. // server regardless of whether the field is empty or not. This may be
  183. // used to include empty fields in Patch requests.
  184. ForceSendFields []string `json:"-"`
  185. // NullFields is a list of field names (e.g. "CustomAccount") to include
  186. // in API requests with the JSON null value. By default, fields with
  187. // empty values are omitted from API requests. However, any field with
  188. // an empty value appearing in NullFields will be sent to the server as
  189. // null. It is an error if a field in this list has a non-empty value.
  190. // This may be used to include null fields in Patch requests.
  191. NullFields []string `json:"-"`
  192. }
  193. func (s *Authentication) MarshalJSON() ([]byte, error) {
  194. type NoMethod Authentication
  195. raw := NoMethod(*s)
  196. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  197. }
  198. // CrawledUrl: A CrawledUrl resource represents a URL that was crawled
  199. // during a ScanRun. Web
  200. // Security Scanner Service crawls the web applications, following all
  201. // links
  202. // within the scope of sites, to find the URLs to test against.
  203. type CrawledUrl struct {
  204. // Body: Output only.
  205. // The body of the request that was used to visit the URL.
  206. Body string `json:"body,omitempty"`
  207. // HttpMethod: Output only.
  208. // The http method of the request that was used to visit the URL,
  209. // in
  210. // uppercase.
  211. HttpMethod string `json:"httpMethod,omitempty"`
  212. // Url: Output only.
  213. // The URL that was crawled.
  214. Url string `json:"url,omitempty"`
  215. // ForceSendFields is a list of field names (e.g. "Body") to
  216. // unconditionally include in API requests. By default, fields with
  217. // empty values are omitted from API requests. However, any non-pointer,
  218. // non-interface field appearing in ForceSendFields will be sent to the
  219. // server regardless of whether the field is empty or not. This may be
  220. // used to include empty fields in Patch requests.
  221. ForceSendFields []string `json:"-"`
  222. // NullFields is a list of field names (e.g. "Body") to include in API
  223. // requests with the JSON null value. By default, fields with empty
  224. // values are omitted from API requests. However, any field with an
  225. // empty value appearing in NullFields will be sent to the server as
  226. // null. It is an error if a field in this list has a non-empty value.
  227. // This may be used to include null fields in Patch requests.
  228. NullFields []string `json:"-"`
  229. }
  230. func (s *CrawledUrl) MarshalJSON() ([]byte, error) {
  231. type NoMethod CrawledUrl
  232. raw := NoMethod(*s)
  233. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  234. }
  235. // CustomAccount: Describes authentication configuration that uses a
  236. // custom account.
  237. type CustomAccount struct {
  238. // LoginUrl: Required.
  239. // The login form URL of the website.
  240. LoginUrl string `json:"loginUrl,omitempty"`
  241. // Password: Input only.
  242. // Required.
  243. // The password of the custom account. The credential is stored
  244. // encrypted
  245. // and not returned in any response nor included in audit logs.
  246. Password string `json:"password,omitempty"`
  247. // Username: Required.
  248. // The user name of the custom account.
  249. Username string `json:"username,omitempty"`
  250. // ForceSendFields is a list of field names (e.g. "LoginUrl") to
  251. // unconditionally include in API requests. By default, fields with
  252. // empty values are omitted from API requests. However, any non-pointer,
  253. // non-interface field appearing in ForceSendFields will be sent to the
  254. // server regardless of whether the field is empty or not. This may be
  255. // used to include empty fields in Patch requests.
  256. ForceSendFields []string `json:"-"`
  257. // NullFields is a list of field names (e.g. "LoginUrl") to include in
  258. // API requests with the JSON null value. By default, fields with empty
  259. // values are omitted from API requests. However, any field with an
  260. // empty value appearing in NullFields will be sent to the server as
  261. // null. It is an error if a field in this list has a non-empty value.
  262. // This may be used to include null fields in Patch requests.
  263. NullFields []string `json:"-"`
  264. }
  265. func (s *CustomAccount) MarshalJSON() ([]byte, error) {
  266. type NoMethod CustomAccount
  267. raw := NoMethod(*s)
  268. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  269. }
  270. // Empty: A generic empty message that you can re-use to avoid defining
  271. // duplicated
  272. // empty messages in your APIs. A typical example is to use it as the
  273. // request
  274. // or the response type of an API method. For instance:
  275. //
  276. // service Foo {
  277. // rpc Bar(google.protobuf.Empty) returns
  278. // (google.protobuf.Empty);
  279. // }
  280. //
  281. // The JSON representation for `Empty` is empty JSON object `{}`.
  282. type Empty struct {
  283. // ServerResponse contains the HTTP response code and headers from the
  284. // server.
  285. googleapi.ServerResponse `json:"-"`
  286. }
  287. // Finding: A Finding resource represents a vulnerability instance
  288. // identified during a
  289. // ScanRun.
  290. type Finding struct {
  291. // Body: Output only.
  292. // The body of the request that triggered the vulnerability.
  293. Body string `json:"body,omitempty"`
  294. // Description: Output only.
  295. // The description of the vulnerability.
  296. Description string `json:"description,omitempty"`
  297. // FinalUrl: Output only.
  298. // The URL where the browser lands when the vulnerability is detected.
  299. FinalUrl string `json:"finalUrl,omitempty"`
  300. // FindingType: Output only.
  301. // The type of the Finding.
  302. //
  303. // Possible values:
  304. // "FINDING_TYPE_UNSPECIFIED" - The invalid finding type.
  305. // "MIXED_CONTENT" - A page that was served over HTTPS also resources
  306. // over HTTP. A
  307. // man-in-the-middle attacker could tamper with the HTTP resource and
  308. // gain
  309. // full access to the website that loads the resource or to monitor
  310. // the
  311. // actions taken by the user.
  312. // "OUTDATED_LIBRARY" - The version of an included library is known to
  313. // contain a security issue.
  314. // The scanner checks the version of library in use against a known list
  315. // of
  316. // vulnerable libraries. False positives are possible if the
  317. // version
  318. // detection fails or if the library has been manually patched.
  319. // "ROSETTA_FLASH" - This type of vulnerability occurs when the value
  320. // of a request parameter
  321. // is reflected at the beginning of the response, for example, in
  322. // requests
  323. // using JSONP. Under certain circumstances, an attacker may be able
  324. // to
  325. // supply an alphanumeric-only Flash file in the vulnerable
  326. // parameter
  327. // causing the browser to execute the Flash file as if it originated on
  328. // the
  329. // vulnerable server.
  330. // "XSS_CALLBACK" - A cross-site scripting (XSS) bug is found via
  331. // JavaScript callback. For
  332. // detailed explanations on XSS,
  333. // see
  334. // https://www.google.com/about/appsecurity/learning/xss/.
  335. // "XSS_ERROR" - A potential cross-site scripting (XSS) bug due to
  336. // JavaScript breakage.
  337. // In some circumstances, the application under test might modify the
  338. // test
  339. // string before it is parsed by the browser. When the browser attempts
  340. // to
  341. // runs this modified test string, it will likely break and throw
  342. // a
  343. // JavaScript execution error, thus an injection issue is
  344. // occurring.
  345. // However, it may not be exploitable. Manual verification is needed to
  346. // see
  347. // if the test string modifications can be evaded and confirm that the
  348. // issue
  349. // is in fact an XSS vulnerability. For detailed explanations on XSS,
  350. // see
  351. // https://www.google.com/about/appsecurity/learning/xss/.
  352. // "CLEAR_TEXT_PASSWORD" - An application appears to be transmitting a
  353. // password field in clear text.
  354. // An attacker can eavesdrop network traffic and sniff the password
  355. // field.
  356. // "INVALID_CONTENT_TYPE" - An application returns sensitive content
  357. // with an invalid content type,
  358. // or without an 'X-Content-Type-Options: nosniff' header.
  359. // "XSS_ANGULAR_CALLBACK" - A cross-site scripting (XSS) vulnerability
  360. // in AngularJS module that
  361. // occurs when a user-provided string is interpolated by Angular.
  362. // "INVALID_HEADER" - A malformed or invalid valued header.
  363. // "MISSPELLED_SECURITY_HEADER_NAME" - Misspelled security header
  364. // name.
  365. // "MISMATCHING_SECURITY_HEADER_VALUES" - Mismatching values in a
  366. // duplicate security header.
  367. FindingType string `json:"findingType,omitempty"`
  368. // FrameUrl: Output only.
  369. // If the vulnerability was originated from nested IFrame, the
  370. // immediate
  371. // parent IFrame is reported.
  372. FrameUrl string `json:"frameUrl,omitempty"`
  373. // FuzzedUrl: Output only.
  374. // The URL produced by the server-side fuzzer and used in the request
  375. // that
  376. // triggered the vulnerability.
  377. FuzzedUrl string `json:"fuzzedUrl,omitempty"`
  378. // HttpMethod: Output only.
  379. // The http method of the request that triggered the vulnerability,
  380. // in
  381. // uppercase.
  382. HttpMethod string `json:"httpMethod,omitempty"`
  383. // Name: Output only.
  384. // The resource name of the Finding. The name follows the format
  385. // of
  386. // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunI
  387. // d}/findings/{findingId}'.
  388. // The finding IDs are generated by the system.
  389. Name string `json:"name,omitempty"`
  390. // OutdatedLibrary: Output only.
  391. // An addon containing information about outdated libraries.
  392. OutdatedLibrary *OutdatedLibrary `json:"outdatedLibrary,omitempty"`
  393. // ReproductionUrl: Output only.
  394. // The URL containing human-readable payload that user can leverage
  395. // to
  396. // reproduce the vulnerability.
  397. ReproductionUrl string `json:"reproductionUrl,omitempty"`
  398. // TrackingId: Output only.
  399. // The tracking ID uniquely identifies a vulnerability instance
  400. // across
  401. // multiple ScanRuns.
  402. TrackingId string `json:"trackingId,omitempty"`
  403. // ViolatingResource: Output only.
  404. // An addon containing detailed information regarding any resource
  405. // causing the
  406. // vulnerability such as JavaScript sources, image, audio files, etc.
  407. ViolatingResource *ViolatingResource `json:"violatingResource,omitempty"`
  408. // VulnerableHeaders: Output only.
  409. // An addon containing information about vulnerable or missing HTTP
  410. // headers.
  411. VulnerableHeaders *VulnerableHeaders `json:"vulnerableHeaders,omitempty"`
  412. // VulnerableParameters: Output only.
  413. // An addon containing information about request parameters which were
  414. // found
  415. // to be vulnerable.
  416. VulnerableParameters *VulnerableParameters `json:"vulnerableParameters,omitempty"`
  417. // Xss: Output only.
  418. // An addon containing information reported for an XSS, if any.
  419. Xss *Xss `json:"xss,omitempty"`
  420. // ServerResponse contains the HTTP response code and headers from the
  421. // server.
  422. googleapi.ServerResponse `json:"-"`
  423. // ForceSendFields is a list of field names (e.g. "Body") to
  424. // unconditionally include in API requests. By default, fields with
  425. // empty values are omitted from API requests. However, any non-pointer,
  426. // non-interface field appearing in ForceSendFields will be sent to the
  427. // server regardless of whether the field is empty or not. This may be
  428. // used to include empty fields in Patch requests.
  429. ForceSendFields []string `json:"-"`
  430. // NullFields is a list of field names (e.g. "Body") to include in API
  431. // requests with the JSON null value. By default, fields with empty
  432. // values are omitted from API requests. However, any field with an
  433. // empty value appearing in NullFields will be sent to the server as
  434. // null. It is an error if a field in this list has a non-empty value.
  435. // This may be used to include null fields in Patch requests.
  436. NullFields []string `json:"-"`
  437. }
  438. func (s *Finding) MarshalJSON() ([]byte, error) {
  439. type NoMethod Finding
  440. raw := NoMethod(*s)
  441. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  442. }
  443. // FindingTypeStats: A FindingTypeStats resource represents stats
  444. // regarding a specific FindingType
  445. // of Findings under a given ScanRun.
  446. type FindingTypeStats struct {
  447. // FindingCount: Output only.
  448. // The count of findings belonging to this finding type.
  449. FindingCount int64 `json:"findingCount,omitempty"`
  450. // FindingType: Output only.
  451. // The finding type associated with the stats.
  452. //
  453. // Possible values:
  454. // "FINDING_TYPE_UNSPECIFIED" - The invalid finding type.
  455. // "MIXED_CONTENT" - A page that was served over HTTPS also resources
  456. // over HTTP. A
  457. // man-in-the-middle attacker could tamper with the HTTP resource and
  458. // gain
  459. // full access to the website that loads the resource or to monitor
  460. // the
  461. // actions taken by the user.
  462. // "OUTDATED_LIBRARY" - The version of an included library is known to
  463. // contain a security issue.
  464. // The scanner checks the version of library in use against a known list
  465. // of
  466. // vulnerable libraries. False positives are possible if the
  467. // version
  468. // detection fails or if the library has been manually patched.
  469. // "ROSETTA_FLASH" - This type of vulnerability occurs when the value
  470. // of a request parameter
  471. // is reflected at the beginning of the response, for example, in
  472. // requests
  473. // using JSONP. Under certain circumstances, an attacker may be able
  474. // to
  475. // supply an alphanumeric-only Flash file in the vulnerable
  476. // parameter
  477. // causing the browser to execute the Flash file as if it originated on
  478. // the
  479. // vulnerable server.
  480. // "XSS_CALLBACK" - A cross-site scripting (XSS) bug is found via
  481. // JavaScript callback. For
  482. // detailed explanations on XSS,
  483. // see
  484. // https://www.google.com/about/appsecurity/learning/xss/.
  485. // "XSS_ERROR" - A potential cross-site scripting (XSS) bug due to
  486. // JavaScript breakage.
  487. // In some circumstances, the application under test might modify the
  488. // test
  489. // string before it is parsed by the browser. When the browser attempts
  490. // to
  491. // runs this modified test string, it will likely break and throw
  492. // a
  493. // JavaScript execution error, thus an injection issue is
  494. // occurring.
  495. // However, it may not be exploitable. Manual verification is needed to
  496. // see
  497. // if the test string modifications can be evaded and confirm that the
  498. // issue
  499. // is in fact an XSS vulnerability. For detailed explanations on XSS,
  500. // see
  501. // https://www.google.com/about/appsecurity/learning/xss/.
  502. // "CLEAR_TEXT_PASSWORD" - An application appears to be transmitting a
  503. // password field in clear text.
  504. // An attacker can eavesdrop network traffic and sniff the password
  505. // field.
  506. // "INVALID_CONTENT_TYPE" - An application returns sensitive content
  507. // with an invalid content type,
  508. // or without an 'X-Content-Type-Options: nosniff' header.
  509. // "XSS_ANGULAR_CALLBACK" - A cross-site scripting (XSS) vulnerability
  510. // in AngularJS module that
  511. // occurs when a user-provided string is interpolated by Angular.
  512. // "INVALID_HEADER" - A malformed or invalid valued header.
  513. // "MISSPELLED_SECURITY_HEADER_NAME" - Misspelled security header
  514. // name.
  515. // "MISMATCHING_SECURITY_HEADER_VALUES" - Mismatching values in a
  516. // duplicate security header.
  517. FindingType string `json:"findingType,omitempty"`
  518. // ForceSendFields is a list of field names (e.g. "FindingCount") to
  519. // unconditionally include in API requests. By default, fields with
  520. // empty values are omitted from API requests. However, any non-pointer,
  521. // non-interface field appearing in ForceSendFields will be sent to the
  522. // server regardless of whether the field is empty or not. This may be
  523. // used to include empty fields in Patch requests.
  524. ForceSendFields []string `json:"-"`
  525. // NullFields is a list of field names (e.g. "FindingCount") to include
  526. // in API requests with the JSON null value. By default, fields with
  527. // empty values are omitted from API requests. However, any field with
  528. // an empty value appearing in NullFields will be sent to the server as
  529. // null. It is an error if a field in this list has a non-empty value.
  530. // This may be used to include null fields in Patch requests.
  531. NullFields []string `json:"-"`
  532. }
  533. func (s *FindingTypeStats) MarshalJSON() ([]byte, error) {
  534. type NoMethod FindingTypeStats
  535. raw := NoMethod(*s)
  536. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  537. }
  538. // GoogleAccount: Describes authentication configuration that uses a
  539. // Google account.
  540. type GoogleAccount struct {
  541. // Password: Input only.
  542. // Required.
  543. // The password of the Google account. The credential is stored
  544. // encrypted
  545. // and not returned in any response nor included in audit logs.
  546. Password string `json:"password,omitempty"`
  547. // Username: Required.
  548. // The user name of the Google account.
  549. Username string `json:"username,omitempty"`
  550. // ForceSendFields is a list of field names (e.g. "Password") to
  551. // unconditionally include in API requests. By default, fields with
  552. // empty values are omitted from API requests. However, any non-pointer,
  553. // non-interface field appearing in ForceSendFields will be sent to the
  554. // server regardless of whether the field is empty or not. This may be
  555. // used to include empty fields in Patch requests.
  556. ForceSendFields []string `json:"-"`
  557. // NullFields is a list of field names (e.g. "Password") to include in
  558. // API requests with the JSON null value. By default, fields with empty
  559. // values are omitted from API requests. However, any field with an
  560. // empty value appearing in NullFields will be sent to the server as
  561. // null. It is an error if a field in this list has a non-empty value.
  562. // This may be used to include null fields in Patch requests.
  563. NullFields []string `json:"-"`
  564. }
  565. func (s *GoogleAccount) MarshalJSON() ([]byte, error) {
  566. type NoMethod GoogleAccount
  567. raw := NoMethod(*s)
  568. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  569. }
  570. // Header: Describes a HTTP Header.
  571. type Header struct {
  572. // Name: Header name.
  573. Name string `json:"name,omitempty"`
  574. // Value: Header value.
  575. Value string `json:"value,omitempty"`
  576. // ForceSendFields is a list of field names (e.g. "Name") to
  577. // unconditionally include in API requests. By default, fields with
  578. // empty values are omitted from API requests. However, any non-pointer,
  579. // non-interface field appearing in ForceSendFields will be sent to the
  580. // server regardless of whether the field is empty or not. This may be
  581. // used to include empty fields in Patch requests.
  582. ForceSendFields []string `json:"-"`
  583. // NullFields is a list of field names (e.g. "Name") to include in API
  584. // requests with the JSON null value. By default, fields with empty
  585. // values are omitted from API requests. However, any field with an
  586. // empty value appearing in NullFields will be sent to the server as
  587. // null. It is an error if a field in this list has a non-empty value.
  588. // This may be used to include null fields in Patch requests.
  589. NullFields []string `json:"-"`
  590. }
  591. func (s *Header) MarshalJSON() ([]byte, error) {
  592. type NoMethod Header
  593. raw := NoMethod(*s)
  594. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  595. }
  596. // ListCrawledUrlsResponse: Response for the `ListCrawledUrls` method.
  597. type ListCrawledUrlsResponse struct {
  598. // CrawledUrls: The list of CrawledUrls returned.
  599. CrawledUrls []*CrawledUrl `json:"crawledUrls,omitempty"`
  600. // NextPageToken: Token to retrieve the next page of results, or empty
  601. // if there are no
  602. // more results in the list.
  603. NextPageToken string `json:"nextPageToken,omitempty"`
  604. // ServerResponse contains the HTTP response code and headers from the
  605. // server.
  606. googleapi.ServerResponse `json:"-"`
  607. // ForceSendFields is a list of field names (e.g. "CrawledUrls") to
  608. // unconditionally include in API requests. By default, fields with
  609. // empty values are omitted from API requests. However, any non-pointer,
  610. // non-interface field appearing in ForceSendFields will be sent to the
  611. // server regardless of whether the field is empty or not. This may be
  612. // used to include empty fields in Patch requests.
  613. ForceSendFields []string `json:"-"`
  614. // NullFields is a list of field names (e.g. "CrawledUrls") to include
  615. // in API requests with the JSON null value. By default, fields with
  616. // empty values are omitted from API requests. However, any field with
  617. // an empty value appearing in NullFields will be sent to the server as
  618. // null. It is an error if a field in this list has a non-empty value.
  619. // This may be used to include null fields in Patch requests.
  620. NullFields []string `json:"-"`
  621. }
  622. func (s *ListCrawledUrlsResponse) MarshalJSON() ([]byte, error) {
  623. type NoMethod ListCrawledUrlsResponse
  624. raw := NoMethod(*s)
  625. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  626. }
  627. // ListFindingTypeStatsResponse: Response for the `ListFindingTypeStats`
  628. // method.
  629. type ListFindingTypeStatsResponse struct {
  630. // FindingTypeStats: The list of FindingTypeStats returned.
  631. FindingTypeStats []*FindingTypeStats `json:"findingTypeStats,omitempty"`
  632. // ServerResponse contains the HTTP response code and headers from the
  633. // server.
  634. googleapi.ServerResponse `json:"-"`
  635. // ForceSendFields is a list of field names (e.g. "FindingTypeStats") to
  636. // unconditionally include in API requests. By default, fields with
  637. // empty values are omitted from API requests. However, any non-pointer,
  638. // non-interface field appearing in ForceSendFields will be sent to the
  639. // server regardless of whether the field is empty or not. This may be
  640. // used to include empty fields in Patch requests.
  641. ForceSendFields []string `json:"-"`
  642. // NullFields is a list of field names (e.g. "FindingTypeStats") to
  643. // include in API requests with the JSON null value. By default, fields
  644. // with empty values are omitted from API requests. However, any field
  645. // with an empty value appearing in NullFields will be sent to the
  646. // server as null. It is an error if a field in this list has a
  647. // non-empty value. This may be used to include null fields in Patch
  648. // requests.
  649. NullFields []string `json:"-"`
  650. }
  651. func (s *ListFindingTypeStatsResponse) MarshalJSON() ([]byte, error) {
  652. type NoMethod ListFindingTypeStatsResponse
  653. raw := NoMethod(*s)
  654. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  655. }
  656. // ListFindingsResponse: Response for the `ListFindings` method.
  657. type ListFindingsResponse struct {
  658. // Findings: The list of Findings returned.
  659. Findings []*Finding `json:"findings,omitempty"`
  660. // NextPageToken: Token to retrieve the next page of results, or empty
  661. // if there are no
  662. // more results in the list.
  663. NextPageToken string `json:"nextPageToken,omitempty"`
  664. // ServerResponse contains the HTTP response code and headers from the
  665. // server.
  666. googleapi.ServerResponse `json:"-"`
  667. // ForceSendFields is a list of field names (e.g. "Findings") to
  668. // unconditionally include in API requests. By default, fields with
  669. // empty values are omitted from API requests. However, any non-pointer,
  670. // non-interface field appearing in ForceSendFields will be sent to the
  671. // server regardless of whether the field is empty or not. This may be
  672. // used to include empty fields in Patch requests.
  673. ForceSendFields []string `json:"-"`
  674. // NullFields is a list of field names (e.g. "Findings") to include in
  675. // API requests with the JSON null value. By default, fields with empty
  676. // values are omitted from API requests. However, any field with an
  677. // empty value appearing in NullFields will be sent to the server as
  678. // null. It is an error if a field in this list has a non-empty value.
  679. // This may be used to include null fields in Patch requests.
  680. NullFields []string `json:"-"`
  681. }
  682. func (s *ListFindingsResponse) MarshalJSON() ([]byte, error) {
  683. type NoMethod ListFindingsResponse
  684. raw := NoMethod(*s)
  685. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  686. }
  687. // ListScanConfigsResponse: Response for the `ListScanConfigs` method.
  688. type ListScanConfigsResponse struct {
  689. // NextPageToken: Token to retrieve the next page of results, or empty
  690. // if there are no
  691. // more results in the list.
  692. NextPageToken string `json:"nextPageToken,omitempty"`
  693. // ScanConfigs: The list of ScanConfigs returned.
  694. ScanConfigs []*ScanConfig `json:"scanConfigs,omitempty"`
  695. // ServerResponse contains the HTTP response code and headers from the
  696. // server.
  697. googleapi.ServerResponse `json:"-"`
  698. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  699. // unconditionally include in API requests. By default, fields with
  700. // empty values are omitted from API requests. However, any non-pointer,
  701. // non-interface field appearing in ForceSendFields will be sent to the
  702. // server regardless of whether the field is empty or not. This may be
  703. // used to include empty fields in Patch requests.
  704. ForceSendFields []string `json:"-"`
  705. // NullFields is a list of field names (e.g. "NextPageToken") to include
  706. // in API requests with the JSON null value. By default, fields with
  707. // empty values are omitted from API requests. However, any field with
  708. // an empty value appearing in NullFields will be sent to the server as
  709. // null. It is an error if a field in this list has a non-empty value.
  710. // This may be used to include null fields in Patch requests.
  711. NullFields []string `json:"-"`
  712. }
  713. func (s *ListScanConfigsResponse) MarshalJSON() ([]byte, error) {
  714. type NoMethod ListScanConfigsResponse
  715. raw := NoMethod(*s)
  716. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  717. }
  718. // ListScanRunsResponse: Response for the `ListScanRuns` method.
  719. type ListScanRunsResponse struct {
  720. // NextPageToken: Token to retrieve the next page of results, or empty
  721. // if there are no
  722. // more results in the list.
  723. NextPageToken string `json:"nextPageToken,omitempty"`
  724. // ScanRuns: The list of ScanRuns returned.
  725. ScanRuns []*ScanRun `json:"scanRuns,omitempty"`
  726. // ServerResponse contains the HTTP response code and headers from the
  727. // server.
  728. googleapi.ServerResponse `json:"-"`
  729. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  730. // unconditionally include in API requests. By default, fields with
  731. // empty values are omitted from API requests. However, any non-pointer,
  732. // non-interface field appearing in ForceSendFields will be sent to the
  733. // server regardless of whether the field is empty or not. This may be
  734. // used to include empty fields in Patch requests.
  735. ForceSendFields []string `json:"-"`
  736. // NullFields is a list of field names (e.g. "NextPageToken") to include
  737. // in API requests with the JSON null value. By default, fields with
  738. // empty values are omitted from API requests. However, any field with
  739. // an empty value appearing in NullFields will be sent to the server as
  740. // null. It is an error if a field in this list has a non-empty value.
  741. // This may be used to include null fields in Patch requests.
  742. NullFields []string `json:"-"`
  743. }
  744. func (s *ListScanRunsResponse) MarshalJSON() ([]byte, error) {
  745. type NoMethod ListScanRunsResponse
  746. raw := NoMethod(*s)
  747. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  748. }
  749. // OutdatedLibrary: Information reported for an outdated library.
  750. type OutdatedLibrary struct {
  751. // LearnMoreUrls: URLs to learn more information about the
  752. // vulnerabilities in the library.
  753. LearnMoreUrls []string `json:"learnMoreUrls,omitempty"`
  754. // LibraryName: The name of the outdated library.
  755. LibraryName string `json:"libraryName,omitempty"`
  756. // Version: The version number.
  757. Version string `json:"version,omitempty"`
  758. // ForceSendFields is a list of field names (e.g. "LearnMoreUrls") to
  759. // unconditionally include in API requests. By default, fields with
  760. // empty values are omitted from API requests. However, any non-pointer,
  761. // non-interface field appearing in ForceSendFields will be sent to the
  762. // server regardless of whether the field is empty or not. This may be
  763. // used to include empty fields in Patch requests.
  764. ForceSendFields []string `json:"-"`
  765. // NullFields is a list of field names (e.g. "LearnMoreUrls") to include
  766. // in API requests with the JSON null value. By default, fields with
  767. // empty values are omitted from API requests. However, any field with
  768. // an empty value appearing in NullFields will be sent to the server as
  769. // null. It is an error if a field in this list has a non-empty value.
  770. // This may be used to include null fields in Patch requests.
  771. NullFields []string `json:"-"`
  772. }
  773. func (s *OutdatedLibrary) MarshalJSON() ([]byte, error) {
  774. type NoMethod OutdatedLibrary
  775. raw := NoMethod(*s)
  776. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  777. }
  778. // ScanConfig: A ScanConfig resource contains the configurations to
  779. // launch a scan.
  780. // next id: 12
  781. type ScanConfig struct {
  782. // Authentication: The authentication configuration. If specified,
  783. // service will use the
  784. // authentication configuration during scanning.
  785. Authentication *Authentication `json:"authentication,omitempty"`
  786. // BlacklistPatterns: The blacklist URL patterns as described
  787. // in
  788. // https://cloud.google.com/security-scanner/docs/excluded-urls
  789. BlacklistPatterns []string `json:"blacklistPatterns,omitempty"`
  790. // DisplayName: Required.
  791. // The user provided display name of the ScanConfig.
  792. DisplayName string `json:"displayName,omitempty"`
  793. // LatestRun: Latest ScanRun if available.
  794. LatestRun *ScanRun `json:"latestRun,omitempty"`
  795. // MaxQps: The maximum QPS during scanning. A valid value ranges from 5
  796. // to 20
  797. // inclusively. If the field is unspecified or its value is set 0,
  798. // server will
  799. // default to 15. Other values outside of [5, 20] range will be rejected
  800. // with
  801. // INVALID_ARGUMENT error.
  802. MaxQps int64 `json:"maxQps,omitempty"`
  803. // Name: The resource name of the ScanConfig. The name follows the
  804. // format of
  805. // 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs
  806. // are
  807. // generated by the system.
  808. Name string `json:"name,omitempty"`
  809. // Schedule: The schedule of the ScanConfig.
  810. Schedule *Schedule `json:"schedule,omitempty"`
  811. // StartingUrls: Required.
  812. // The starting URLs from which the scanner finds site pages.
  813. StartingUrls []string `json:"startingUrls,omitempty"`
  814. // TargetPlatforms: Set of Cloud Platforms targeted by the scan. If
  815. // empty, APP_ENGINE will be
  816. // used as a default.
  817. //
  818. // Possible values:
  819. // "TARGET_PLATFORM_UNSPECIFIED" - The target platform is unknown.
  820. // Requests with this enum value will be
  821. // rejected with INVALID_ARGUMENT error.
  822. // "APP_ENGINE" - Google App Engine service.
  823. // "COMPUTE" - Google Compute Engine service.
  824. TargetPlatforms []string `json:"targetPlatforms,omitempty"`
  825. // UserAgent: The user agent used during scanning.
  826. //
  827. // Possible values:
  828. // "USER_AGENT_UNSPECIFIED" - The user agent is unknown. Service will
  829. // default to CHROME_LINUX.
  830. // "CHROME_LINUX" - Chrome on Linux. This is the service default if
  831. // unspecified.
  832. // "CHROME_ANDROID" - Chrome on Android.
  833. // "SAFARI_IPHONE" - Safari on IPhone.
  834. UserAgent string `json:"userAgent,omitempty"`
  835. // ServerResponse contains the HTTP response code and headers from the
  836. // server.
  837. googleapi.ServerResponse `json:"-"`
  838. // ForceSendFields is a list of field names (e.g. "Authentication") to
  839. // unconditionally include in API requests. By default, fields with
  840. // empty values are omitted from API requests. However, any non-pointer,
  841. // non-interface field appearing in ForceSendFields will be sent to the
  842. // server regardless of whether the field is empty or not. This may be
  843. // used to include empty fields in Patch requests.
  844. ForceSendFields []string `json:"-"`
  845. // NullFields is a list of field names (e.g. "Authentication") to
  846. // include in API requests with the JSON null value. By default, fields
  847. // with empty values are omitted from API requests. However, any field
  848. // with an empty value appearing in NullFields will be sent to the
  849. // server as null. It is an error if a field in this list has a
  850. // non-empty value. This may be used to include null fields in Patch
  851. // requests.
  852. NullFields []string `json:"-"`
  853. }
  854. func (s *ScanConfig) MarshalJSON() ([]byte, error) {
  855. type NoMethod ScanConfig
  856. raw := NoMethod(*s)
  857. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  858. }
  859. // ScanRun: A ScanRun is a output-only resource representing an actual
  860. // run of the scan.
  861. type ScanRun struct {
  862. // EndTime: Output only.
  863. // The time at which the ScanRun reached termination state - that the
  864. // ScanRun
  865. // is either finished or stopped by user.
  866. EndTime string `json:"endTime,omitempty"`
  867. // ExecutionState: Output only.
  868. // The execution state of the ScanRun.
  869. //
  870. // Possible values:
  871. // "EXECUTION_STATE_UNSPECIFIED" - Represents an invalid state caused
  872. // by internal server error. This value
  873. // should never be returned.
  874. // "QUEUED" - The scan is waiting in the queue.
  875. // "SCANNING" - The scan is in progress.
  876. // "FINISHED" - The scan is either finished or stopped by user.
  877. ExecutionState string `json:"executionState,omitempty"`
  878. // HasVulnerabilities: Output only.
  879. // Whether the scan run has found any vulnerabilities.
  880. HasVulnerabilities bool `json:"hasVulnerabilities,omitempty"`
  881. // Name: Output only.
  882. // The resource name of the ScanRun. The name follows the format
  883. // of
  884. // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunI
  885. // d}'.
  886. // The ScanRun IDs are generated by the system.
  887. Name string `json:"name,omitempty"`
  888. // ProgressPercent: Output only.
  889. // The percentage of total completion ranging from 0 to 100.
  890. // If the scan is in queue, the value is 0.
  891. // If the scan is running, the value ranges from 0 to 100.
  892. // If the scan is finished, the value is 100.
  893. ProgressPercent int64 `json:"progressPercent,omitempty"`
  894. // ResultState: Output only.
  895. // The result state of the ScanRun. This field is only available after
  896. // the
  897. // execution state reaches "FINISHED".
  898. //
  899. // Possible values:
  900. // "RESULT_STATE_UNSPECIFIED" - Default value. This value is returned
  901. // when the ScanRun is not yet
  902. // finished.
  903. // "SUCCESS" - The scan finished without errors.
  904. // "ERROR" - The scan finished with errors.
  905. // "KILLED" - The scan was terminated by user.
  906. ResultState string `json:"resultState,omitempty"`
  907. // StartTime: Output only.
  908. // The time at which the ScanRun started.
  909. StartTime string `json:"startTime,omitempty"`
  910. // UrlsCrawledCount: Output only.
  911. // The number of URLs crawled during this ScanRun. If the scan is in
  912. // progress,
  913. // the value represents the number of URLs crawled up to now.
  914. UrlsCrawledCount int64 `json:"urlsCrawledCount,omitempty,string"`
  915. // UrlsTestedCount: Output only.
  916. // The number of URLs tested during this ScanRun. If the scan is in
  917. // progress,
  918. // the value represents the number of URLs tested up to now. The number
  919. // of
  920. // URLs tested is usually larger than the number URLS crawled
  921. // because
  922. // typically a crawled URL is tested with multiple test payloads.
  923. UrlsTestedCount int64 `json:"urlsTestedCount,omitempty,string"`
  924. // ServerResponse contains the HTTP response code and headers from the
  925. // server.
  926. googleapi.ServerResponse `json:"-"`
  927. // ForceSendFields is a list of field names (e.g. "EndTime") to
  928. // unconditionally include in API requests. By default, fields with
  929. // empty values are omitted from API requests. However, any non-pointer,
  930. // non-interface field appearing in ForceSendFields will be sent to the
  931. // server regardless of whether the field is empty or not. This may be
  932. // used to include empty fields in Patch requests.
  933. ForceSendFields []string `json:"-"`
  934. // NullFields is a list of field names (e.g. "EndTime") to include in
  935. // API requests with the JSON null value. By default, fields with empty
  936. // values are omitted from API requests. However, any field with an
  937. // empty value appearing in NullFields will be sent to the server as
  938. // null. It is an error if a field in this list has a non-empty value.
  939. // This may be used to include null fields in Patch requests.
  940. NullFields []string `json:"-"`
  941. }
  942. func (s *ScanRun) MarshalJSON() ([]byte, error) {
  943. type NoMethod ScanRun
  944. raw := NoMethod(*s)
  945. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  946. }
  947. // Schedule: Scan schedule configuration.
  948. type Schedule struct {
  949. // IntervalDurationDays: Required.
  950. // The duration of time between executions in days.
  951. IntervalDurationDays int64 `json:"intervalDurationDays,omitempty"`
  952. // ScheduleTime: A timestamp indicates when the next run will be
  953. // scheduled. The value is
  954. // refreshed by the server after each run. If unspecified, it will
  955. // default
  956. // to current server time, which means the scan will be scheduled to
  957. // start
  958. // immediately.
  959. ScheduleTime string `json:"scheduleTime,omitempty"`
  960. // ForceSendFields is a list of field names (e.g.
  961. // "IntervalDurationDays") to unconditionally include in API requests.
  962. // By default, fields with empty values are omitted from API requests.
  963. // However, any non-pointer, non-interface field appearing in
  964. // ForceSendFields will be sent to the server regardless of whether the
  965. // field is empty or not. This may be used to include empty fields in
  966. // Patch requests.
  967. ForceSendFields []string `json:"-"`
  968. // NullFields is a list of field names (e.g. "IntervalDurationDays") to
  969. // include in API requests with the JSON null value. By default, fields
  970. // with empty values are omitted from API requests. However, any field
  971. // with an empty value appearing in NullFields will be sent to the
  972. // server as null. It is an error if a field in this list has a
  973. // non-empty value. This may be used to include null fields in Patch
  974. // requests.
  975. NullFields []string `json:"-"`
  976. }
  977. func (s *Schedule) MarshalJSON() ([]byte, error) {
  978. type NoMethod Schedule
  979. raw := NoMethod(*s)
  980. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  981. }
  982. // StartScanRunRequest: Request for the `StartScanRun` method.
  983. type StartScanRunRequest struct {
  984. }
  985. // StopScanRunRequest: Request for the `StopScanRun` method.
  986. type StopScanRunRequest struct {
  987. }
  988. // ViolatingResource: Information regarding any resource causing the
  989. // vulnerability such
  990. // as JavaScript sources, image, audio files, etc.
  991. type ViolatingResource struct {
  992. // ContentType: The MIME type of this resource.
  993. ContentType string `json:"contentType,omitempty"`
  994. // ResourceUrl: URL of this violating resource.
  995. ResourceUrl string `json:"resourceUrl,omitempty"`
  996. // ForceSendFields is a list of field names (e.g. "ContentType") to
  997. // unconditionally include in API requests. By default, fields with
  998. // empty values are omitted from API requests. However, any non-pointer,
  999. // non-interface field appearing in ForceSendFields will be sent to the
  1000. // server regardless of whether the field is empty or not. This may be
  1001. // used to include empty fields in Patch requests.
  1002. ForceSendFields []string `json:"-"`
  1003. // NullFields is a list of field names (e.g. "ContentType") to include
  1004. // in API requests with the JSON null value. By default, fields with
  1005. // empty values are omitted from API requests. However, any field with
  1006. // an empty value appearing in NullFields will be sent to the server as
  1007. // null. It is an error if a field in this list has a non-empty value.
  1008. // This may be used to include null fields in Patch requests.
  1009. NullFields []string `json:"-"`
  1010. }
  1011. func (s *ViolatingResource) MarshalJSON() ([]byte, error) {
  1012. type NoMethod ViolatingResource
  1013. raw := NoMethod(*s)
  1014. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1015. }
  1016. // VulnerableHeaders: Information about vulnerable or missing HTTP
  1017. // Headers.
  1018. type VulnerableHeaders struct {
  1019. // Headers: List of vulnerable headers.
  1020. Headers []*Header `json:"headers,omitempty"`
  1021. // MissingHeaders: List of missing headers.
  1022. MissingHeaders []*Header `json:"missingHeaders,omitempty"`
  1023. // ForceSendFields is a list of field names (e.g. "Headers") to
  1024. // unconditionally include in API requests. By default, fields with
  1025. // empty values are omitted from API requests. However, any non-pointer,
  1026. // non-interface field appearing in ForceSendFields will be sent to the
  1027. // server regardless of whether the field is empty or not. This may be
  1028. // used to include empty fields in Patch requests.
  1029. ForceSendFields []string `json:"-"`
  1030. // NullFields is a list of field names (e.g. "Headers") to include in
  1031. // API requests with the JSON null value. By default, fields with empty
  1032. // values are omitted from API requests. However, any field with an
  1033. // empty value appearing in NullFields will be sent to the server as
  1034. // null. It is an error if a field in this list has a non-empty value.
  1035. // This may be used to include null fields in Patch requests.
  1036. NullFields []string `json:"-"`
  1037. }
  1038. func (s *VulnerableHeaders) MarshalJSON() ([]byte, error) {
  1039. type NoMethod VulnerableHeaders
  1040. raw := NoMethod(*s)
  1041. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1042. }
  1043. // VulnerableParameters: Information about vulnerable request
  1044. // parameters.
  1045. type VulnerableParameters struct {
  1046. // ParameterNames: The vulnerable parameter names.
  1047. ParameterNames []string `json:"parameterNames,omitempty"`
  1048. // ForceSendFields is a list of field names (e.g. "ParameterNames") to
  1049. // unconditionally include in API requests. By default, fields with
  1050. // empty values are omitted from API requests. However, any non-pointer,
  1051. // non-interface field appearing in ForceSendFields will be sent to the
  1052. // server regardless of whether the field is empty or not. This may be
  1053. // used to include empty fields in Patch requests.
  1054. ForceSendFields []string `json:"-"`
  1055. // NullFields is a list of field names (e.g. "ParameterNames") to
  1056. // include in API requests with the JSON null value. By default, fields
  1057. // with empty values are omitted from API requests. However, any field
  1058. // with an empty value appearing in NullFields will be sent to the
  1059. // server as null. It is an error if a field in this list has a
  1060. // non-empty value. This may be used to include null fields in Patch
  1061. // requests.
  1062. NullFields []string `json:"-"`
  1063. }
  1064. func (s *VulnerableParameters) MarshalJSON() ([]byte, error) {
  1065. type NoMethod VulnerableParameters
  1066. raw := NoMethod(*s)
  1067. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1068. }
  1069. // Xss: Information reported for an XSS.
  1070. type Xss struct {
  1071. // ErrorMessage: An error message generated by a javascript breakage.
  1072. ErrorMessage string `json:"errorMessage,omitempty"`
  1073. // StackTraces: Stack traces leading to the point where the XSS
  1074. // occurred.
  1075. StackTraces []string `json:"stackTraces,omitempty"`
  1076. // ForceSendFields is a list of field names (e.g. "ErrorMessage") to
  1077. // unconditionally include in API requests. By default, fields with
  1078. // empty values are omitted from API requests. However, any non-pointer,
  1079. // non-interface field appearing in ForceSendFields will be sent to the
  1080. // server regardless of whether the field is empty or not. This may be
  1081. // used to include empty fields in Patch requests.
  1082. ForceSendFields []string `json:"-"`
  1083. // NullFields is a list of field names (e.g. "ErrorMessage") to include
  1084. // in API requests with the JSON null value. By default, fields with
  1085. // empty values are omitted from API requests. However, any field with
  1086. // an empty value appearing in NullFields will be sent to the server as
  1087. // null. It is an error if a field in this list has a non-empty value.
  1088. // This may be used to include null fields in Patch requests.
  1089. NullFields []string `json:"-"`
  1090. }
  1091. func (s *Xss) MarshalJSON() ([]byte, error) {
  1092. type NoMethod Xss
  1093. raw := NoMethod(*s)
  1094. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1095. }
  1096. // method id "websecurityscanner.projects.scanConfigs.create":
  1097. type ProjectsScanConfigsCreateCall struct {
  1098. s *Service
  1099. parent string
  1100. scanconfig *ScanConfig
  1101. urlParams_ gensupport.URLParams
  1102. ctx_ context.Context
  1103. header_ http.Header
  1104. }
  1105. // Create: Creates a new ScanConfig.
  1106. func (r *ProjectsScanConfigsService) Create(parent string, scanconfig *ScanConfig) *ProjectsScanConfigsCreateCall {
  1107. c := &ProjectsScanConfigsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1108. c.parent = parent
  1109. c.scanconfig = scanconfig
  1110. return c
  1111. }
  1112. // Fields allows partial responses to be retrieved. See
  1113. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1114. // for more information.
  1115. func (c *ProjectsScanConfigsCreateCall) Fields(s ...googleapi.Field) *ProjectsScanConfigsCreateCall {
  1116. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1117. return c
  1118. }
  1119. // Context sets the context to be used in this call's Do method. Any
  1120. // pending HTTP request will be aborted if the provided context is
  1121. // canceled.
  1122. func (c *ProjectsScanConfigsCreateCall) Context(ctx context.Context) *ProjectsScanConfigsCreateCall {
  1123. c.ctx_ = ctx
  1124. return c
  1125. }
  1126. // Header returns an http.Header that can be modified by the caller to
  1127. // add HTTP headers to the request.
  1128. func (c *ProjectsScanConfigsCreateCall) Header() http.Header {
  1129. if c.header_ == nil {
  1130. c.header_ = make(http.Header)
  1131. }
  1132. return c.header_
  1133. }
  1134. func (c *ProjectsScanConfigsCreateCall) doRequest(alt string) (*http.Response, error) {
  1135. reqHeaders := make(http.Header)
  1136. for k, v := range c.header_ {
  1137. reqHeaders[k] = v
  1138. }
  1139. reqHeaders.Set("User-Agent", c.s.userAgent())
  1140. var body io.Reader = nil
  1141. body, err := googleapi.WithoutDataWrapper.JSONReader(c.scanconfig)
  1142. if err != nil {
  1143. return nil, err
  1144. }
  1145. reqHeaders.Set("Content-Type", "application/json")
  1146. c.urlParams_.Set("alt", alt)
  1147. c.urlParams_.Set("prettyPrint", "false")
  1148. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+parent}/scanConfigs")
  1149. urls += "?" + c.urlParams_.Encode()
  1150. req, err := http.NewRequest("POST", urls, body)
  1151. if err != nil {
  1152. return nil, err
  1153. }
  1154. req.Header = reqHeaders
  1155. googleapi.Expand(req.URL, map[string]string{
  1156. "parent": c.parent,
  1157. })
  1158. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1159. }
  1160. // Do executes the "websecurityscanner.projects.scanConfigs.create" call.
  1161. // Exactly one of *ScanConfig or error will be non-nil. Any non-2xx
  1162. // status code is an error. Response headers are in either
  1163. // *ScanConfig.ServerResponse.Header or (if a response was returned at
  1164. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1165. // to check whether the returned error was because
  1166. // http.StatusNotModified was returned.
  1167. func (c *ProjectsScanConfigsCreateCall) Do(opts ...googleapi.CallOption) (*ScanConfig, error) {
  1168. gensupport.SetOptions(c.urlParams_, opts...)
  1169. res, err := c.doRequest("json")
  1170. if res != nil && res.StatusCode == http.StatusNotModified {
  1171. if res.Body != nil {
  1172. res.Body.Close()
  1173. }
  1174. return nil, &googleapi.Error{
  1175. Code: res.StatusCode,
  1176. Header: res.Header,
  1177. }
  1178. }
  1179. if err != nil {
  1180. return nil, err
  1181. }
  1182. defer googleapi.CloseBody(res)
  1183. if err := googleapi.CheckResponse(res); err != nil {
  1184. return nil, err
  1185. }
  1186. ret := &ScanConfig{
  1187. ServerResponse: googleapi.ServerResponse{
  1188. Header: res.Header,
  1189. HTTPStatusCode: res.StatusCode,
  1190. },
  1191. }
  1192. target := &ret
  1193. if err := gensupport.DecodeResponse(target, res); err != nil {
  1194. return nil, err
  1195. }
  1196. return ret, nil
  1197. // {
  1198. // "description": "Creates a new ScanConfig.",
  1199. // "flatPath": "v1alpha/projects/{projectsId}/scanConfigs",
  1200. // "httpMethod": "POST",
  1201. // "id": "websecurityscanner.projects.scanConfigs.create",
  1202. // "parameterOrder": [
  1203. // "parent"
  1204. // ],
  1205. // "parameters": {
  1206. // "parent": {
  1207. // "description": "Required.\nThe parent resource name where the scan is created, which should be a\nproject resource name in the format 'projects/{projectId}'.",
  1208. // "location": "path",
  1209. // "pattern": "^projects/[^/]+$",
  1210. // "required": true,
  1211. // "type": "string"
  1212. // }
  1213. // },
  1214. // "path": "v1alpha/{+parent}/scanConfigs",
  1215. // "request": {
  1216. // "$ref": "ScanConfig"
  1217. // },
  1218. // "response": {
  1219. // "$ref": "ScanConfig"
  1220. // },
  1221. // "scopes": [
  1222. // "https://www.googleapis.com/auth/cloud-platform"
  1223. // ]
  1224. // }
  1225. }
  1226. // method id "websecurityscanner.projects.scanConfigs.delete":
  1227. type ProjectsScanConfigsDeleteCall struct {
  1228. s *Service
  1229. name string
  1230. urlParams_ gensupport.URLParams
  1231. ctx_ context.Context
  1232. header_ http.Header
  1233. }
  1234. // Delete: Deletes an existing ScanConfig and its child resources.
  1235. func (r *ProjectsScanConfigsService) Delete(name string) *ProjectsScanConfigsDeleteCall {
  1236. c := &ProjectsScanConfigsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1237. c.name = name
  1238. return c
  1239. }
  1240. // Fields allows partial responses to be retrieved. See
  1241. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1242. // for more information.
  1243. func (c *ProjectsScanConfigsDeleteCall) Fields(s ...googleapi.Field) *ProjectsScanConfigsDeleteCall {
  1244. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1245. return c
  1246. }
  1247. // Context sets the context to be used in this call's Do method. Any
  1248. // pending HTTP request will be aborted if the provided context is
  1249. // canceled.
  1250. func (c *ProjectsScanConfigsDeleteCall) Context(ctx context.Context) *ProjectsScanConfigsDeleteCall {
  1251. c.ctx_ = ctx
  1252. return c
  1253. }
  1254. // Header returns an http.Header that can be modified by the caller to
  1255. // add HTTP headers to the request.
  1256. func (c *ProjectsScanConfigsDeleteCall) Header() http.Header {
  1257. if c.header_ == nil {
  1258. c.header_ = make(http.Header)
  1259. }
  1260. return c.header_
  1261. }
  1262. func (c *ProjectsScanConfigsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1263. reqHeaders := make(http.Header)
  1264. for k, v := range c.header_ {
  1265. reqHeaders[k] = v
  1266. }
  1267. reqHeaders.Set("User-Agent", c.s.userAgent())
  1268. var body io.Reader = nil
  1269. c.urlParams_.Set("alt", alt)
  1270. c.urlParams_.Set("prettyPrint", "false")
  1271. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}")
  1272. urls += "?" + c.urlParams_.Encode()
  1273. req, err := http.NewRequest("DELETE", urls, body)
  1274. if err != nil {
  1275. return nil, err
  1276. }
  1277. req.Header = reqHeaders
  1278. googleapi.Expand(req.URL, map[string]string{
  1279. "name": c.name,
  1280. })
  1281. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1282. }
  1283. // Do executes the "websecurityscanner.projects.scanConfigs.delete" call.
  1284. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1285. // code is an error. Response headers are in either
  1286. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1287. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1288. // check whether the returned error was because http.StatusNotModified
  1289. // was returned.
  1290. func (c *ProjectsScanConfigsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1291. gensupport.SetOptions(c.urlParams_, opts...)
  1292. res, err := c.doRequest("json")
  1293. if res != nil && res.StatusCode == http.StatusNotModified {
  1294. if res.Body != nil {
  1295. res.Body.Close()
  1296. }
  1297. return nil, &googleapi.Error{
  1298. Code: res.StatusCode,
  1299. Header: res.Header,
  1300. }
  1301. }
  1302. if err != nil {
  1303. return nil, err
  1304. }
  1305. defer googleapi.CloseBody(res)
  1306. if err := googleapi.CheckResponse(res); err != nil {
  1307. return nil, err
  1308. }
  1309. ret := &Empty{
  1310. ServerResponse: googleapi.ServerResponse{
  1311. Header: res.Header,
  1312. HTTPStatusCode: res.StatusCode,
  1313. },
  1314. }
  1315. target := &ret
  1316. if err := gensupport.DecodeResponse(target, res); err != nil {
  1317. return nil, err
  1318. }
  1319. return ret, nil
  1320. // {
  1321. // "description": "Deletes an existing ScanConfig and its child resources.",
  1322. // "flatPath": "v1alpha/projects/{projectsId}/scanConfigs/{scanConfigsId}",
  1323. // "httpMethod": "DELETE",
  1324. // "id": "websecurityscanner.projects.scanConfigs.delete",
  1325. // "parameterOrder": [
  1326. // "name"
  1327. // ],
  1328. // "parameters": {
  1329. // "name": {
  1330. // "description": "Required.\nThe resource name of the ScanConfig to be deleted. The name follows the\nformat of 'projects/{projectId}/scanConfigs/{scanConfigId}'.",
  1331. // "location": "path",
  1332. // "pattern": "^projects/[^/]+/scanConfigs/[^/]+$",
  1333. // "required": true,
  1334. // "type": "string"
  1335. // }
  1336. // },
  1337. // "path": "v1alpha/{+name}",
  1338. // "response": {
  1339. // "$ref": "Empty"
  1340. // },
  1341. // "scopes": [
  1342. // "https://www.googleapis.com/auth/cloud-platform"
  1343. // ]
  1344. // }
  1345. }
  1346. // method id "websecurityscanner.projects.scanConfigs.get":
  1347. type ProjectsScanConfigsGetCall struct {
  1348. s *Service
  1349. name string
  1350. urlParams_ gensupport.URLParams
  1351. ifNoneMatch_ string
  1352. ctx_ context.Context
  1353. header_ http.Header
  1354. }
  1355. // Get: Gets a ScanConfig.
  1356. func (r *ProjectsScanConfigsService) Get(name string) *ProjectsScanConfigsGetCall {
  1357. c := &ProjectsScanConfigsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1358. c.name = name
  1359. return c
  1360. }
  1361. // Fields allows partial responses to be retrieved. See
  1362. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1363. // for more information.
  1364. func (c *ProjectsScanConfigsGetCall) Fields(s ...googleapi.Field) *ProjectsScanConfigsGetCall {
  1365. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1366. return c
  1367. }
  1368. // IfNoneMatch sets the optional parameter which makes the operation
  1369. // fail if the object's ETag matches the given value. This is useful for
  1370. // getting updates only after the object has changed since the last
  1371. // request. Use googleapi.IsNotModified to check whether the response
  1372. // error from Do is the result of In-None-Match.
  1373. func (c *ProjectsScanConfigsGetCall) IfNoneMatch(entityTag string) *ProjectsScanConfigsGetCall {
  1374. c.ifNoneMatch_ = entityTag
  1375. return c
  1376. }
  1377. // Context sets the context to be used in this call's Do method. Any
  1378. // pending HTTP request will be aborted if the provided context is
  1379. // canceled.
  1380. func (c *ProjectsScanConfigsGetCall) Context(ctx context.Context) *ProjectsScanConfigsGetCall {
  1381. c.ctx_ = ctx
  1382. return c
  1383. }
  1384. // Header returns an http.Header that can be modified by the caller to
  1385. // add HTTP headers to the request.
  1386. func (c *ProjectsScanConfigsGetCall) Header() http.Header {
  1387. if c.header_ == nil {
  1388. c.header_ = make(http.Header)
  1389. }
  1390. return c.header_
  1391. }
  1392. func (c *ProjectsScanConfigsGetCall) doRequest(alt string) (*http.Response, error) {
  1393. reqHeaders := make(http.Header)
  1394. for k, v := range c.header_ {
  1395. reqHeaders[k] = v
  1396. }
  1397. reqHeaders.Set("User-Agent", c.s.userAgent())
  1398. if c.ifNoneMatch_ != "" {
  1399. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1400. }
  1401. var body io.Reader = nil
  1402. c.urlParams_.Set("alt", alt)
  1403. c.urlParams_.Set("prettyPrint", "false")
  1404. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}")
  1405. urls += "?" + c.urlParams_.Encode()
  1406. req, err := http.NewRequest("GET", urls, body)
  1407. if err != nil {
  1408. return nil, err
  1409. }
  1410. req.Header = reqHeaders
  1411. googleapi.Expand(req.URL, map[string]string{
  1412. "name": c.name,
  1413. })
  1414. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1415. }
  1416. // Do executes the "websecurityscanner.projects.scanConfigs.get" call.
  1417. // Exactly one of *ScanConfig or error will be non-nil. Any non-2xx
  1418. // status code is an error. Response headers are in either
  1419. // *ScanConfig.ServerResponse.Header or (if a response was returned at
  1420. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1421. // to check whether the returned error was because
  1422. // http.StatusNotModified was returned.
  1423. func (c *ProjectsScanConfigsGetCall) Do(opts ...googleapi.CallOption) (*ScanConfig, error) {
  1424. gensupport.SetOptions(c.urlParams_, opts...)
  1425. res, err := c.doRequest("json")
  1426. if res != nil && res.StatusCode == http.StatusNotModified {
  1427. if res.Body != nil {
  1428. res.Body.Close()
  1429. }
  1430. return nil, &googleapi.Error{
  1431. Code: res.StatusCode,
  1432. Header: res.Header,
  1433. }
  1434. }
  1435. if err != nil {
  1436. return nil, err
  1437. }
  1438. defer googleapi.CloseBody(res)
  1439. if err := googleapi.CheckResponse(res); err != nil {
  1440. return nil, err
  1441. }
  1442. ret := &ScanConfig{
  1443. ServerResponse: googleapi.ServerResponse{
  1444. Header: res.Header,
  1445. HTTPStatusCode: res.StatusCode,
  1446. },
  1447. }
  1448. target := &ret
  1449. if err := gensupport.DecodeResponse(target, res); err != nil {
  1450. return nil, err
  1451. }
  1452. return ret, nil
  1453. // {
  1454. // "description": "Gets a ScanConfig.",
  1455. // "flatPath": "v1alpha/projects/{projectsId}/scanConfigs/{scanConfigsId}",
  1456. // "httpMethod": "GET",
  1457. // "id": "websecurityscanner.projects.scanConfigs.get",
  1458. // "parameterOrder": [
  1459. // "name"
  1460. // ],
  1461. // "parameters": {
  1462. // "name": {
  1463. // "description": "Required.\nThe resource name of the ScanConfig to be returned. The name follows the\nformat of 'projects/{projectId}/scanConfigs/{scanConfigId}'.",
  1464. // "location": "path",
  1465. // "pattern": "^projects/[^/]+/scanConfigs/[^/]+$",
  1466. // "required": true,
  1467. // "type": "string"
  1468. // }
  1469. // },
  1470. // "path": "v1alpha/{+name}",
  1471. // "response": {
  1472. // "$ref": "ScanConfig"
  1473. // },
  1474. // "scopes": [
  1475. // "https://www.googleapis.com/auth/cloud-platform"
  1476. // ]
  1477. // }
  1478. }
  1479. // method id "websecurityscanner.projects.scanConfigs.list":
  1480. type ProjectsScanConfigsListCall struct {
  1481. s *Service
  1482. parent string
  1483. urlParams_ gensupport.URLParams
  1484. ifNoneMatch_ string
  1485. ctx_ context.Context
  1486. header_ http.Header
  1487. }
  1488. // List: Lists ScanConfigs under a given project.
  1489. func (r *ProjectsScanConfigsService) List(parent string) *ProjectsScanConfigsListCall {
  1490. c := &ProjectsScanConfigsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1491. c.parent = parent
  1492. return c
  1493. }
  1494. // PageSize sets the optional parameter "pageSize": The maximum number
  1495. // of ScanConfigs to return, can be limited by server.
  1496. // If not specified or not positive, the implementation will select
  1497. // a
  1498. // reasonable value.
  1499. func (c *ProjectsScanConfigsListCall) PageSize(pageSize int64) *ProjectsScanConfigsListCall {
  1500. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1501. return c
  1502. }
  1503. // PageToken sets the optional parameter "pageToken": A token
  1504. // identifying a page of results to be returned. This should be
  1505. // a
  1506. // `next_page_token` value returned from a previous List request.
  1507. // If unspecified, the first page of results is returned.
  1508. func (c *ProjectsScanConfigsListCall) PageToken(pageToken string) *ProjectsScanConfigsListCall {
  1509. c.urlParams_.Set("pageToken", pageToken)
  1510. return c
  1511. }
  1512. // Fields allows partial responses to be retrieved. See
  1513. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1514. // for more information.
  1515. func (c *ProjectsScanConfigsListCall) Fields(s ...googleapi.Field) *ProjectsScanConfigsListCall {
  1516. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1517. return c
  1518. }
  1519. // IfNoneMatch sets the optional parameter which makes the operation
  1520. // fail if the object's ETag matches the given value. This is useful for
  1521. // getting updates only after the object has changed since the last
  1522. // request. Use googleapi.IsNotModified to check whether the response
  1523. // error from Do is the result of In-None-Match.
  1524. func (c *ProjectsScanConfigsListCall) IfNoneMatch(entityTag string) *ProjectsScanConfigsListCall {
  1525. c.ifNoneMatch_ = entityTag
  1526. return c
  1527. }
  1528. // Context sets the context to be used in this call's Do method. Any
  1529. // pending HTTP request will be aborted if the provided context is
  1530. // canceled.
  1531. func (c *ProjectsScanConfigsListCall) Context(ctx context.Context) *ProjectsScanConfigsListCall {
  1532. c.ctx_ = ctx
  1533. return c
  1534. }
  1535. // Header returns an http.Header that can be modified by the caller to
  1536. // add HTTP headers to the request.
  1537. func (c *ProjectsScanConfigsListCall) Header() http.Header {
  1538. if c.header_ == nil {
  1539. c.header_ = make(http.Header)
  1540. }
  1541. return c.header_
  1542. }
  1543. func (c *ProjectsScanConfigsListCall) doRequest(alt string) (*http.Response, error) {
  1544. reqHeaders := make(http.Header)
  1545. for k, v := range c.header_ {
  1546. reqHeaders[k] = v
  1547. }
  1548. reqHeaders.Set("User-Agent", c.s.userAgent())
  1549. if c.ifNoneMatch_ != "" {
  1550. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1551. }
  1552. var body io.Reader = nil
  1553. c.urlParams_.Set("alt", alt)
  1554. c.urlParams_.Set("prettyPrint", "false")
  1555. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+parent}/scanConfigs")
  1556. urls += "?" + c.urlParams_.Encode()
  1557. req, err := http.NewRequest("GET", urls, body)
  1558. if err != nil {
  1559. return nil, err
  1560. }
  1561. req.Header = reqHeaders
  1562. googleapi.Expand(req.URL, map[string]string{
  1563. "parent": c.parent,
  1564. })
  1565. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1566. }
  1567. // Do executes the "websecurityscanner.projects.scanConfigs.list" call.
  1568. // Exactly one of *ListScanConfigsResponse or error will be non-nil. Any
  1569. // non-2xx status code is an error. Response headers are in either
  1570. // *ListScanConfigsResponse.ServerResponse.Header or (if a response was
  1571. // returned at all) in error.(*googleapi.Error).Header. Use
  1572. // googleapi.IsNotModified to check whether the returned error was
  1573. // because http.StatusNotModified was returned.
  1574. func (c *ProjectsScanConfigsListCall) Do(opts ...googleapi.CallOption) (*ListScanConfigsResponse, error) {
  1575. gensupport.SetOptions(c.urlParams_, opts...)
  1576. res, err := c.doRequest("json")
  1577. if res != nil && res.StatusCode == http.StatusNotModified {
  1578. if res.Body != nil {
  1579. res.Body.Close()
  1580. }
  1581. return nil, &googleapi.Error{
  1582. Code: res.StatusCode,
  1583. Header: res.Header,
  1584. }
  1585. }
  1586. if err != nil {
  1587. return nil, err
  1588. }
  1589. defer googleapi.CloseBody(res)
  1590. if err := googleapi.CheckResponse(res); err != nil {
  1591. return nil, err
  1592. }
  1593. ret := &ListScanConfigsResponse{
  1594. ServerResponse: googleapi.ServerResponse{
  1595. Header: res.Header,
  1596. HTTPStatusCode: res.StatusCode,
  1597. },
  1598. }
  1599. target := &ret
  1600. if err := gensupport.DecodeResponse(target, res); err != nil {
  1601. return nil, err
  1602. }
  1603. return ret, nil
  1604. // {
  1605. // "description": "Lists ScanConfigs under a given project.",
  1606. // "flatPath": "v1alpha/projects/{projectsId}/scanConfigs",
  1607. // "httpMethod": "GET",
  1608. // "id": "websecurityscanner.projects.scanConfigs.list",
  1609. // "parameterOrder": [
  1610. // "parent"
  1611. // ],
  1612. // "parameters": {
  1613. // "pageSize": {
  1614. // "description": "The maximum number of ScanConfigs to return, can be limited by server.\nIf not specified or not positive, the implementation will select a\nreasonable value.",
  1615. // "format": "int32",
  1616. // "location": "query",
  1617. // "type": "integer"
  1618. // },
  1619. // "pageToken": {
  1620. // "description": "A token identifying a page of results to be returned. This should be a\n`next_page_token` value returned from a previous List request.\nIf unspecified, the first page of results is returned.",
  1621. // "location": "query",
  1622. // "type": "string"
  1623. // },
  1624. // "parent": {
  1625. // "description": "Required.\nThe parent resource name, which should be a project resource name in the\nformat 'projects/{projectId}'.",
  1626. // "location": "path",
  1627. // "pattern": "^projects/[^/]+$",
  1628. // "required": true,
  1629. // "type": "string"
  1630. // }
  1631. // },
  1632. // "path": "v1alpha/{+parent}/scanConfigs",
  1633. // "response": {
  1634. // "$ref": "ListScanConfigsResponse"
  1635. // },
  1636. // "scopes": [
  1637. // "https://www.googleapis.com/auth/cloud-platform"
  1638. // ]
  1639. // }
  1640. }
  1641. // Pages invokes f for each page of results.
  1642. // A non-nil error returned from f will halt the iteration.
  1643. // The provided context supersedes any context provided to the Context method.
  1644. func (c *ProjectsScanConfigsListCall) Pages(ctx context.Context, f func(*ListScanConfigsResponse) error) error {
  1645. c.ctx_ = ctx
  1646. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1647. for {
  1648. x, err := c.Do()
  1649. if err != nil {
  1650. return err
  1651. }
  1652. if err := f(x); err != nil {
  1653. return err
  1654. }
  1655. if x.NextPageToken == "" {
  1656. return nil
  1657. }
  1658. c.PageToken(x.NextPageToken)
  1659. }
  1660. }
  1661. // method id "websecurityscanner.projects.scanConfigs.patch":
  1662. type ProjectsScanConfigsPatchCall struct {
  1663. s *Service
  1664. name string
  1665. scanconfig *ScanConfig
  1666. urlParams_ gensupport.URLParams
  1667. ctx_ context.Context
  1668. header_ http.Header
  1669. }
  1670. // Patch: Updates a ScanConfig. This method support partial update of a
  1671. // ScanConfig.
  1672. func (r *ProjectsScanConfigsService) Patch(name string, scanconfig *ScanConfig) *ProjectsScanConfigsPatchCall {
  1673. c := &ProjectsScanConfigsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1674. c.name = name
  1675. c.scanconfig = scanconfig
  1676. return c
  1677. }
  1678. // UpdateMask sets the optional parameter "updateMask": Required.
  1679. // The update mask applies to the resource. For the `FieldMask`
  1680. // definition,
  1681. // see
  1682. // https://developers.google.com/protocol-buffers/docs/re
  1683. // ference/google.protobuf#fieldmask
  1684. func (c *ProjectsScanConfigsPatchCall) UpdateMask(updateMask string) *ProjectsScanConfigsPatchCall {
  1685. c.urlParams_.Set("updateMask", updateMask)
  1686. return c
  1687. }
  1688. // Fields allows partial responses to be retrieved. See
  1689. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1690. // for more information.
  1691. func (c *ProjectsScanConfigsPatchCall) Fields(s ...googleapi.Field) *ProjectsScanConfigsPatchCall {
  1692. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1693. return c
  1694. }
  1695. // Context sets the context to be used in this call's Do method. Any
  1696. // pending HTTP request will be aborted if the provided context is
  1697. // canceled.
  1698. func (c *ProjectsScanConfigsPatchCall) Context(ctx context.Context) *ProjectsScanConfigsPatchCall {
  1699. c.ctx_ = ctx
  1700. return c
  1701. }
  1702. // Header returns an http.Header that can be modified by the caller to
  1703. // add HTTP headers to the request.
  1704. func (c *ProjectsScanConfigsPatchCall) Header() http.Header {
  1705. if c.header_ == nil {
  1706. c.header_ = make(http.Header)
  1707. }
  1708. return c.header_
  1709. }
  1710. func (c *ProjectsScanConfigsPatchCall) doRequest(alt string) (*http.Response, error) {
  1711. reqHeaders := make(http.Header)
  1712. for k, v := range c.header_ {
  1713. reqHeaders[k] = v
  1714. }
  1715. reqHeaders.Set("User-Agent", c.s.userAgent())
  1716. var body io.Reader = nil
  1717. body, err := googleapi.WithoutDataWrapper.JSONReader(c.scanconfig)
  1718. if err != nil {
  1719. return nil, err
  1720. }
  1721. reqHeaders.Set("Content-Type", "application/json")
  1722. c.urlParams_.Set("alt", alt)
  1723. c.urlParams_.Set("prettyPrint", "false")
  1724. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}")
  1725. urls += "?" + c.urlParams_.Encode()
  1726. req, err := http.NewRequest("PATCH", urls, body)
  1727. if err != nil {
  1728. return nil, err
  1729. }
  1730. req.Header = reqHeaders
  1731. googleapi.Expand(req.URL, map[string]string{
  1732. "name": c.name,
  1733. })
  1734. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1735. }
  1736. // Do executes the "websecurityscanner.projects.scanConfigs.patch" call.
  1737. // Exactly one of *ScanConfig or error will be non-nil. Any non-2xx
  1738. // status code is an error. Response headers are in either
  1739. // *ScanConfig.ServerResponse.Header or (if a response was returned at
  1740. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1741. // to check whether the returned error was because
  1742. // http.StatusNotModified was returned.
  1743. func (c *ProjectsScanConfigsPatchCall) Do(opts ...googleapi.CallOption) (*ScanConfig, error) {
  1744. gensupport.SetOptions(c.urlParams_, opts...)
  1745. res, err := c.doRequest("json")
  1746. if res != nil && res.StatusCode == http.StatusNotModified {
  1747. if res.Body != nil {
  1748. res.Body.Close()
  1749. }
  1750. return nil, &googleapi.Error{
  1751. Code: res.StatusCode,
  1752. Header: res.Header,
  1753. }
  1754. }
  1755. if err != nil {
  1756. return nil, err
  1757. }
  1758. defer googleapi.CloseBody(res)
  1759. if err := googleapi.CheckResponse(res); err != nil {
  1760. return nil, err
  1761. }
  1762. ret := &ScanConfig{
  1763. ServerResponse: googleapi.ServerResponse{
  1764. Header: res.Header,
  1765. HTTPStatusCode: res.StatusCode,
  1766. },
  1767. }
  1768. target := &ret
  1769. if err := gensupport.DecodeResponse(target, res); err != nil {
  1770. return nil, err
  1771. }
  1772. return ret, nil
  1773. // {
  1774. // "description": "Updates a ScanConfig. This method support partial update of a ScanConfig.",
  1775. // "flatPath": "v1alpha/projects/{projectsId}/scanConfigs/{scanConfigsId}",
  1776. // "httpMethod": "PATCH",
  1777. // "id": "websecurityscanner.projects.scanConfigs.patch",
  1778. // "parameterOrder": [
  1779. // "name"
  1780. // ],
  1781. // "parameters": {
  1782. // "name": {
  1783. // "description": "The resource name of the ScanConfig. The name follows the format of\n'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are\ngenerated by the system.",
  1784. // "location": "path",
  1785. // "pattern": "^projects/[^/]+/scanConfigs/[^/]+$",
  1786. // "required": true,
  1787. // "type": "string"
  1788. // },
  1789. // "updateMask": {
  1790. // "description": "Required.\nThe update mask applies to the resource. For the `FieldMask` definition,\nsee\nhttps://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask",
  1791. // "format": "google-fieldmask",
  1792. // "location": "query",
  1793. // "type": "string"
  1794. // }
  1795. // },
  1796. // "path": "v1alpha/{+name}",
  1797. // "request": {
  1798. // "$ref": "ScanConfig"
  1799. // },
  1800. // "response": {
  1801. // "$ref": "ScanConfig"
  1802. // },
  1803. // "scopes": [
  1804. // "https://www.googleapis.com/auth/cloud-platform"
  1805. // ]
  1806. // }
  1807. }
  1808. // method id "websecurityscanner.projects.scanConfigs.start":
  1809. type ProjectsScanConfigsStartCall struct {
  1810. s *Service
  1811. name string
  1812. startscanrunrequest *StartScanRunRequest
  1813. urlParams_ gensupport.URLParams
  1814. ctx_ context.Context
  1815. header_ http.Header
  1816. }
  1817. // Start: Start a ScanRun according to the given ScanConfig.
  1818. func (r *ProjectsScanConfigsService) Start(name string, startscanrunrequest *StartScanRunRequest) *ProjectsScanConfigsStartCall {
  1819. c := &ProjectsScanConfigsStartCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1820. c.name = name
  1821. c.startscanrunrequest = startscanrunrequest
  1822. return c
  1823. }
  1824. // Fields allows partial responses to be retrieved. See
  1825. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1826. // for more information.
  1827. func (c *ProjectsScanConfigsStartCall) Fields(s ...googleapi.Field) *ProjectsScanConfigsStartCall {
  1828. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1829. return c
  1830. }
  1831. // Context sets the context to be used in this call's Do method. Any
  1832. // pending HTTP request will be aborted if the provided context is
  1833. // canceled.
  1834. func (c *ProjectsScanConfigsStartCall) Context(ctx context.Context) *ProjectsScanConfigsStartCall {
  1835. c.ctx_ = ctx
  1836. return c
  1837. }
  1838. // Header returns an http.Header that can be modified by the caller to
  1839. // add HTTP headers to the request.
  1840. func (c *ProjectsScanConfigsStartCall) Header() http.Header {
  1841. if c.header_ == nil {
  1842. c.header_ = make(http.Header)
  1843. }
  1844. return c.header_
  1845. }
  1846. func (c *ProjectsScanConfigsStartCall) doRequest(alt string) (*http.Response, error) {
  1847. reqHeaders := make(http.Header)
  1848. for k, v := range c.header_ {
  1849. reqHeaders[k] = v
  1850. }
  1851. reqHeaders.Set("User-Agent", c.s.userAgent())
  1852. var body io.Reader = nil
  1853. body, err := googleapi.WithoutDataWrapper.JSONReader(c.startscanrunrequest)
  1854. if err != nil {
  1855. return nil, err
  1856. }
  1857. reqHeaders.Set("Content-Type", "application/json")
  1858. c.urlParams_.Set("alt", alt)
  1859. c.urlParams_.Set("prettyPrint", "false")
  1860. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}:start")
  1861. urls += "?" + c.urlParams_.Encode()
  1862. req, err := http.NewRequest("POST", urls, body)
  1863. if err != nil {
  1864. return nil, err
  1865. }
  1866. req.Header = reqHeaders
  1867. googleapi.Expand(req.URL, map[string]string{
  1868. "name": c.name,
  1869. })
  1870. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1871. }
  1872. // Do executes the "websecurityscanner.projects.scanConfigs.start" call.
  1873. // Exactly one of *ScanRun or error will be non-nil. Any non-2xx status
  1874. // code is an error. Response headers are in either
  1875. // *ScanRun.ServerResponse.Header or (if a response was returned at all)
  1876. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1877. // check whether the returned error was because http.StatusNotModified
  1878. // was returned.
  1879. func (c *ProjectsScanConfigsStartCall) Do(opts ...googleapi.CallOption) (*ScanRun, error) {
  1880. gensupport.SetOptions(c.urlParams_, opts...)
  1881. res, err := c.doRequest("json")
  1882. if res != nil && res.StatusCode == http.StatusNotModified {
  1883. if res.Body != nil {
  1884. res.Body.Close()
  1885. }
  1886. return nil, &googleapi.Error{
  1887. Code: res.StatusCode,
  1888. Header: res.Header,
  1889. }
  1890. }
  1891. if err != nil {
  1892. return nil, err
  1893. }
  1894. defer googleapi.CloseBody(res)
  1895. if err := googleapi.CheckResponse(res); err != nil {
  1896. return nil, err
  1897. }
  1898. ret := &ScanRun{
  1899. ServerResponse: googleapi.ServerResponse{
  1900. Header: res.Header,
  1901. HTTPStatusCode: res.StatusCode,
  1902. },
  1903. }
  1904. target := &ret
  1905. if err := gensupport.DecodeResponse(target, res); err != nil {
  1906. return nil, err
  1907. }
  1908. return ret, nil
  1909. // {
  1910. // "description": "Start a ScanRun according to the given ScanConfig.",
  1911. // "flatPath": "v1alpha/projects/{projectsId}/scanConfigs/{scanConfigsId}:start",
  1912. // "httpMethod": "POST",
  1913. // "id": "websecurityscanner.projects.scanConfigs.start",
  1914. // "parameterOrder": [
  1915. // "name"
  1916. // ],
  1917. // "parameters": {
  1918. // "name": {
  1919. // "description": "Required.\nThe resource name of the ScanConfig to be used. The name follows the\nformat of 'projects/{projectId}/scanConfigs/{scanConfigId}'.",
  1920. // "location": "path",
  1921. // "pattern": "^projects/[^/]+/scanConfigs/[^/]+$",
  1922. // "required": true,
  1923. // "type": "string"
  1924. // }
  1925. // },
  1926. // "path": "v1alpha/{+name}:start",
  1927. // "request": {
  1928. // "$ref": "StartScanRunRequest"
  1929. // },
  1930. // "response": {
  1931. // "$ref": "ScanRun"
  1932. // },
  1933. // "scopes": [
  1934. // "https://www.googleapis.com/auth/cloud-platform"
  1935. // ]
  1936. // }
  1937. }
  1938. // method id "websecurityscanner.projects.scanConfigs.scanRuns.get":
  1939. type ProjectsScanConfigsScanRunsGetCall struct {
  1940. s *Service
  1941. name string
  1942. urlParams_ gensupport.URLParams
  1943. ifNoneMatch_ string
  1944. ctx_ context.Context
  1945. header_ http.Header
  1946. }
  1947. // Get: Gets a ScanRun.
  1948. func (r *ProjectsScanConfigsScanRunsService) Get(name string) *ProjectsScanConfigsScanRunsGetCall {
  1949. c := &ProjectsScanConfigsScanRunsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1950. c.name = name
  1951. return c
  1952. }
  1953. // Fields allows partial responses to be retrieved. See
  1954. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1955. // for more information.
  1956. func (c *ProjectsScanConfigsScanRunsGetCall) Fields(s ...googleapi.Field) *ProjectsScanConfigsScanRunsGetCall {
  1957. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1958. return c
  1959. }
  1960. // IfNoneMatch sets the optional parameter which makes the operation
  1961. // fail if the object's ETag matches the given value. This is useful for
  1962. // getting updates only after the object has changed since the last
  1963. // request. Use googleapi.IsNotModified to check whether the response
  1964. // error from Do is the result of In-None-Match.
  1965. func (c *ProjectsScanConfigsScanRunsGetCall) IfNoneMatch(entityTag string) *ProjectsScanConfigsScanRunsGetCall {
  1966. c.ifNoneMatch_ = entityTag
  1967. return c
  1968. }
  1969. // Context sets the context to be used in this call's Do method. Any
  1970. // pending HTTP request will be aborted if the provided context is
  1971. // canceled.
  1972. func (c *ProjectsScanConfigsScanRunsGetCall) Context(ctx context.Context) *ProjectsScanConfigsScanRunsGetCall {
  1973. c.ctx_ = ctx
  1974. return c
  1975. }
  1976. // Header returns an http.Header that can be modified by the caller to
  1977. // add HTTP headers to the request.
  1978. func (c *ProjectsScanConfigsScanRunsGetCall) Header() http.Header {
  1979. if c.header_ == nil {
  1980. c.header_ = make(http.Header)
  1981. }
  1982. return c.header_
  1983. }
  1984. func (c *ProjectsScanConfigsScanRunsGetCall) doRequest(alt string) (*http.Response, error) {
  1985. reqHeaders := make(http.Header)
  1986. for k, v := range c.header_ {
  1987. reqHeaders[k] = v
  1988. }
  1989. reqHeaders.Set("User-Agent", c.s.userAgent())
  1990. if c.ifNoneMatch_ != "" {
  1991. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1992. }
  1993. var body io.Reader = nil
  1994. c.urlParams_.Set("alt", alt)
  1995. c.urlParams_.Set("prettyPrint", "false")
  1996. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}")
  1997. urls += "?" + c.urlParams_.Encode()
  1998. req, err := http.NewRequest("GET", urls, body)
  1999. if err != nil {
  2000. return nil, err
  2001. }
  2002. req.Header = reqHeaders
  2003. googleapi.Expand(req.URL, map[string]string{
  2004. "name": c.name,
  2005. })
  2006. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2007. }
  2008. // Do executes the "websecurityscanner.projects.scanConfigs.scanRuns.get" call.
  2009. // Exactly one of *ScanRun or error will be non-nil. Any non-2xx status
  2010. // code is an error. Response headers are in either
  2011. // *ScanRun.ServerResponse.Header or (if a response was returned at all)
  2012. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2013. // check whether the returned error was because http.StatusNotModified
  2014. // was returned.
  2015. func (c *ProjectsScanConfigsScanRunsGetCall) Do(opts ...googleapi.CallOption) (*ScanRun, error) {
  2016. gensupport.SetOptions(c.urlParams_, opts...)
  2017. res, err := c.doRequest("json")
  2018. if res != nil && res.StatusCode == http.StatusNotModified {
  2019. if res.Body != nil {
  2020. res.Body.Close()
  2021. }
  2022. return nil, &googleapi.Error{
  2023. Code: res.StatusCode,
  2024. Header: res.Header,
  2025. }
  2026. }
  2027. if err != nil {
  2028. return nil, err
  2029. }
  2030. defer googleapi.CloseBody(res)
  2031. if err := googleapi.CheckResponse(res); err != nil {
  2032. return nil, err
  2033. }
  2034. ret := &ScanRun{
  2035. ServerResponse: googleapi.ServerResponse{
  2036. Header: res.Header,
  2037. HTTPStatusCode: res.StatusCode,
  2038. },
  2039. }
  2040. target := &ret
  2041. if err := gensupport.DecodeResponse(target, res); err != nil {
  2042. return nil, err
  2043. }
  2044. return ret, nil
  2045. // {
  2046. // "description": "Gets a ScanRun.",
  2047. // "flatPath": "v1alpha/projects/{projectsId}/scanConfigs/{scanConfigsId}/scanRuns/{scanRunsId}",
  2048. // "httpMethod": "GET",
  2049. // "id": "websecurityscanner.projects.scanConfigs.scanRuns.get",
  2050. // "parameterOrder": [
  2051. // "name"
  2052. // ],
  2053. // "parameters": {
  2054. // "name": {
  2055. // "description": "Required.\nThe resource name of the ScanRun to be returned. The name follows the\nformat of\n'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.",
  2056. // "location": "path",
  2057. // "pattern": "^projects/[^/]+/scanConfigs/[^/]+/scanRuns/[^/]+$",
  2058. // "required": true,
  2059. // "type": "string"
  2060. // }
  2061. // },
  2062. // "path": "v1alpha/{+name}",
  2063. // "response": {
  2064. // "$ref": "ScanRun"
  2065. // },
  2066. // "scopes": [
  2067. // "https://www.googleapis.com/auth/cloud-platform"
  2068. // ]
  2069. // }
  2070. }
  2071. // method id "websecurityscanner.projects.scanConfigs.scanRuns.list":
  2072. type ProjectsScanConfigsScanRunsListCall struct {
  2073. s *Service
  2074. parent string
  2075. urlParams_ gensupport.URLParams
  2076. ifNoneMatch_ string
  2077. ctx_ context.Context
  2078. header_ http.Header
  2079. }
  2080. // List: Lists ScanRuns under a given ScanConfig, in descending order of
  2081. // ScanRun
  2082. // stop time.
  2083. func (r *ProjectsScanConfigsScanRunsService) List(parent string) *ProjectsScanConfigsScanRunsListCall {
  2084. c := &ProjectsScanConfigsScanRunsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2085. c.parent = parent
  2086. return c
  2087. }
  2088. // PageSize sets the optional parameter "pageSize": The maximum number
  2089. // of ScanRuns to return, can be limited by server.
  2090. // If not specified or not positive, the implementation will select
  2091. // a
  2092. // reasonable value.
  2093. func (c *ProjectsScanConfigsScanRunsListCall) PageSize(pageSize int64) *ProjectsScanConfigsScanRunsListCall {
  2094. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2095. return c
  2096. }
  2097. // PageToken sets the optional parameter "pageToken": A token
  2098. // identifying a page of results to be returned. This should be
  2099. // a
  2100. // `next_page_token` value returned from a previous List request.
  2101. // If unspecified, the first page of results is returned.
  2102. func (c *ProjectsScanConfigsScanRunsListCall) PageToken(pageToken string) *ProjectsScanConfigsScanRunsListCall {
  2103. c.urlParams_.Set("pageToken", pageToken)
  2104. return c
  2105. }
  2106. // Fields allows partial responses to be retrieved. See
  2107. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2108. // for more information.
  2109. func (c *ProjectsScanConfigsScanRunsListCall) Fields(s ...googleapi.Field) *ProjectsScanConfigsScanRunsListCall {
  2110. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2111. return c
  2112. }
  2113. // IfNoneMatch sets the optional parameter which makes the operation
  2114. // fail if the object's ETag matches the given value. This is useful for
  2115. // getting updates only after the object has changed since the last
  2116. // request. Use googleapi.IsNotModified to check whether the response
  2117. // error from Do is the result of In-None-Match.
  2118. func (c *ProjectsScanConfigsScanRunsListCall) IfNoneMatch(entityTag string) *ProjectsScanConfigsScanRunsListCall {
  2119. c.ifNoneMatch_ = entityTag
  2120. return c
  2121. }
  2122. // Context sets the context to be used in this call's Do method. Any
  2123. // pending HTTP request will be aborted if the provided context is
  2124. // canceled.
  2125. func (c *ProjectsScanConfigsScanRunsListCall) Context(ctx context.Context) *ProjectsScanConfigsScanRunsListCall {
  2126. c.ctx_ = ctx
  2127. return c
  2128. }
  2129. // Header returns an http.Header that can be modified by the caller to
  2130. // add HTTP headers to the request.
  2131. func (c *ProjectsScanConfigsScanRunsListCall) Header() http.Header {
  2132. if c.header_ == nil {
  2133. c.header_ = make(http.Header)
  2134. }
  2135. return c.header_
  2136. }
  2137. func (c *ProjectsScanConfigsScanRunsListCall) doRequest(alt string) (*http.Response, error) {
  2138. reqHeaders := make(http.Header)
  2139. for k, v := range c.header_ {
  2140. reqHeaders[k] = v
  2141. }
  2142. reqHeaders.Set("User-Agent", c.s.userAgent())
  2143. if c.ifNoneMatch_ != "" {
  2144. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2145. }
  2146. var body io.Reader = nil
  2147. c.urlParams_.Set("alt", alt)
  2148. c.urlParams_.Set("prettyPrint", "false")
  2149. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+parent}/scanRuns")
  2150. urls += "?" + c.urlParams_.Encode()
  2151. req, err := http.NewRequest("GET", urls, body)
  2152. if err != nil {
  2153. return nil, err
  2154. }
  2155. req.Header = reqHeaders
  2156. googleapi.Expand(req.URL, map[string]string{
  2157. "parent": c.parent,
  2158. })
  2159. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2160. }
  2161. // Do executes the "websecurityscanner.projects.scanConfigs.scanRuns.list" call.
  2162. // Exactly one of *ListScanRunsResponse or error will be non-nil. Any
  2163. // non-2xx status code is an error. Response headers are in either
  2164. // *ListScanRunsResponse.ServerResponse.Header or (if a response was
  2165. // returned at all) in error.(*googleapi.Error).Header. Use
  2166. // googleapi.IsNotModified to check whether the returned error was
  2167. // because http.StatusNotModified was returned.
  2168. func (c *ProjectsScanConfigsScanRunsListCall) Do(opts ...googleapi.CallOption) (*ListScanRunsResponse, error) {
  2169. gensupport.SetOptions(c.urlParams_, opts...)
  2170. res, err := c.doRequest("json")
  2171. if res != nil && res.StatusCode == http.StatusNotModified {
  2172. if res.Body != nil {
  2173. res.Body.Close()
  2174. }
  2175. return nil, &googleapi.Error{
  2176. Code: res.StatusCode,
  2177. Header: res.Header,
  2178. }
  2179. }
  2180. if err != nil {
  2181. return nil, err
  2182. }
  2183. defer googleapi.CloseBody(res)
  2184. if err := googleapi.CheckResponse(res); err != nil {
  2185. return nil, err
  2186. }
  2187. ret := &ListScanRunsResponse{
  2188. ServerResponse: googleapi.ServerResponse{
  2189. Header: res.Header,
  2190. HTTPStatusCode: res.StatusCode,
  2191. },
  2192. }
  2193. target := &ret
  2194. if err := gensupport.DecodeResponse(target, res); err != nil {
  2195. return nil, err
  2196. }
  2197. return ret, nil
  2198. // {
  2199. // "description": "Lists ScanRuns under a given ScanConfig, in descending order of ScanRun\nstop time.",
  2200. // "flatPath": "v1alpha/projects/{projectsId}/scanConfigs/{scanConfigsId}/scanRuns",
  2201. // "httpMethod": "GET",
  2202. // "id": "websecurityscanner.projects.scanConfigs.scanRuns.list",
  2203. // "parameterOrder": [
  2204. // "parent"
  2205. // ],
  2206. // "parameters": {
  2207. // "pageSize": {
  2208. // "description": "The maximum number of ScanRuns to return, can be limited by server.\nIf not specified or not positive, the implementation will select a\nreasonable value.",
  2209. // "format": "int32",
  2210. // "location": "query",
  2211. // "type": "integer"
  2212. // },
  2213. // "pageToken": {
  2214. // "description": "A token identifying a page of results to be returned. This should be a\n`next_page_token` value returned from a previous List request.\nIf unspecified, the first page of results is returned.",
  2215. // "location": "query",
  2216. // "type": "string"
  2217. // },
  2218. // "parent": {
  2219. // "description": "Required.\nThe parent resource name, which should be a scan resource name in the\nformat 'projects/{projectId}/scanConfigs/{scanConfigId}'.",
  2220. // "location": "path",
  2221. // "pattern": "^projects/[^/]+/scanConfigs/[^/]+$",
  2222. // "required": true,
  2223. // "type": "string"
  2224. // }
  2225. // },
  2226. // "path": "v1alpha/{+parent}/scanRuns",
  2227. // "response": {
  2228. // "$ref": "ListScanRunsResponse"
  2229. // },
  2230. // "scopes": [
  2231. // "https://www.googleapis.com/auth/cloud-platform"
  2232. // ]
  2233. // }
  2234. }
  2235. // Pages invokes f for each page of results.
  2236. // A non-nil error returned from f will halt the iteration.
  2237. // The provided context supersedes any context provided to the Context method.
  2238. func (c *ProjectsScanConfigsScanRunsListCall) Pages(ctx context.Context, f func(*ListScanRunsResponse) error) error {
  2239. c.ctx_ = ctx
  2240. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2241. for {
  2242. x, err := c.Do()
  2243. if err != nil {
  2244. return err
  2245. }
  2246. if err := f(x); err != nil {
  2247. return err
  2248. }
  2249. if x.NextPageToken == "" {
  2250. return nil
  2251. }
  2252. c.PageToken(x.NextPageToken)
  2253. }
  2254. }
  2255. // method id "websecurityscanner.projects.scanConfigs.scanRuns.stop":
  2256. type ProjectsScanConfigsScanRunsStopCall struct {
  2257. s *Service
  2258. name string
  2259. stopscanrunrequest *StopScanRunRequest
  2260. urlParams_ gensupport.URLParams
  2261. ctx_ context.Context
  2262. header_ http.Header
  2263. }
  2264. // Stop: Stops a ScanRun. The stopped ScanRun is returned.
  2265. func (r *ProjectsScanConfigsScanRunsService) Stop(name string, stopscanrunrequest *StopScanRunRequest) *ProjectsScanConfigsScanRunsStopCall {
  2266. c := &ProjectsScanConfigsScanRunsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2267. c.name = name
  2268. c.stopscanrunrequest = stopscanrunrequest
  2269. return c
  2270. }
  2271. // Fields allows partial responses to be retrieved. See
  2272. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2273. // for more information.
  2274. func (c *ProjectsScanConfigsScanRunsStopCall) Fields(s ...googleapi.Field) *ProjectsScanConfigsScanRunsStopCall {
  2275. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2276. return c
  2277. }
  2278. // Context sets the context to be used in this call's Do method. Any
  2279. // pending HTTP request will be aborted if the provided context is
  2280. // canceled.
  2281. func (c *ProjectsScanConfigsScanRunsStopCall) Context(ctx context.Context) *ProjectsScanConfigsScanRunsStopCall {
  2282. c.ctx_ = ctx
  2283. return c
  2284. }
  2285. // Header returns an http.Header that can be modified by the caller to
  2286. // add HTTP headers to the request.
  2287. func (c *ProjectsScanConfigsScanRunsStopCall) Header() http.Header {
  2288. if c.header_ == nil {
  2289. c.header_ = make(http.Header)
  2290. }
  2291. return c.header_
  2292. }
  2293. func (c *ProjectsScanConfigsScanRunsStopCall) doRequest(alt string) (*http.Response, error) {
  2294. reqHeaders := make(http.Header)
  2295. for k, v := range c.header_ {
  2296. reqHeaders[k] = v
  2297. }
  2298. reqHeaders.Set("User-Agent", c.s.userAgent())
  2299. var body io.Reader = nil
  2300. body, err := googleapi.WithoutDataWrapper.JSONReader(c.stopscanrunrequest)
  2301. if err != nil {
  2302. return nil, err
  2303. }
  2304. reqHeaders.Set("Content-Type", "application/json")
  2305. c.urlParams_.Set("alt", alt)
  2306. c.urlParams_.Set("prettyPrint", "false")
  2307. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}:stop")
  2308. urls += "?" + c.urlParams_.Encode()
  2309. req, err := http.NewRequest("POST", urls, body)
  2310. if err != nil {
  2311. return nil, err
  2312. }
  2313. req.Header = reqHeaders
  2314. googleapi.Expand(req.URL, map[string]string{
  2315. "name": c.name,
  2316. })
  2317. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2318. }
  2319. // Do executes the "websecurityscanner.projects.scanConfigs.scanRuns.stop" call.
  2320. // Exactly one of *ScanRun or error will be non-nil. Any non-2xx status
  2321. // code is an error. Response headers are in either
  2322. // *ScanRun.ServerResponse.Header or (if a response was returned at all)
  2323. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2324. // check whether the returned error was because http.StatusNotModified
  2325. // was returned.
  2326. func (c *ProjectsScanConfigsScanRunsStopCall) Do(opts ...googleapi.CallOption) (*ScanRun, error) {
  2327. gensupport.SetOptions(c.urlParams_, opts...)
  2328. res, err := c.doRequest("json")
  2329. if res != nil && res.StatusCode == http.StatusNotModified {
  2330. if res.Body != nil {
  2331. res.Body.Close()
  2332. }
  2333. return nil, &googleapi.Error{
  2334. Code: res.StatusCode,
  2335. Header: res.Header,
  2336. }
  2337. }
  2338. if err != nil {
  2339. return nil, err
  2340. }
  2341. defer googleapi.CloseBody(res)
  2342. if err := googleapi.CheckResponse(res); err != nil {
  2343. return nil, err
  2344. }
  2345. ret := &ScanRun{
  2346. ServerResponse: googleapi.ServerResponse{
  2347. Header: res.Header,
  2348. HTTPStatusCode: res.StatusCode,
  2349. },
  2350. }
  2351. target := &ret
  2352. if err := gensupport.DecodeResponse(target, res); err != nil {
  2353. return nil, err
  2354. }
  2355. return ret, nil
  2356. // {
  2357. // "description": "Stops a ScanRun. The stopped ScanRun is returned.",
  2358. // "flatPath": "v1alpha/projects/{projectsId}/scanConfigs/{scanConfigsId}/scanRuns/{scanRunsId}:stop",
  2359. // "httpMethod": "POST",
  2360. // "id": "websecurityscanner.projects.scanConfigs.scanRuns.stop",
  2361. // "parameterOrder": [
  2362. // "name"
  2363. // ],
  2364. // "parameters": {
  2365. // "name": {
  2366. // "description": "Required.\nThe resource name of the ScanRun to be stopped. The name follows the\nformat of\n'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.",
  2367. // "location": "path",
  2368. // "pattern": "^projects/[^/]+/scanConfigs/[^/]+/scanRuns/[^/]+$",
  2369. // "required": true,
  2370. // "type": "string"
  2371. // }
  2372. // },
  2373. // "path": "v1alpha/{+name}:stop",
  2374. // "request": {
  2375. // "$ref": "StopScanRunRequest"
  2376. // },
  2377. // "response": {
  2378. // "$ref": "ScanRun"
  2379. // },
  2380. // "scopes": [
  2381. // "https://www.googleapis.com/auth/cloud-platform"
  2382. // ]
  2383. // }
  2384. }
  2385. // method id "websecurityscanner.projects.scanConfigs.scanRuns.crawledUrls.list":
  2386. type ProjectsScanConfigsScanRunsCrawledUrlsListCall struct {
  2387. s *Service
  2388. parent string
  2389. urlParams_ gensupport.URLParams
  2390. ifNoneMatch_ string
  2391. ctx_ context.Context
  2392. header_ http.Header
  2393. }
  2394. // List: List CrawledUrls under a given ScanRun.
  2395. func (r *ProjectsScanConfigsScanRunsCrawledUrlsService) List(parent string) *ProjectsScanConfigsScanRunsCrawledUrlsListCall {
  2396. c := &ProjectsScanConfigsScanRunsCrawledUrlsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2397. c.parent = parent
  2398. return c
  2399. }
  2400. // PageSize sets the optional parameter "pageSize": The maximum number
  2401. // of CrawledUrls to return, can be limited by server.
  2402. // If not specified or not positive, the implementation will select
  2403. // a
  2404. // reasonable value.
  2405. func (c *ProjectsScanConfigsScanRunsCrawledUrlsListCall) PageSize(pageSize int64) *ProjectsScanConfigsScanRunsCrawledUrlsListCall {
  2406. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2407. return c
  2408. }
  2409. // PageToken sets the optional parameter "pageToken": A token
  2410. // identifying a page of results to be returned. This should be
  2411. // a
  2412. // `next_page_token` value returned from a previous List request.
  2413. // If unspecified, the first page of results is returned.
  2414. func (c *ProjectsScanConfigsScanRunsCrawledUrlsListCall) PageToken(pageToken string) *ProjectsScanConfigsScanRunsCrawledUrlsListCall {
  2415. c.urlParams_.Set("pageToken", pageToken)
  2416. return c
  2417. }
  2418. // Fields allows partial responses to be retrieved. See
  2419. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2420. // for more information.
  2421. func (c *ProjectsScanConfigsScanRunsCrawledUrlsListCall) Fields(s ...googleapi.Field) *ProjectsScanConfigsScanRunsCrawledUrlsListCall {
  2422. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2423. return c
  2424. }
  2425. // IfNoneMatch sets the optional parameter which makes the operation
  2426. // fail if the object's ETag matches the given value. This is useful for
  2427. // getting updates only after the object has changed since the last
  2428. // request. Use googleapi.IsNotModified to check whether the response
  2429. // error from Do is the result of In-None-Match.
  2430. func (c *ProjectsScanConfigsScanRunsCrawledUrlsListCall) IfNoneMatch(entityTag string) *ProjectsScanConfigsScanRunsCrawledUrlsListCall {
  2431. c.ifNoneMatch_ = entityTag
  2432. return c
  2433. }
  2434. // Context sets the context to be used in this call's Do method. Any
  2435. // pending HTTP request will be aborted if the provided context is
  2436. // canceled.
  2437. func (c *ProjectsScanConfigsScanRunsCrawledUrlsListCall) Context(ctx context.Context) *ProjectsScanConfigsScanRunsCrawledUrlsListCall {
  2438. c.ctx_ = ctx
  2439. return c
  2440. }
  2441. // Header returns an http.Header that can be modified by the caller to
  2442. // add HTTP headers to the request.
  2443. func (c *ProjectsScanConfigsScanRunsCrawledUrlsListCall) Header() http.Header {
  2444. if c.header_ == nil {
  2445. c.header_ = make(http.Header)
  2446. }
  2447. return c.header_
  2448. }
  2449. func (c *ProjectsScanConfigsScanRunsCrawledUrlsListCall) doRequest(alt string) (*http.Response, error) {
  2450. reqHeaders := make(http.Header)
  2451. for k, v := range c.header_ {
  2452. reqHeaders[k] = v
  2453. }
  2454. reqHeaders.Set("User-Agent", c.s.userAgent())
  2455. if c.ifNoneMatch_ != "" {
  2456. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2457. }
  2458. var body io.Reader = nil
  2459. c.urlParams_.Set("alt", alt)
  2460. c.urlParams_.Set("prettyPrint", "false")
  2461. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+parent}/crawledUrls")
  2462. urls += "?" + c.urlParams_.Encode()
  2463. req, err := http.NewRequest("GET", urls, body)
  2464. if err != nil {
  2465. return nil, err
  2466. }
  2467. req.Header = reqHeaders
  2468. googleapi.Expand(req.URL, map[string]string{
  2469. "parent": c.parent,
  2470. })
  2471. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2472. }
  2473. // Do executes the "websecurityscanner.projects.scanConfigs.scanRuns.crawledUrls.list" call.
  2474. // Exactly one of *ListCrawledUrlsResponse or error will be non-nil. Any
  2475. // non-2xx status code is an error. Response headers are in either
  2476. // *ListCrawledUrlsResponse.ServerResponse.Header or (if a response was
  2477. // returned at all) in error.(*googleapi.Error).Header. Use
  2478. // googleapi.IsNotModified to check whether the returned error was
  2479. // because http.StatusNotModified was returned.
  2480. func (c *ProjectsScanConfigsScanRunsCrawledUrlsListCall) Do(opts ...googleapi.CallOption) (*ListCrawledUrlsResponse, error) {
  2481. gensupport.SetOptions(c.urlParams_, opts...)
  2482. res, err := c.doRequest("json")
  2483. if res != nil && res.StatusCode == http.StatusNotModified {
  2484. if res.Body != nil {
  2485. res.Body.Close()
  2486. }
  2487. return nil, &googleapi.Error{
  2488. Code: res.StatusCode,
  2489. Header: res.Header,
  2490. }
  2491. }
  2492. if err != nil {
  2493. return nil, err
  2494. }
  2495. defer googleapi.CloseBody(res)
  2496. if err := googleapi.CheckResponse(res); err != nil {
  2497. return nil, err
  2498. }
  2499. ret := &ListCrawledUrlsResponse{
  2500. ServerResponse: googleapi.ServerResponse{
  2501. Header: res.Header,
  2502. HTTPStatusCode: res.StatusCode,
  2503. },
  2504. }
  2505. target := &ret
  2506. if err := gensupport.DecodeResponse(target, res); err != nil {
  2507. return nil, err
  2508. }
  2509. return ret, nil
  2510. // {
  2511. // "description": "List CrawledUrls under a given ScanRun.",
  2512. // "flatPath": "v1alpha/projects/{projectsId}/scanConfigs/{scanConfigsId}/scanRuns/{scanRunsId}/crawledUrls",
  2513. // "httpMethod": "GET",
  2514. // "id": "websecurityscanner.projects.scanConfigs.scanRuns.crawledUrls.list",
  2515. // "parameterOrder": [
  2516. // "parent"
  2517. // ],
  2518. // "parameters": {
  2519. // "pageSize": {
  2520. // "description": "The maximum number of CrawledUrls to return, can be limited by server.\nIf not specified or not positive, the implementation will select a\nreasonable value.",
  2521. // "format": "int32",
  2522. // "location": "query",
  2523. // "type": "integer"
  2524. // },
  2525. // "pageToken": {
  2526. // "description": "A token identifying a page of results to be returned. This should be a\n`next_page_token` value returned from a previous List request.\nIf unspecified, the first page of results is returned.",
  2527. // "location": "query",
  2528. // "type": "string"
  2529. // },
  2530. // "parent": {
  2531. // "description": "Required.\nThe parent resource name, which should be a scan run resource name in the\nformat\n'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.",
  2532. // "location": "path",
  2533. // "pattern": "^projects/[^/]+/scanConfigs/[^/]+/scanRuns/[^/]+$",
  2534. // "required": true,
  2535. // "type": "string"
  2536. // }
  2537. // },
  2538. // "path": "v1alpha/{+parent}/crawledUrls",
  2539. // "response": {
  2540. // "$ref": "ListCrawledUrlsResponse"
  2541. // },
  2542. // "scopes": [
  2543. // "https://www.googleapis.com/auth/cloud-platform"
  2544. // ]
  2545. // }
  2546. }
  2547. // Pages invokes f for each page of results.
  2548. // A non-nil error returned from f will halt the iteration.
  2549. // The provided context supersedes any context provided to the Context method.
  2550. func (c *ProjectsScanConfigsScanRunsCrawledUrlsListCall) Pages(ctx context.Context, f func(*ListCrawledUrlsResponse) error) error {
  2551. c.ctx_ = ctx
  2552. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2553. for {
  2554. x, err := c.Do()
  2555. if err != nil {
  2556. return err
  2557. }
  2558. if err := f(x); err != nil {
  2559. return err
  2560. }
  2561. if x.NextPageToken == "" {
  2562. return nil
  2563. }
  2564. c.PageToken(x.NextPageToken)
  2565. }
  2566. }
  2567. // method id "websecurityscanner.projects.scanConfigs.scanRuns.findingTypeStats.list":
  2568. type ProjectsScanConfigsScanRunsFindingTypeStatsListCall struct {
  2569. s *Service
  2570. parent string
  2571. urlParams_ gensupport.URLParams
  2572. ifNoneMatch_ string
  2573. ctx_ context.Context
  2574. header_ http.Header
  2575. }
  2576. // List: List all FindingTypeStats under a given ScanRun.
  2577. func (r *ProjectsScanConfigsScanRunsFindingTypeStatsService) List(parent string) *ProjectsScanConfigsScanRunsFindingTypeStatsListCall {
  2578. c := &ProjectsScanConfigsScanRunsFindingTypeStatsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2579. c.parent = parent
  2580. return c
  2581. }
  2582. // Fields allows partial responses to be retrieved. See
  2583. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2584. // for more information.
  2585. func (c *ProjectsScanConfigsScanRunsFindingTypeStatsListCall) Fields(s ...googleapi.Field) *ProjectsScanConfigsScanRunsFindingTypeStatsListCall {
  2586. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2587. return c
  2588. }
  2589. // IfNoneMatch sets the optional parameter which makes the operation
  2590. // fail if the object's ETag matches the given value. This is useful for
  2591. // getting updates only after the object has changed since the last
  2592. // request. Use googleapi.IsNotModified to check whether the response
  2593. // error from Do is the result of In-None-Match.
  2594. func (c *ProjectsScanConfigsScanRunsFindingTypeStatsListCall) IfNoneMatch(entityTag string) *ProjectsScanConfigsScanRunsFindingTypeStatsListCall {
  2595. c.ifNoneMatch_ = entityTag
  2596. return c
  2597. }
  2598. // Context sets the context to be used in this call's Do method. Any
  2599. // pending HTTP request will be aborted if the provided context is
  2600. // canceled.
  2601. func (c *ProjectsScanConfigsScanRunsFindingTypeStatsListCall) Context(ctx context.Context) *ProjectsScanConfigsScanRunsFindingTypeStatsListCall {
  2602. c.ctx_ = ctx
  2603. return c
  2604. }
  2605. // Header returns an http.Header that can be modified by the caller to
  2606. // add HTTP headers to the request.
  2607. func (c *ProjectsScanConfigsScanRunsFindingTypeStatsListCall) Header() http.Header {
  2608. if c.header_ == nil {
  2609. c.header_ = make(http.Header)
  2610. }
  2611. return c.header_
  2612. }
  2613. func (c *ProjectsScanConfigsScanRunsFindingTypeStatsListCall) doRequest(alt string) (*http.Response, error) {
  2614. reqHeaders := make(http.Header)
  2615. for k, v := range c.header_ {
  2616. reqHeaders[k] = v
  2617. }
  2618. reqHeaders.Set("User-Agent", c.s.userAgent())
  2619. if c.ifNoneMatch_ != "" {
  2620. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2621. }
  2622. var body io.Reader = nil
  2623. c.urlParams_.Set("alt", alt)
  2624. c.urlParams_.Set("prettyPrint", "false")
  2625. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+parent}/findingTypeStats")
  2626. urls += "?" + c.urlParams_.Encode()
  2627. req, err := http.NewRequest("GET", urls, body)
  2628. if err != nil {
  2629. return nil, err
  2630. }
  2631. req.Header = reqHeaders
  2632. googleapi.Expand(req.URL, map[string]string{
  2633. "parent": c.parent,
  2634. })
  2635. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2636. }
  2637. // Do executes the "websecurityscanner.projects.scanConfigs.scanRuns.findingTypeStats.list" call.
  2638. // Exactly one of *ListFindingTypeStatsResponse or error will be
  2639. // non-nil. Any non-2xx status code is an error. Response headers are in
  2640. // either *ListFindingTypeStatsResponse.ServerResponse.Header or (if a
  2641. // response was returned at all) in error.(*googleapi.Error).Header. Use
  2642. // googleapi.IsNotModified to check whether the returned error was
  2643. // because http.StatusNotModified was returned.
  2644. func (c *ProjectsScanConfigsScanRunsFindingTypeStatsListCall) Do(opts ...googleapi.CallOption) (*ListFindingTypeStatsResponse, error) {
  2645. gensupport.SetOptions(c.urlParams_, opts...)
  2646. res, err := c.doRequest("json")
  2647. if res != nil && res.StatusCode == http.StatusNotModified {
  2648. if res.Body != nil {
  2649. res.Body.Close()
  2650. }
  2651. return nil, &googleapi.Error{
  2652. Code: res.StatusCode,
  2653. Header: res.Header,
  2654. }
  2655. }
  2656. if err != nil {
  2657. return nil, err
  2658. }
  2659. defer googleapi.CloseBody(res)
  2660. if err := googleapi.CheckResponse(res); err != nil {
  2661. return nil, err
  2662. }
  2663. ret := &ListFindingTypeStatsResponse{
  2664. ServerResponse: googleapi.ServerResponse{
  2665. Header: res.Header,
  2666. HTTPStatusCode: res.StatusCode,
  2667. },
  2668. }
  2669. target := &ret
  2670. if err := gensupport.DecodeResponse(target, res); err != nil {
  2671. return nil, err
  2672. }
  2673. return ret, nil
  2674. // {
  2675. // "description": "List all FindingTypeStats under a given ScanRun.",
  2676. // "flatPath": "v1alpha/projects/{projectsId}/scanConfigs/{scanConfigsId}/scanRuns/{scanRunsId}/findingTypeStats",
  2677. // "httpMethod": "GET",
  2678. // "id": "websecurityscanner.projects.scanConfigs.scanRuns.findingTypeStats.list",
  2679. // "parameterOrder": [
  2680. // "parent"
  2681. // ],
  2682. // "parameters": {
  2683. // "parent": {
  2684. // "description": "Required.\nThe parent resource name, which should be a scan run resource name in the\nformat\n'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.",
  2685. // "location": "path",
  2686. // "pattern": "^projects/[^/]+/scanConfigs/[^/]+/scanRuns/[^/]+$",
  2687. // "required": true,
  2688. // "type": "string"
  2689. // }
  2690. // },
  2691. // "path": "v1alpha/{+parent}/findingTypeStats",
  2692. // "response": {
  2693. // "$ref": "ListFindingTypeStatsResponse"
  2694. // },
  2695. // "scopes": [
  2696. // "https://www.googleapis.com/auth/cloud-platform"
  2697. // ]
  2698. // }
  2699. }
  2700. // method id "websecurityscanner.projects.scanConfigs.scanRuns.findings.get":
  2701. type ProjectsScanConfigsScanRunsFindingsGetCall struct {
  2702. s *Service
  2703. name string
  2704. urlParams_ gensupport.URLParams
  2705. ifNoneMatch_ string
  2706. ctx_ context.Context
  2707. header_ http.Header
  2708. }
  2709. // Get: Gets a Finding.
  2710. func (r *ProjectsScanConfigsScanRunsFindingsService) Get(name string) *ProjectsScanConfigsScanRunsFindingsGetCall {
  2711. c := &ProjectsScanConfigsScanRunsFindingsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2712. c.name = name
  2713. return c
  2714. }
  2715. // Fields allows partial responses to be retrieved. See
  2716. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2717. // for more information.
  2718. func (c *ProjectsScanConfigsScanRunsFindingsGetCall) Fields(s ...googleapi.Field) *ProjectsScanConfigsScanRunsFindingsGetCall {
  2719. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2720. return c
  2721. }
  2722. // IfNoneMatch sets the optional parameter which makes the operation
  2723. // fail if the object's ETag matches the given value. This is useful for
  2724. // getting updates only after the object has changed since the last
  2725. // request. Use googleapi.IsNotModified to check whether the response
  2726. // error from Do is the result of In-None-Match.
  2727. func (c *ProjectsScanConfigsScanRunsFindingsGetCall) IfNoneMatch(entityTag string) *ProjectsScanConfigsScanRunsFindingsGetCall {
  2728. c.ifNoneMatch_ = entityTag
  2729. return c
  2730. }
  2731. // Context sets the context to be used in this call's Do method. Any
  2732. // pending HTTP request will be aborted if the provided context is
  2733. // canceled.
  2734. func (c *ProjectsScanConfigsScanRunsFindingsGetCall) Context(ctx context.Context) *ProjectsScanConfigsScanRunsFindingsGetCall {
  2735. c.ctx_ = ctx
  2736. return c
  2737. }
  2738. // Header returns an http.Header that can be modified by the caller to
  2739. // add HTTP headers to the request.
  2740. func (c *ProjectsScanConfigsScanRunsFindingsGetCall) Header() http.Header {
  2741. if c.header_ == nil {
  2742. c.header_ = make(http.Header)
  2743. }
  2744. return c.header_
  2745. }
  2746. func (c *ProjectsScanConfigsScanRunsFindingsGetCall) doRequest(alt string) (*http.Response, error) {
  2747. reqHeaders := make(http.Header)
  2748. for k, v := range c.header_ {
  2749. reqHeaders[k] = v
  2750. }
  2751. reqHeaders.Set("User-Agent", c.s.userAgent())
  2752. if c.ifNoneMatch_ != "" {
  2753. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2754. }
  2755. var body io.Reader = nil
  2756. c.urlParams_.Set("alt", alt)
  2757. c.urlParams_.Set("prettyPrint", "false")
  2758. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}")
  2759. urls += "?" + c.urlParams_.Encode()
  2760. req, err := http.NewRequest("GET", urls, body)
  2761. if err != nil {
  2762. return nil, err
  2763. }
  2764. req.Header = reqHeaders
  2765. googleapi.Expand(req.URL, map[string]string{
  2766. "name": c.name,
  2767. })
  2768. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2769. }
  2770. // Do executes the "websecurityscanner.projects.scanConfigs.scanRuns.findings.get" call.
  2771. // Exactly one of *Finding or error will be non-nil. Any non-2xx status
  2772. // code is an error. Response headers are in either
  2773. // *Finding.ServerResponse.Header or (if a response was returned at all)
  2774. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2775. // check whether the returned error was because http.StatusNotModified
  2776. // was returned.
  2777. func (c *ProjectsScanConfigsScanRunsFindingsGetCall) Do(opts ...googleapi.CallOption) (*Finding, error) {
  2778. gensupport.SetOptions(c.urlParams_, opts...)
  2779. res, err := c.doRequest("json")
  2780. if res != nil && res.StatusCode == http.StatusNotModified {
  2781. if res.Body != nil {
  2782. res.Body.Close()
  2783. }
  2784. return nil, &googleapi.Error{
  2785. Code: res.StatusCode,
  2786. Header: res.Header,
  2787. }
  2788. }
  2789. if err != nil {
  2790. return nil, err
  2791. }
  2792. defer googleapi.CloseBody(res)
  2793. if err := googleapi.CheckResponse(res); err != nil {
  2794. return nil, err
  2795. }
  2796. ret := &Finding{
  2797. ServerResponse: googleapi.ServerResponse{
  2798. Header: res.Header,
  2799. HTTPStatusCode: res.StatusCode,
  2800. },
  2801. }
  2802. target := &ret
  2803. if err := gensupport.DecodeResponse(target, res); err != nil {
  2804. return nil, err
  2805. }
  2806. return ret, nil
  2807. // {
  2808. // "description": "Gets a Finding.",
  2809. // "flatPath": "v1alpha/projects/{projectsId}/scanConfigs/{scanConfigsId}/scanRuns/{scanRunsId}/findings/{findingsId}",
  2810. // "httpMethod": "GET",
  2811. // "id": "websecurityscanner.projects.scanConfigs.scanRuns.findings.get",
  2812. // "parameterOrder": [
  2813. // "name"
  2814. // ],
  2815. // "parameters": {
  2816. // "name": {
  2817. // "description": "Required.\nThe resource name of the Finding to be returned. The name follows the\nformat of\n'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'.",
  2818. // "location": "path",
  2819. // "pattern": "^projects/[^/]+/scanConfigs/[^/]+/scanRuns/[^/]+/findings/[^/]+$",
  2820. // "required": true,
  2821. // "type": "string"
  2822. // }
  2823. // },
  2824. // "path": "v1alpha/{+name}",
  2825. // "response": {
  2826. // "$ref": "Finding"
  2827. // },
  2828. // "scopes": [
  2829. // "https://www.googleapis.com/auth/cloud-platform"
  2830. // ]
  2831. // }
  2832. }
  2833. // method id "websecurityscanner.projects.scanConfigs.scanRuns.findings.list":
  2834. type ProjectsScanConfigsScanRunsFindingsListCall struct {
  2835. s *Service
  2836. parent string
  2837. urlParams_ gensupport.URLParams
  2838. ifNoneMatch_ string
  2839. ctx_ context.Context
  2840. header_ http.Header
  2841. }
  2842. // List: List Findings under a given ScanRun.
  2843. func (r *ProjectsScanConfigsScanRunsFindingsService) List(parent string) *ProjectsScanConfigsScanRunsFindingsListCall {
  2844. c := &ProjectsScanConfigsScanRunsFindingsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2845. c.parent = parent
  2846. return c
  2847. }
  2848. // Filter sets the optional parameter "filter": The filter expression.
  2849. // The expression must be in the format: <field>
  2850. // <operator> <value>.
  2851. // Supported field: 'finding_type'.
  2852. // Supported operator: '='.
  2853. func (c *ProjectsScanConfigsScanRunsFindingsListCall) Filter(filter string) *ProjectsScanConfigsScanRunsFindingsListCall {
  2854. c.urlParams_.Set("filter", filter)
  2855. return c
  2856. }
  2857. // PageSize sets the optional parameter "pageSize": The maximum number
  2858. // of Findings to return, can be limited by server.
  2859. // If not specified or not positive, the implementation will select
  2860. // a
  2861. // reasonable value.
  2862. func (c *ProjectsScanConfigsScanRunsFindingsListCall) PageSize(pageSize int64) *ProjectsScanConfigsScanRunsFindingsListCall {
  2863. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2864. return c
  2865. }
  2866. // PageToken sets the optional parameter "pageToken": A token
  2867. // identifying a page of results to be returned. This should be
  2868. // a
  2869. // `next_page_token` value returned from a previous List request.
  2870. // If unspecified, the first page of results is returned.
  2871. func (c *ProjectsScanConfigsScanRunsFindingsListCall) PageToken(pageToken string) *ProjectsScanConfigsScanRunsFindingsListCall {
  2872. c.urlParams_.Set("pageToken", pageToken)
  2873. return c
  2874. }
  2875. // Fields allows partial responses to be retrieved. See
  2876. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2877. // for more information.
  2878. func (c *ProjectsScanConfigsScanRunsFindingsListCall) Fields(s ...googleapi.Field) *ProjectsScanConfigsScanRunsFindingsListCall {
  2879. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2880. return c
  2881. }
  2882. // IfNoneMatch sets the optional parameter which makes the operation
  2883. // fail if the object's ETag matches the given value. This is useful for
  2884. // getting updates only after the object has changed since the last
  2885. // request. Use googleapi.IsNotModified to check whether the response
  2886. // error from Do is the result of In-None-Match.
  2887. func (c *ProjectsScanConfigsScanRunsFindingsListCall) IfNoneMatch(entityTag string) *ProjectsScanConfigsScanRunsFindingsListCall {
  2888. c.ifNoneMatch_ = entityTag
  2889. return c
  2890. }
  2891. // Context sets the context to be used in this call's Do method. Any
  2892. // pending HTTP request will be aborted if the provided context is
  2893. // canceled.
  2894. func (c *ProjectsScanConfigsScanRunsFindingsListCall) Context(ctx context.Context) *ProjectsScanConfigsScanRunsFindingsListCall {
  2895. c.ctx_ = ctx
  2896. return c
  2897. }
  2898. // Header returns an http.Header that can be modified by the caller to
  2899. // add HTTP headers to the request.
  2900. func (c *ProjectsScanConfigsScanRunsFindingsListCall) Header() http.Header {
  2901. if c.header_ == nil {
  2902. c.header_ = make(http.Header)
  2903. }
  2904. return c.header_
  2905. }
  2906. func (c *ProjectsScanConfigsScanRunsFindingsListCall) doRequest(alt string) (*http.Response, error) {
  2907. reqHeaders := make(http.Header)
  2908. for k, v := range c.header_ {
  2909. reqHeaders[k] = v
  2910. }
  2911. reqHeaders.Set("User-Agent", c.s.userAgent())
  2912. if c.ifNoneMatch_ != "" {
  2913. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2914. }
  2915. var body io.Reader = nil
  2916. c.urlParams_.Set("alt", alt)
  2917. c.urlParams_.Set("prettyPrint", "false")
  2918. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+parent}/findings")
  2919. urls += "?" + c.urlParams_.Encode()
  2920. req, err := http.NewRequest("GET", urls, body)
  2921. if err != nil {
  2922. return nil, err
  2923. }
  2924. req.Header = reqHeaders
  2925. googleapi.Expand(req.URL, map[string]string{
  2926. "parent": c.parent,
  2927. })
  2928. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2929. }
  2930. // Do executes the "websecurityscanner.projects.scanConfigs.scanRuns.findings.list" call.
  2931. // Exactly one of *ListFindingsResponse or error will be non-nil. Any
  2932. // non-2xx status code is an error. Response headers are in either
  2933. // *ListFindingsResponse.ServerResponse.Header or (if a response was
  2934. // returned at all) in error.(*googleapi.Error).Header. Use
  2935. // googleapi.IsNotModified to check whether the returned error was
  2936. // because http.StatusNotModified was returned.
  2937. func (c *ProjectsScanConfigsScanRunsFindingsListCall) Do(opts ...googleapi.CallOption) (*ListFindingsResponse, error) {
  2938. gensupport.SetOptions(c.urlParams_, opts...)
  2939. res, err := c.doRequest("json")
  2940. if res != nil && res.StatusCode == http.StatusNotModified {
  2941. if res.Body != nil {
  2942. res.Body.Close()
  2943. }
  2944. return nil, &googleapi.Error{
  2945. Code: res.StatusCode,
  2946. Header: res.Header,
  2947. }
  2948. }
  2949. if err != nil {
  2950. return nil, err
  2951. }
  2952. defer googleapi.CloseBody(res)
  2953. if err := googleapi.CheckResponse(res); err != nil {
  2954. return nil, err
  2955. }
  2956. ret := &ListFindingsResponse{
  2957. ServerResponse: googleapi.ServerResponse{
  2958. Header: res.Header,
  2959. HTTPStatusCode: res.StatusCode,
  2960. },
  2961. }
  2962. target := &ret
  2963. if err := gensupport.DecodeResponse(target, res); err != nil {
  2964. return nil, err
  2965. }
  2966. return ret, nil
  2967. // {
  2968. // "description": "List Findings under a given ScanRun.",
  2969. // "flatPath": "v1alpha/projects/{projectsId}/scanConfigs/{scanConfigsId}/scanRuns/{scanRunsId}/findings",
  2970. // "httpMethod": "GET",
  2971. // "id": "websecurityscanner.projects.scanConfigs.scanRuns.findings.list",
  2972. // "parameterOrder": [
  2973. // "parent"
  2974. // ],
  2975. // "parameters": {
  2976. // "filter": {
  2977. // "description": "The filter expression. The expression must be in the format: \u003cfield\u003e\n\u003coperator\u003e \u003cvalue\u003e.\nSupported field: 'finding_type'.\nSupported operator: '='.",
  2978. // "location": "query",
  2979. // "type": "string"
  2980. // },
  2981. // "pageSize": {
  2982. // "description": "The maximum number of Findings to return, can be limited by server.\nIf not specified or not positive, the implementation will select a\nreasonable value.",
  2983. // "format": "int32",
  2984. // "location": "query",
  2985. // "type": "integer"
  2986. // },
  2987. // "pageToken": {
  2988. // "description": "A token identifying a page of results to be returned. This should be a\n`next_page_token` value returned from a previous List request.\nIf unspecified, the first page of results is returned.",
  2989. // "location": "query",
  2990. // "type": "string"
  2991. // },
  2992. // "parent": {
  2993. // "description": "Required.\nThe parent resource name, which should be a scan run resource name in the\nformat\n'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.",
  2994. // "location": "path",
  2995. // "pattern": "^projects/[^/]+/scanConfigs/[^/]+/scanRuns/[^/]+$",
  2996. // "required": true,
  2997. // "type": "string"
  2998. // }
  2999. // },
  3000. // "path": "v1alpha/{+parent}/findings",
  3001. // "response": {
  3002. // "$ref": "ListFindingsResponse"
  3003. // },
  3004. // "scopes": [
  3005. // "https://www.googleapis.com/auth/cloud-platform"
  3006. // ]
  3007. // }
  3008. }
  3009. // Pages invokes f for each page of results.
  3010. // A non-nil error returned from f will halt the iteration.
  3011. // The provided context supersedes any context provided to the Context method.
  3012. func (c *ProjectsScanConfigsScanRunsFindingsListCall) Pages(ctx context.Context, f func(*ListFindingsResponse) error) error {
  3013. c.ctx_ = ctx
  3014. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3015. for {
  3016. x, err := c.Do()
  3017. if err != nil {
  3018. return err
  3019. }
  3020. if err := f(x); err != nil {
  3021. return err
  3022. }
  3023. if x.NextPageToken == "" {
  3024. return nil
  3025. }
  3026. c.PageToken(x.NextPageToken)
  3027. }
  3028. }