Do executes the "firebaserules.projects.test" call. Exactly one of *TestRulesetResponse or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *TestRulesetResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

Do is referenced in 0 repositories


// Test: Test `Source` for syntactic and semantic correctness. Issues
// present in the
// rules, if any, will be returned to the caller with a description,
// severity,
// and source location.
// The test method will typically be executed with a developer
// provided
// `Source`, but if regression testing is desired, this method may
// be
// executed against a `Ruleset` resource name and the `Source` will
// be
// retrieved from the persisted `Ruleset`.
// The following is an example of `Source` that permits users to upload
// images
// to a bucket bearing their user id and matching the correct
// metadata:
// _*Example*_
//     // Users are allowed to subscribe and unsubscribe to the blog.
//     service {
//       match /users/{userId}/images/{imageName} {
//           allow write: if userId == request.userId
//               && (imageName.endsWith('.png') ||
// imageName.endsWith('.jpg'))
//               && resource.mimeType.startsWith('image/')
//       }
//     }
func (r *ProjectsService) Test(name string, testrulesetrequest *TestRulesetRequest) *ProjectsTestCall {
	c := &ProjectsTestCall{s: r.s, urlParams_: make(gensupport.URLParams)} = name
	c.testrulesetrequest = testrulesetrequest
	return c

// Fields allows partial responses to be retrieved. See
// for more information.
func (c *ProjectsTestCall) Fields(s ...googleapi.Field) *ProjectsTestCall {
	c.urlParams_.Set("fields", googleapi.CombineFields(s))
	return c

// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ProjectsTestCall) Context(ctx context.Context) *ProjectsTestCall {
	c.ctx_ = ctx
	return c

func (c *ProjectsTestCall) doRequest(alt string) (*http.Response, error) {
	reqHeaders := make(http.Header)
	reqHeaders.Set("User-Agent", c.s.userAgent())
	var body io.Reader = nil
	body, err := googleapi.WithoutDataWrapper.JSONReader(c.testrulesetrequest)
	if err != nil {
		return nil, err
	reqHeaders.Set("Content-Type", "application/json")