You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

3136 lines
110 KiB

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